Agents
Agents is a module provided by LangChain that acts as a reasoning engine with the data sources it has access to
There are agents that are well suited and optimized for a task, such as the AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION here the CHAT indicates that this agent is optimized for chat and REACT is a prompting technique that is used to the best reasoning performance from the Large Language Model (LLM) model, this module also supports the handling of output errors with handle_parsing_errors when there is an issue with the parsing of the output the data is sent back to the model so that this error can be resolved.
Any python can be made into a tool that can be used by the Large Language Model (LLM) using the @tool decorator on the function, the instructions for when the tool and how the tool can be defined in a docstring like the code given below
@tool
def time(text: str) -> str:
"""Returns todays date, use this for any \
questions related to knowing todays date. \
The input should always be an empty string, \
and this function will always return todays \
date - any date mathmatics should occur \
outside this function."""
return str(date.today())