Skip to content

Instantly share code, notes, and snippets.

@Jensssen
Created May 19, 2023 13:31
Show Gist options
  • Save Jensssen/c08df9015bddf16c64be3b55c4e0263f to your computer and use it in GitHub Desktop.
Save Jensssen/c08df9015bddf16c64be3b55c4e0263f to your computer and use it in GitHub Desktop.
LangChain Agent Format Instructions
agent_chain = initialize_agent(tools,
llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
agent_kwargs={"format_instructions": "Use the following format: \n\n"
"Question: the input question you must answer \n"
"Thought: you should always think about what to do \n"
"Action: the action to take, should be one of [{tool_names}] "
"Action Input: the input to the action \n"
"Observation: the result of the action\n... "
"(this Thought/Action/Action Input/Observation can repeat N times) \n"
"Thought: I now know the final answer \n"
"Final Answer: the final answer to the original input question, translated to German!"}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment