motleycrew.agents.langchain.tool_calling_react_prompts

Classes

ToolCallingReActPrompts()

ToolCallingReActPromptsForAnthropic()

ToolCallingReActPromptsForOpenAI()

class motleycrew.agents.langchain.tool_calling_react_prompts.ToolCallingReActPrompts

Bases: object

main_instruction: str
output_instruction_with_output_handler: str
output_instruction_without_output_handler: str
example_messages: list[BaseMessage]
reminder_message_with_output_handler: BaseMessage
reminder_message_without_output_handler: BaseMessage
__init__()
class motleycrew.agents.langchain.tool_calling_react_prompts.ToolCallingReActPromptsForOpenAI

Bases: ToolCallingReActPrompts

main_instruction: str = 'Answer the following questions as best you can.\nThink carefully, one step at a time, and outline the next step towards answering the question.\n\nYou have access to the following tools:\n{tools}\n\nTo use tools, you must first describe what you think the next step should be, and then call the tool or tools to get more information.\nIn this case, your reply must begin with "Thought:" and describe what the next step should be, given the information so far.\nThe reply must contain the tool call or calls that you described in the thought.\nYou may include multiple tool calls in a single reply, if necessary.\n\nIf the information so far is not sufficient to answer the question precisely and completely (rather than sloppily and approximately), don\'t hesitate to use tools again, until sufficient information is gathered.\nDon\'t stop this until you are certain that you have enough information to answer the question.\n{output_instruction}\n{output_handlers}\n\nBegin!\n'
output_instruction_without_output_handler: str = '\nIf you have sufficient information to answer the question, your reply must look like\n```\nFinal Answer: [the final answer to the original input question]\n```\nbut without the backticks.'
output_instruction_with_output_handler: str = '\nIf you have sufficient information to answer the question, you must call the relevant tool.\n\nNEVER return the final answer directly, but always do it by CALLING the relevant tool:\n'
example_messages: list[BaseMessage] = [SystemMessage(content='Here is an example of how to use the tools:', additional_kwargs={}, response_metadata={}), AIMessage(content='Thought: <your thought here>', additional_kwargs={'tool_calls': [{'index': 0, 'id': 'call_aSuMulBd6JVrHCMjyKSi93na', 'function': {'arguments': '{"arg_one": "value_one", "arg_two": "value_two"}', 'name': 'tool_name'}, 'type': 'function'}]}, response_metadata={}, tool_calls=[{'name': 'tool_name', 'args': {'arg_one': 'value_one', 'arg_two': 'value_two'}, 'id': 'call_aSuMulBd6JVrHCMjyKSi93na', 'type': 'tool_call'}]), ToolMessage(content='<tool response>', tool_call_id='call_aSuMulBd6JVrHCMjyKSi93na'), AIMessage(content='OK, I will always write a thought before calling a tool.', additional_kwargs={}, response_metadata={})]
reminder_message_with_output_handler: BaseMessage = SystemMessagePromptTemplate(prompt=PromptTemplate(input_variables=['output_handlers'], input_types={}, partial_variables={}, template='What is the next step towards answering the question?\nYour reply MUST begin with "Thought:" and describe what the next step should be.\nThe reply must contain the tool call or calls that you described in the thought.\nTOOL CALLS WITHOUT A THOUGHT WILL NOT BE ACCEPTED!\n\nIf you have sufficient information to answer the question, call the relevant tool:\n{output_handlers}\n\nWrite your reply, starting with "Thought:":\n'), additional_kwargs={})
reminder_message_without_output_handler: BaseMessage = SystemMessage(content='What is the next step towards answering the question?\nYour reply MUST begin with "Thought:" and describe what the next step should be.\nThe reply must contain the tool call or calls that you described in the thought.\nTOOL CALLS WITHOUT A THOUGHT WILL NOT BE ACCEPTED!\n\nIf you have sufficient information to answer the question, your reply must look like\n```\nFinal Answer: [the final answer to the original input question]\n```\nbut without the backticks. Do not include a thought with the final answer!\n\nWrite your reply, starting with either "Thought:" or "Final Answer:":\n', additional_kwargs={}, response_metadata={})
class motleycrew.agents.langchain.tool_calling_react_prompts.ToolCallingReActPromptsForAnthropic

