pub fn parse_react_step(response: &str) -> Result<ReActStep, AgentError>Expand description
Parses a raw LLM response into a ReActStep.
Models usually write several labelled lines in one response, for example
Thought: ... followed by Action: .... The most decisive one wins:
Final Answer over Action over Thought. Labels must start a line and
are matched case-insensitively (**Action:** also works). Anything from an
Observation: line on is ignored, because the model is inventing a tool
result it has not received.
Supported action forms:
Action: tool(input)(one trailing)is removed, inner parentheses are kept)Action: tool: inputAction: toolfollowed by anAction Input: inputline (LangChain style)Action: toolwith no input
ยงErrors
Returns AgentError::ParseError if no label is found, or Action: names no tool.