Why does the langchain agent custom template {agent_scratchpa} contain objects? How does it parse into a string?

14 Views Asked by At

Template: prompt_template = """ ... ...

history: {chat_history}

new input: {input} {agent_scratchpad} """

But if I print out prompt, why is the stuff in {agent_scratchpad} object? Instead of a string? history: []

new input: Shenzhen weather [AIMessage(content='getWeather\njson\n{\n "action": "getWeather",\n "action_input": "shenzhen"\n}\n'), HumanMessage(content="TOOL RESPONSE: \n---------------------\nShenzhen Weather Friday March 29, 2024 February 20, 24 ° C Cloudy 22 ~ 28 ° C Humidity: 89% Wind Direction: Southwest wind Level 2 Ultraviolet: None Air quality: Excellent PM: 20 Sun: 06:18 Sunset: 18:38\n\nUSER'S INPUT\n--------------------\n\nOkay, so what is the response to my last comment? If using information obtained from the tools you must mention it explicitly without mentioning the tool names - I have forgotten all TOOL RESPONSES! Remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else - even if you just want to respond to the user. Do NOT respond with anything except a JSON snippet no matter what!")]

Help me solve the problem, thank you very much!

0

There are 0 best solutions below