mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
eaeb8a5f71
**Description:** With this modification, users can customize the `FORMAT_INSTRUCTIONS` template, allowing them to create their own prompts As it is happening in [this](https://github.com/langchain-ai/langchain/issues/10721) issue, the `FORMAT_INSTRUCTIONS` is not customizable for the output parser, unless you create your own class `ConvoOutputParser`. To avoid this, a modification was done, creating a `format_instruction` variable that users can customize with ease after initialize the agent. For example: ``` agent = initialize_agent( agent = AgentType.CHAT_CONVERSATIONAL_REACT_DESCRIPTION, tools = tools, llm = llm_agent, verbose = True, max_iterations = 3, early_stopping_method = 'generate', memory = b_w_memory, handle_parsing_errors = True, agent_kwargs={ 'system_message':PREFIX, 'human_message':SUFFIX, 'template_tool_response':TEMPLATE_TOOL_RESPONSE, } ) agent.agent.output_parser.format_instructions = "MY CUSTOM FORMAT INSTRUCTIONS" print(agent.agent.output_parser.get_format_instructions()) MY CUSTOM FORMAT INSTRUCTIONS ``` Other parameters like `system_message`, `human_message`, or `template_tool_response` are already customizable and with this PR, the last parameter `FORMAT_INSTRUCTIONS` in `langchain.agents.conversational_chat.prompt` can be modified. **Issue:** https://github.com/langchain-ai/langchain/issues/10721 **Dependencies:** No new dependencies required for this change **Twitter handle:** With my github user is enough. Thanks I hope you accept my PR. --------- Co-authored-by: Bagatur <baskaryan@gmail.com> |
||
---|---|---|
.. | ||
cli | ||
community | ||
core | ||
experimental | ||
langchain | ||
partners |