Bases: ToolCallingReActPrompts

main_instruction: str = "Answer the following questions as best you can.\nThink carefully, one step at a time, and outline the next step towards answering the question.\n\nYou have access to the following tools:\n{tools}\n\nTo use tools, you must first describe what you think the next step should be, and then call the tool or tools to get more information.\nIn this case, your reply must be enclosed in `<thinking></thinking>` tags and describe what the next step should be, given the information so far.\nThe reply must contain the tool call or calls that you described in the thought.\nYou may include multiple tool calls in a single reply, if necessary.\n\nIf the information so far is not sufficient to answer the question precisely and completely (rather than sloppily and approximately), don't hesitate to use tools again, until sufficient information is gathered.\nDon't stop this until you are certain that you have enough information to answer the question.\n{output_instruction}\n{output_handlers}\n\nBegin!\n"
output_instruction_with_output_handler: str = '\nIf you have sufficient information to answer the question, you must call the relevant tool.\n\nNEVER return the final answer directly, but always do it by CALLING the relevant tool:\n'
output_instruction_without_output_handler: str = '\nIf you have sufficient information to answer the question, your reply must look like\n```\n<answer>\n[the final answer to the original input question]\n</answer>\n```\nbut without the backticks.'
example_messages: list[BaseMessage] = [HumanMessage(content='Here is an example of how to use the tools:', additional_kwargs={}, response_metadata={}), AIMessage(content='<thinking>\nyour thought goes here\n</thinking>', additional_kwargs={'tool_calls': [{'index': 0, 'id': 'call_aSuMulBd6JVrHCMjyKSi93na', 'function': {'arguments': '{"arg_one": "value_one", "arg_two": "value_two"}', 'name': 'tool_name'}, 'type': 'function'}]}, response_metadata={}, tool_calls=[{'name': 'tool_name', 'args': {'arg_one': 'value_one', 'arg_two': 'value_two'}, 'id': 'call_aSuMulBd6JVrHCMjyKSi93na', 'type': 'tool_call'}]), ToolMessage(content='<tool response>', tool_call_id='call_aSuMulBd6JVrHCMjyKSi93na'), AIMessage(content='OK, I will always write a thought before calling a tool.', additional_kwargs={}, response_metadata={})]
reminder_message_with_output_handler: BaseMessage = HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['output_handlers'], input_types={}, partial_variables={}, template='What is the next step towards answering the question?\nYour reply MUST be enclosed in `<thinking></thinking>` tags and describe what the next step should be.\nThe reply must contain the tool call or calls that you described in the thought.\nTOOL CALLS WITHOUT A THOUGHT WILL NOT BE ACCEPTED!\n\nIf you have sufficient information to answer the question, call the relevant tool:\n{output_handlers}\n\nWrite your reply, starting with `<thinking>`:\n'), additional_kwargs={})
reminder_message_without_output_handler: BaseMessage = HumanMessage(content='What is the next step towards answering the question?\nYour reply MUST be enclosed in `<thinking></thinking>` tags and describe what the next step should be.\nThe reply must contain the tool call or calls that you described in the thought.\nTOOL CALLS WITHOUT A THOUGHT WILL NOT BE ACCEPTED!\n\nIf you have sufficient information to answer the question, your reply must look like\n```\n<answer>\n[the final answer to the original input question]\n</answer>\n```\nbut without the backticks. Do not include a thought with the final answer!\n\nWrite your reply, starting with either `<thinking>` or `<answer>`:\n', additional_kwargs={}, response_metadata={})