id
stringlengths
14
15
text
stringlengths
27
2.12k
source
stringlengths
49
118
ac0cea215bce-8
[chain/start] [1:chain:AgentExecutor] Entering Chain run with input: { "input": "What is the weather in NYC today, yesterday, and the day before?" } [llm/start] [1:chain:AgentExecutor > 2:llm:ChatOpenAI] Entering LLM run with input: { "prompts": [ "System: You are a helpful AI assistant.\nH...
https://python.langchain.com/docs/modules/agents/agent_types/openai_multi_functions_agent
ac0cea215bce-9
"AIMessage" ], "kwargs": { "content": "", "additional_kwargs": { "function_call": { "name": "Search", "arguments": "{\n \"query\": \"weather in NYC today\"\n}" } } ...
https://python.langchain.com/docs/modules/agents/agent_types/openai_multi_functions_agent
ac0cea215bce-10
[1:chain:AgentExecutor > 3:tool:Search] Entering Tool run with input: "{'query': 'weather in NYC today'}" [tool/end] [1:chain:AgentExecutor > 3:tool:Search] [3.84s] Exiting Tool run with output: "10:00 am · Feels Like85° · WindSE 4 mph · Humidity78% · UV Index3 of 11 · Cloud Cover81% · Rain Amount0 in ....
https://python.langchain.com/docs/modules/agents/agent_types/openai_multi_functions_agent
ac0cea215bce-11
"generation_info": null, "message": { "lc": 1, "type": "constructor", "id": [ "langchain", "schema", "messages", "AIMessage" ], "kwargs": { "content": "", ...
https://python.langchain.com/docs/modules/agents/agent_types/openai_multi_functions_agent
ac0cea215bce-12
} ] ], "llm_output": { "token_usage": { "prompt_tokens": 142, "completion_tokens": 17, "total_tokens": 159 }, "model_name": "gpt-3.5-turbo-0613" }, "run": null } [tool/start] [1:chain:AgentExecutor > 5:tool:Search] Entering Tool run with i...
https://python.langchain.com/docs/modules/agents/agent_types/openai_multi_functions_agent
ac0cea215bce-13
· WindSE 4 mph · Humidity78% · UV Index3 of 11 · Cloud Cover81% · Rain Amount0 in ...\nAI: {'name': 'Search', 'arguments': '{\\n \"query\": \"weather in NYC yesterday\"\\n}'}\nFunction: New York Temperature Yesterday. Maximum temperature yesterday: 81 °F (at 1:51 pm) Minimum temperature yesterday: 72 °F (at 7:1...
https://python.langchain.com/docs/modules/agents/agent_types/openai_multi_functions_agent
ac0cea215bce-14
"langchain", "schema", "messages", "AIMessage" ], "kwargs": { "content": "Today in NYC, the weather is currently 85°F with a southeast wind of 4 mph. The humidity is at 78% and there is 81% cloud cover. There is no rain expected toda...
https://python.langchain.com/docs/modules/agents/agent_types/openai_multi_functions_agent
ac0cea215bce-15
"gpt-3.5-turbo-0613" }, "run": null } [chain/end] [1:chain:AgentExecutor] [10.18s] Exiting Chain run with output: { "output": "Today in NYC, the weather is currently 85°F with a southeast wind of 4 mph. The humidity is at 78% and there is 81% cloud cover. There is no rain expected today.\n\nYes...
https://python.langchain.com/docs/modules/agents/agent_types/openai_multi_functions_agent
524f445340e5-0
Page Not Found | 🦜�🔗 Langchain Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKPage Not FoundWe could not find what you were looking for.Please contact the owner of the site that linked you to the original URL and let them know their link is broken.CommunityDisc...
https://python.langchain.com/docs/modules/agents/agent_types/plan_and_execute.html
e5db14e50ad7-0
Conversational | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/agents/agent_types/chat_conversation_agent
e5db14e50ad7-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesConversationalOpenAI functionsOpenAI Multi Functions AgentPlan and executeReActReAct document storeSelf ask with search...
https://python.langchain.com/docs/modules/agents/agent_types/chat_conversation_agent
e5db14e50ad7-2
Thought: Do I need to use a tool? No AI: Hi Bob, nice to meet you! How can I help you today? > Finished chain. 'Hi Bob, nice to meet you! How can I help you today?'agent_chain.run(input="what's my name?") > Entering new AgentExecutor chain... Thought: Do I need to use a tool? No AI: Your name ...
https://python.langchain.com/docs/modules/agents/agent_types/chat_conversation_agent
e5db14e50ad7-3
Thai Green Curry with Coconut Rice, Thai Red Curry with Vegetables, and Thai Coconut Soup. I hope you enjoy them!"agent_chain.run(input="tell me the last letter in my name, and also tell me who won the world cup in 1978?") > Entering new AgentExecutor chain... Thought: Do I need to use a tool? Yes Action: ...
https://python.langchain.com/docs/modules/agents/agent_types/chat_conversation_agent
e5db14e50ad7-4
winds W at 5 to 10 mph. The humidity is 41%.'Using a chat model​The chat-conversational-react-description agent type lets us create a conversational agent using a chat model instead of an LLM.from langchain.memory import ConversationBufferMemoryfrom langchain.chat_models import ChatOpenAImemory = ConversationBufferMe...
https://python.langchain.com/docs/modules/agents/agent_types/chat_conversation_agent
e5db14e50ad7-5
Observation: 64 easy Thai recipes for any night of the week · Thai curry noodle soup · Thai yellow cauliflower, snake bean and tofu curry · Thai-spiced chicken hand pies · Thai ... Thought:{ "action": "Final Answer", "action_input": "Here are some Thai food dinner recipes you can try this week: Tha...
https://python.langchain.com/docs/modules/agents/agent_types/chat_conversation_agent
e5db14e50ad7-6
"action_input": "weather in pomfret" } Observation: Cloudy with showers. Low around 55F. Winds S at 5 to 10 mph. Chance of rain 60%. Humidity76%. Thought:{ "action": "Final Answer", "action_input": "Cloudy with showers. Low around 55F. Winds S at 5 to 10 mph. Chance of rain 60%. Humidity76%." ...
https://python.langchain.com/docs/modules/agents/agent_types/chat_conversation_agent
3ebc05ce5cc4-0
OpenAI functions | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/agents/agent_types/openai_functions_agent
3ebc05ce5cc4-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesConversationalOpenAI functionsOpenAI Multi Functions AgentPlan and executeReActReAct document storeSelf ask with search...
https://python.langchain.com/docs/modules/agents/agent_types/openai_functions_agent
3ebc05ce5cc4-2
The goal of the OpenAI Function APIs is to more reliably return valid and useful function calls than a generic text completion or chat API.The OpenAI Functions Agent is designed to work with these models.Install openai,google-search-results packages which are required as the langchain packages call them internallypip i...
https://python.langchain.com/docs/modules/agents/agent_types/openai_functions_agent
3ebc05ce5cc4-3
Input should be in the form of a question containing full context" )]agent = initialize_agent(tools, llm, agent=AgentType.OPENAI_FUNCTIONS, verbose=True)agent.run("Who is Leo DiCaprio's girlfriend? What is her current age raised to the 0.43 power?") > Entering new chain... Invoking: `Search` with `{'query...
https://python.langchain.com/docs/modules/agents/agent_types/openai_functions_agent
6df050fdc2b7-0
Plan and execute | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/agents/agent_types/plan_and_execute
6df050fdc2b7-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesConversationalOpenAI functionsOpenAI Multi Functions AgentPlan and executeReActReAct document storeSelf ask with search...
https://python.langchain.com/docs/modules/agents/agent_types/plan_and_execute
6df050fdc2b7-2
for when you need to answer questions about math" ),]Planner, Executor, and Agent​model = ChatOpenAI(temperature=0)planner = load_chat_planner(model)executor = load_agent_executor(model, tools, verbose=True)agent = PlanAndExecute(planner=planner, executor=executor, verbose=True)Run Example​agent.run("Who is Leo ...
https://python.langchain.com/docs/modules/agents/agent_types/plan_and_execute
6df050fdc2b7-3
Action: ``` { "action": "Final Answer", "action_input": "Leo DiCaprio is currently linked to Gigi Hadid." } ``` > Finished chain. ***** Step: Search for Leo DiCaprio's girlfriend on the internet. Response: Leo DiCaprio is currently linked to Gigi Hadid. > Enterin...
https://python.langchain.com/docs/modules/agents/agent_types/plan_and_execute
6df050fdc2b7-4
current age.'), StepResponse(response='28 years'))] Current objective: None Action: ``` { "action": "Final Answer", "action_input": "Gigi Hadid's current age is 28 years." } ``` > Finished chain. ***** Step: Find her current age. Response: Gigi Hadid's...
https://python.langchain.com/docs/modules/agents/agent_types/plan_and_execute
6df050fdc2b7-5
to the 0.43 power is approximately 4.19." } ``` > Finished chain. ***** Step: Raise her current age to the 0.43 power using a calculator or programming language. Response: Gigi Hadid's current age raised to the 0.43 power is approximately 4.19. > Entering new AgentExecutor c...
https://python.langchain.com/docs/modules/agents/agent_types/plan_and_execute
6df050fdc2b7-6
> Finished chain. "Gigi Hadid's current age raised to the 0.43 power is approximately 4.19."PreviousOpenAI Multi Functions AgentNextReActCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc.
https://python.langchain.com/docs/modules/agents/agent_types/plan_and_execute
9264a2b044c5-0
Toolkits | 🦜�🔗 Langchain Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesHow-toToolsToolkitsCallbacksModulesGuidesEcosystemAdditional resourcesModulesAgen...
https://python.langchain.com/docs/modules/agents/toolkits/
b1a4fe01ec7f-0
Add Memory to OpenAI Functions Agent | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/agents/how_to/add_memory_openai_functions
b1a4fe01ec7f-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesHow-toAdd Memory to OpenAI Functions AgentRunning Agent as an IteratorCombine agents and vector storesAsync APICreate C...
https://python.langchain.com/docs/modules/agents/how_to/add_memory_openai_functions
b1a4fe01ec7f-2
= SerpAPIWrapper()llm_math_chain = LLMMathChain.from_llm(llm=llm, verbose=True)db = SQLDatabase.from_uri("sqlite:///../../../../../notebooks/Chinook.db")db_chain = SQLDatabaseChain.from_llm(llm, db, verbose=True)tools = [ Tool( name="Search", func=search.run, description="useful for when you nee...
https://python.langchain.com/docs/modules/agents/how_to/add_memory_openai_functions
b1a4fe01ec7f-3
How can I assist you today? > Finished chain. 'Hello! How can I assist you today?'agent.run("my name is bob") > Entering new chain... Nice to meet you, Bob! How can I help you today? > Finished chain. 'Nice to meet you, Bob! How can I help you today?'agent.run("whats my name") ...
https://python.langchain.com/docs/modules/agents/how_to/add_memory_openai_functions
0b19965695b8-0
Tools | 🦜�🔗 Langchain Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesHow-toToolsDefining Custom ToolsHuman-in-the-loop Tool ValidationMulti-Input ToolsTo...
https://python.langchain.com/docs/modules/agents/tools/
7d8881fe4492-0
Tool Input Schema | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/agents/tools/tool_input_validation
7d8881fe4492-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesHow-toToolsDefining Custom ToolsHuman-in-the-loop Tool ValidationMulti-Input ToolsTool Input SchemaTools as OpenAI Func...
https://python.langchain.com/docs/modules/agents/tools/tool_input_validation
7d8881fe4492-2
f"Domain {domain} is not on the approved list:" f" {sorted(_APPROVED_DOMAINS)}" ) return valuestool = RequestsGetTool( args_schema=ToolInputSchema, requests_wrapper=TextRequestsWrapper())agent = initialize_agent( [tool], llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=Fa...
https://python.langchain.com/docs/modules/agents/tools/tool_input_validation
7d8881fe4492-3
215 if kwargs and not args: 216 return self(kwargs)[self.output_keys[0]] File ~/code/lc/lckg/langchain/chains/base.py:116, in Chain.__call__(self, inputs, return_only_outputs) 114 except (KeyboardInterrupt, Exception) as e: 115 self.callback_manager.on_chain_error(e, verbose=self.verbose...
https://python.langchain.com/docs/modules/agents/tools/tool_input_validation
7d8881fe4492-4
inputs) 790 # We now enter the agent loop (until it returns something). 791 while self._should_continue(iterations, time_elapsed): --> 792 next_step_output = self._take_next_step( 793 name_to_tool_map, color_mapping, inputs, intermediate_steps 794 ) 795 if isins...
https://python.langchain.com/docs/modules/agents/tools/tool_input_validation
7d8881fe4492-5
else: 702 tool_run_kwargs = self.agent.tool_run_logging_kwargs() File ~/code/lc/lckg/langchain/tools/base.py:110, in BaseTool.run(self, tool_input, verbose, start_color, color, **kwargs) 101 def run( 102 self, 103 tool_input: Union[str, Dict], (...) 107 **kwar...
https://python.langchain.com/docs/modules/agents/tools/tool_input_validation
7d8881fe4492-6
compatability 74 return tool_input File ~/code/lc/lckg/.venv/lib/python3.11/site-packages/pydantic/main.py:526, in pydantic.main.BaseModel.parse_obj() File ~/code/lc/lckg/.venv/lib/python3.11/site-packages/pydantic/main.py:341, in pydantic.main.BaseModel.__init__() ValidationError: 1 validation error f...
https://python.langchain.com/docs/modules/agents/tools/tool_input_validation
8cf8f69eea73-0
Multi-Input Tools | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/agents/tools/multi_input_tool
8cf8f69eea73-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesHow-toToolsDefining Custom ToolsHuman-in-the-loop Tool ValidationMulti-Input ToolsTool Input SchemaTools as OpenAI Func...
https://python.langchain.com/docs/modules/agents/tools/multi_input_tool
8cf8f69eea73-2
} ``` Observation: 12 Thought: I know what to respond Action: ``` { "action": "Final Answer", "action_input": "3 times 4 is 12" } ``` > Finished chain. '3 times 4 is 12'Multi-Input Tools with a string format​An alternative to the structured tool would be to use the regu...
https://python.langchain.com/docs/modules/agents/tools/multi_input_tool
8cf8f69eea73-3
description="useful for when you need to multiply two numbers together. The input to this tool should be a comma separated list of numbers of length two, representing the two numbers you want to multiply together. For example, `1,2` would be the input if you wanted to multiply 1 by 2.", )]mrkl = initialize_agent( ...
https://python.langchain.com/docs/modules/agents/tools/multi_input_tool
783e3d992cc6-0
Tools as OpenAI Functions | 🦜�🔗 Langchain Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesHow-toToolsDefining Custom ToolsHuman-in-the-loop Tool Validatio...
https://python.langchain.com/docs/modules/agents/tools/tools_as_openai_functions
29c1ace70866-0
Defining Custom Tools | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesHow-toToolsDefining Custom ToolsHuman-in-the-loop Tool ValidationMulti-Input ToolsTool Input SchemaTools as OpenAI Func...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-2
Tool dataclass, or by subclassing the BaseTool class.Tool dataclass​The 'Tool' dataclass wraps functions that accept a single string input and returns a string output.# Load the tool configs that are needed.search = SerpAPIWrapper()llm_math_chain = LLMMathChain(llm=llm, verbose=True)tools = [ Tool.from_function( ...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-3
documentation for a full list of options.agent = initialize_agent( tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True)agent.run( "Who is Leo DiCaprio's girlfriend? What is her current age raised to the 0.43 power?") > Entering new AgentExecutor chain... I need to find out Leo DiCa...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-4
25**(0.43) ``` ...numexpr.evaluate("25**(0.43)")... Answer: 3.991298452658078 > Finished chain. Observation: Answer: 3.991298452658078 Thought:I now know the final answer Final Answer: Camila Morrone's current age raised to the 0.43 power is approximately 3.99. > Finished chain. "...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-5
asynchronously.""" raise NotImplementedError("custom_search does not support async")class CustomCalculatorTool(BaseTool): name = "Calculator" description = "useful for when you need to answer questions about math" args_schema: Type[BaseModel] = CalculatorInput def _run( self, query: str, run_m...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-6
the television personality in September 2022, it appears as if his "age bracket" has moved up. This follows his rumoured relationship with mere 19-year-old Eden Polani. Thought:I need to find out the current age of Eden Polani. Action: custom_search Action Input: "Eden Polani age" Observation: 19 years old ...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-7
"""Searches the API for the query.""" return f"Results for query {query}"search_apiYou can also provide arguments like the tool name and whether to return directly.@tool("search", return_direct=True)def search_api(query: str) -> str: """Searches the API for the query.""" return "Results"search_api Tool(name...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-8
given function, the fastest way to get started is with StructuredTool.from_function().import requestsfrom langchain.tools import StructuredTooldef post_message(url: str, body: dict, parameters: Optional[dict] = None) -> str: """Sends a POST request to the given url with the given body and parameters.""" result = ...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-9
query: str, engine: str = "google", gl: str = "us", hl: str = "en", run_manager: Optional[AsyncCallbackManagerForToolRun] = None, ) -> str: """Use the tool asynchronously.""" raise NotImplementedError("custom_search does not support async")# You can provide a custom args sch...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-10
hl}) return search_wrapper.run(query) async def _arun( self, query: str, engine: str = "google", gl: str = "us", hl: str = "en", run_manager: Optional[AsyncCallbackManagerForToolRun] = None, ) -> str: """Use the tool asynchronously.""" raise NotImplem...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-11
is her current age raised to the 0.43 power?") > Entering new AgentExecutor chain... I need to find out Leo DiCaprio's girlfriend's name and her age. Action: Google Search Action Input: "Leo DiCaprio girlfriend" Observation: After rumours of a romance with Gigi Hadid, the Oscar winner has seeming...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-12
example, you made a custom tool, which gets information on music from your database. When a user wants information on songs, You want the Agent to use the custom tool more than the normal Search tool. But the Agent might prioritize a normal Search tool.This can be accomplished by adding a statement such as Use this mo...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-13
Entering new AgentExecutor chain... I should use a music search engine to find the answer Action: Music Search Action Input: most famous song of christmas'All I Want For Christmas Is You' by Mariah Carey. I now know the final answer Final Answer: 'All I Want For Christmas Is You' by Mariah Carey. > ...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-14
a tool encounters an error and the exception is not caught, the agent will stop executing. If you want the agent to continue execution, you can raise a ToolException and set handle_tool_error accordingly. When ToolException is thrown, the agent will not stop working, but will handle the exception according to the handl...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-15
name="Search_tool1", description=description, handle_tool_error=True, ), Tool.from_function( func=search_tool2, name="Search_tool2", description=description, handle_tool_error=_handle_error, ), Tool.from_function( func=search_tool3.run, name="Search_to...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
29c1ace70866-16
DiCaprio girlfriend" Observation: Leonardo DiCaprio and Gigi Hadid were recently spotted at a pre-Oscars party, sparking interest once again in their rumored romance. The Revenant actor and the model first made headlines when they were spotted together at a New York Fashion Week afterparty in September 2022. Thou...
https://python.langchain.com/docs/modules/agents/tools/custom_tools
269791a22f2d-0
Human-in-the-loop Tool Validation | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsAgent typesHow-toToolsDefining Custom ToolsHuman-in-the-loop Tool ValidationMulti-Input ToolsTool Input SchemaTools as OpenAI Func...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-2
libexec local sbin share standalone print(tool.run("ls /private")) Do you approve of the following input? Anything except 'Y'/'Yes' (case-insensitive) will be treated as a no. ls /private no --------------------------------------------------------------------------- HumanRejectedExcept...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-3
in CallbackManager.on_tool_start(self, serialized, input_str, run_id, parent_run_id, **kwargs) 669 if run_id is None: 670 run_id = uuid4() --> 672 _handle_event( 673 self.handlers, 674 "on_tool_start", 675 "ignore_agent", 676 serialized, 677 in...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-4
{e}") File ~/langchain/langchain/callbacks/manager.py:139, in _handle_event(handlers, event_name, ignore_condition_name, *args, **kwargs) 135 try: 136 if ignore_condition_name is None or not getattr( 137 handler, ignore_condition_name 138 ): --> 139 getattr(hand...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-5
{input_str} to tool {serialized} were rejected." 50 ) HumanRejectedException: Inputs ls /private to tool {'name': 'terminal', 'description': 'Run shell commands on this MacOS machine.'} were rejected.Configuring Human Approval​Let's suppose we have an agent that takes in multiple tools, and we want...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-6
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,)agent.run( "It's 2023 now. How many years ago did Konrad Adenauer become Chancellor of Germany.", callbacks=callbacks,) 'Konrad Adenauer became Chancellor of Germany in 1949, 74 years ago.'agent.run("print 'Hello World' in the terminal", callbacks=callbacks) 'Hel...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-7
in Chain.__call__(self, inputs, return_only_outputs, callbacks) 138 except (KeyboardInterrupt, Exception) as e: 139 run_manager.on_chain_error(e) --> 140 raise e 141 run_manager.on_chain_end(outputs) 142 return self.prep_outputs(inputs, outputs, return_only_outputs) File ~/lang...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-8
951 # We now enter the agent loop (until it returns something). 952 while self._should_continue(iterations, time_elapsed): --> 953 next_step_output = self._take_next_step( 954 name_to_tool_map, 955 color_mapping, 956 inputs, 957 intermediate_step...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-9
observation = tool.run( 821 agent_action.tool_input, 822 verbose=self.verbose, 823 color=color, 824 callbacks=run_manager.get_child() if run_manager else None, 825 **tool_run_kwargs, 826 ) 827 else: 828 tool_run_kwar...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-10
264 tool_args, tool_kwargs = self._to_args_and_kwargs(parsed_input) File ~/langchain/langchain/callbacks/manager.py:672, in CallbackManager.on_tool_start(self, serialized, input_str, run_id, parent_run_id, **kwargs) 669 if run_id is None: 670 run_id = uuid4() --> 672 _handle_event( 67...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-11
handler.raise_error: --> 157 raise e 158 logging.warning(f"Error in {event_name} callback: {e}") File ~/langchain/langchain/callbacks/manager.py:139, in _handle_event(handlers, event_name, ignore_condition_name, *args, **kwargs) 135 try: 136 if ignore_condition_name is None or...
https://python.langchain.com/docs/modules/agents/tools/human_approval
269791a22f2d-12
---> 48 raise HumanRejectedException( 49 f"Inputs {input_str} to tool {serialized} were rejected." 50 ) HumanRejectedException: Inputs ls /private to tool {'name': 'terminal', 'description': 'Run shell commands on this MacOS machine.'} were rejected.PreviousDefining Custom...
https://python.langchain.com/docs/modules/agents/tools/human_approval