langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser¶
class langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser[source]¶
Bases: AgentOutputParser
Parses ReAct-style LLM calls that have a single tool input.
Expects output to be in one of two formats.
If the output signals that an action should be taken,
should be in the below format. This will result in an AgentAction
being returned.
`
Thought: agent thought here
Action: search
Action Input: what is the temperature in SF?
`
If the output signals that a final answer should be given,
should be in the below format. This will result in an AgentFinish
being returned.
`
Thought: agent thought here
Final Answer: The temperature is 100 degrees
`
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶
Default implementation of abatch, which calls ainvoke N times.
Subclasses should override this method if they can batch more efficiently.
async ainvoke(input: str | langchain.schema.messages.BaseMessage, config: langchain.schema.runnable.config.RunnableConfig | None = None, **kwargs: Optional[Any]) → T¶
Default implementation of ainvoke, which calls invoke in a thread pool.
Subclasses should override this method if they can run asynchronously.
async aparse(text: str) → T¶
Parse a single string model output into some structure.
Parameters
text – String output of a language model.
Returns
Structured output.