langchain.agents.format_scratchpad.openai_functions.format_to_openai_function_messages¶

langchain.agents.format_scratchpad.openai_functions.format_to_openai_function_messages(intermediate_steps: Sequence[Tuple[AgentAction, str]]) List[BaseMessage][source]¶

Convert (AgentAction, tool output) tuples into FunctionMessages.

Parameters

intermediate_steps (Sequence[Tuple[AgentAction, str]]) – Steps the LLM has taken to date, along with observations

Returns

list of messages to send to the LLM for the next prediction

Raises

ValueError – if the observation cannot be converted to a string.

Return type

List[BaseMessage]

Examples using format_to_openai_function_messages¶