forked from Archives/langchain
Stringify `AgentType` before saving to yaml (#2998)
Code to reproduce the issue (with `langchain==0.0.141`): ```python from langchain.agents import initialize_agent, load_tools from langchain.llms import OpenAI llm = OpenAI(temperature=0.9, verbose=True) tools = load_tools(["llm-math"], llm=llm) agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True) agent.save_agent("agent.yaml") with open("agent.yaml") as f: print(f.read()) ``` Output: ``` _type: !!python/object/apply:langchain.agents.agent_types.AgentType - zero-shot-react-description allowed_tools: - Calculator ... ``` I expected `_type` to be `zero-shot-react-description` but it's actually not. This PR fixes it by stringifying `AgentType` (`Enum`). Signed-off-by: harupy <hkawamura0130@gmail.com>fix_agent_callbacks
parent
e25528c4f0
commit
ba9cc230fa
Loading…
Reference in New Issue