python.langchain.com-ChatAgent LangChain documentation
python.langchain.com-ChatAgent LangChain documentation
python.langchain.com/v0.2/api_reference/langchain/agents/langchain.agents.chat.base.ChatAgent.html
Bases: Agent
Chat Agent.
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.
Parameters:
intermediate_steps (List[Tuple[AgentAction, str]]) – Steps the LLM has taken
to date, along with observations.
Returns:
Action specifying what tool to use.
Return type:
AgentAction | AgentFinish
1/5
can. You have access to the following tools:', system_message_suffix: str =
'Begin! Reminder to always use the exact characters `Final Answer` when
responding.', human_message: str = '{input}\n\n{agent_scratchpad}',
format_instructions: str = 'The way you use the tools is by specifying a json
blob.\nSpecifically, this json should have a `action` key (with the name of the
tool to use) and a `action_input` key (with the input to the tool going
here).\n\nThe only values that should be in the "action" field are:
{tool_names}\n\nThe $JSON_BLOB should only contain a SINGLE action, do
NOT return a list of multiple actions. Here is an example of a valid
$JSON_BLOB:\n\n```\n{{{{\n "action": $TOOL_NAME,\n "action_input":
$INPUT\n}}}}\n```\n\nALWAYS use the following format:\n\nQuestion: the input
question you must answer\nThought: you should always think about what to
do\nAction:\n```\n$JSON_BLOB\n```\nObservation: the result of the action\n...
(this Thought/Action/Observation can repeat N times)\nThought: I now know
the final answer\nFinal Answer: the final answer to the original input question',
input_variables: List[str] | None = None) → BasePromptTemplate[source]#
Create a prompt from a list of tools.
Parameters:
tools (Sequence[BaseTool]) – A list of tools.
Returns:
A prompt template.
Return type:
BasePromptTemplate
2/5
Parameters:
llm (BaseLanguageModel) – The language model.
Returns:
An agent.
Return type:
Agent
Return type:
List[str] | None
Parameters:
3/5
intermediate_steps (List[Tuple[AgentAction, str]]) – Steps the LLM has taken
to date, along with observations.
Returns:
Full inputs for the LLMChain.
Return type:
Dict[str, Any]
Parameters:
intermediate_steps (List[Tuple[AgentAction, str]]) – Steps the LLM has taken
to date, along with observations.
Returns:
Action specifying what tool to use.
Return type:
AgentAction | AgentFinish
Return response when agent has been stopped due to max iterations.
Parameters:
early_stopping_method (str) – Method to use for early stopping.
Returns:
Agent finish object.
Return type:
AgentFinish
4/5
Raises:
ValueError – If early_stopping_method is not in [‘force’, ‘generate’].
Parameters:
file_path (Path | str) – Path to file to save the agent to.
Return type:
None
tool_run_logging_kwargs() → Dict#
Return logging kwargs for tool run.
Return type:
Dict
5/5