Comments (2)
@Jeomon You should call invoke like this
shell_tool.invoke(input={"command": 'python sum.py', "script_args": None, "inputs": '5\n'})
from langchain.
[0:tasks] Starting step 0 with 1 task:
- start -> {'input': 'Writer Python program to Find the sum of two numbers and save this '
'file in the current directory with the name sum.py and this program '
'must take user input.'}
[0:writes] Finished step 0 with writes to 1 channel: - input -> ('Writer Python program to Find the sum of two numbers and save this file in '
'the current directory with the name sum.py and this program must take user '
'input.')
[1:tasks] Starting step 1 with 1 task: - coder -> {'input': 'Writer Python program to Find the sum of two numbers and save this '
'file in the current directory with the name sum.py and this program '
'must take user input.',
'messages': []}
Entering new Python Code Agent chain...
Question: Write a Python program to find the sum of two numbers and save the file in the current directory with the name sum.py.
Thought: The program should take user input for the two numbers.
Action:
{
"action": "Write Tool",
"action_input": {
"directory": "D:\\Personal Projects\\Python-Assistant",
"file_name": "sum.py",
"content": "num1 = int(input('Enter first number: '))\nnum2 = int(input('Enter second number: '))\nsum = num1 + num2\nprint('The sum of the two numbers is:', sum)"
}
}
```The sum.py successfully saved to D:\Personal Projects\Python-Assistant\sum.pyAction:
{
"action": "Final Answer",
"action_input": "The Python program to find the sum of two numbers has been successfully written and saved as sum.py in the current directory. You can run the program by executing python sum.py
in the command line."
}
> Finished chain.
[1:writes] Finished step 1 with writes to 2 channels:
- input -> ('Writer Python program to Find the sum of two numbers and save this file in '
'the current directory with the name sum.py and this program must take user '
'input.')
- messages -> [HumanMessage(content='The Python program to find the sum of two numbers has been successfully written and saved as sum.py in the current directory. You can run the program by executing `python sum.py` in the command line.', name='Python Code Agent')]
[2:tasks] Starting step 2 with 1 task:
- executor -> {'input': 'Writer Python program to Find the sum of two numbers and save this '
'file in the current directory with the name sum.py and this program '
'must take user input.',
'messages': [HumanMessage(content='The Python program to find the sum of two numbers has been successfully written and saved as sum.py in the current directory. You can run the program by executing `python sum.py` in the command line.', name='Python Code Agent')]}
> Entering new Python Executor Agent chain...
Could not parse LLM output: Action:
{
"action": "shell_tool",
"action_input": {
"command": "python sum.py",
"script_args": None,
"inputs": "2\n3\n"
}
}
The method you mentioned worked when I invoked it (in standalone without any llm the earlier case) but when I used it as tool for a react agent (executor agent) it is giving Invalid or incomplete responseCould not parse LLM output and then looping around this until the iteration limit is reached but the shell tool isn't invoked at all in that iterations.
from langchain.
Related Issues (20)
- IME Input Handling Issue in Chat LangChain HOT 2
- OllamaFunction returns Object of type ModelMetaclass is not JSON serializable following example on documentation
- how to insert id_prefix when upserting using langchain pinecone.from_documents??? or what is the alternative? because id_prefix is very important when we want to delete specific vectors
- how to insert id_prefix when upserting using langchain pinecone.from_documents??? or what is the alternative? because id_prefix is very important when we want to delete specific vectors #24235
- DOC: <Please wri知识库交叉融合,在项目使用中,我有一些公用知识库和私有知识库,我想在回答的时候将私有知识库和公用的知识库结合起来,这怎么实现?后期可以更新吗te a comprehensive title after the 'DOC: ' prefix>
- LangChain AzureOpenAIEmbeddings is not working due to model trying to access microsoft HOT 1
- No module named 'langchain.transformers' HOT 3
- issue using tools with ollama local models
- variable chat_history should be a list of base messages, got HOT 2
- Missing key error - Using PromptTemplate and GraphCypherQAChain. HOT 8
- AzureSearch vector store does not support access token authentication. FIX Suggested HOT 2
- TavilySearch parameters don't change the output. HOT 6
- An output parsing error occurred.
- raise ValueError( ValueError: OpenAIChat currently only supports single prompt, got
- ConnectError: [Errno -3] Temporary failure in name resolution HOT 1
- cannot import name 'cast' from 'typing_extensions' HOT 1
- DOC: <Issue related to /v0.2/docs/integrations/text_embedding/nemo/>
- graph_ascii multi-byte width calculation problem
- DOC: <Issue related to /v0.2/docs/integrations/retrievers/pinecone_hybrid_search/>
- DOC: <Issue related to /v0.2/docs/integrations/vectorstores/google_cloud_sql_pg/> SyntaxError: 'await' outside function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from langchain.