langchain_experimental.agents.agent_toolkits.python.base
.create_python_agent¶
- langchain_experimental.agents.agent_toolkits.python.base.create_python_agent(llm: BaseLanguageModel, tool: PythonREPLTool, agent_type: AgentType = AgentType.ZERO_SHOT_REACT_DESCRIPTION, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = False, prefix: str = 'You are an agent designed to write and execute python code to answer questions.\nYou have access to a python REPL, which you can use to execute python code.\nIf you get an error, debug your code and try again.\nOnly use the output of your code to answer the question. \nYou might know the answer without running any code, but you should still run the code to get the answer.\nIf it does not seem like you can write code to answer the question, just return "I don\'t know" as the answer.\n', agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict[str, Any]) AgentExecutor [source]¶
从LLM和工具中构造Python代理。
- 参数
llm (BaseLanguageModel) –
tool (PythonREPLTool) –
agent_type (AgentType) –
callback_manager (可选[BaseCallbackManager]) –
verbose (布尔型) –
prefix (字符串) –
agent_executor_kwargs (可选[Dict[str, Any]]) –
kwargs (Dict[str, Any]) –
- 返回类型