AgentState
This class represents the state of an agent, including its message history, generation status, iteration count, error messages, and final output. It utilizes Pydantic for data validation and management.
Attributes
-
messages: list[dict[str, str]] = []
- A list of dictionaries, where each dictionary represents a message with string keys and string values. Defaults to an empty list.
-
generation: Code = Code()
- Represents a code generation object. Defaults to a new Code object.
-
iterations: int = 0
- The number of iterations performed. Defaults to 0.
-
error: str = 'no'
- A string indicating if an error occurred. Defaults to 'no'.
-
output: Optional[str] = None
- An optional string representing the output. Defaults to None.
Constructors
-
Initializes the AgentState object.
-
Parameters
- messages: list[dict[str, str]]
- A list of messages, where each message is a dictionary with string keys and string values.
- generation: Code
- The generation object, defaulting to a new Code object.
- iterations: int
- The number of iterations, defaulting to 0.
- error: str
- The error message, defaulting to 'no'.
- output: Optional[str]
- The output string, which can be None.
- messages: list[dict[str, str]]