aixplain.modules.agent.agent_response_data
AgentResponseData Objects
class AgentResponseData()
A container for agent execution response data.
This class encapsulates the input, output, and execution details of an agent's response, including intermediate steps and execution statistics.
Attributes:
input
Optional[Any] - The input provided to the agent.output
Optional[Any] - The final output from the agent.session_id
str - Identifier for the conversation session.intermediate_steps
List[Any] - List of steps taken during execution.execution_stats
Optional[Dict[str, Any]] - Statistics about the execution.critiques
str - Any critiques or feedback about the execution.
__init__
def __init__(input: Optional[Any] = None,
output: Optional[Any] = None,
session_id: str = "",
intermediate_steps: Optional[List[Any]] = None,
execution_stats: Optional[Dict[str, Any]] = None,
critiques: Optional[str] = None)
Initialize a new AgentResponseData instance.
Arguments:
input
Optional[Any], optional - The input provided to the agent. Defaults to None.output
Optional[Any], optional - The final output from the agent. Defaults to None.session_id
str, optional - Identifier for the conversation session. Defaults to "".intermediate_steps
Optional[List[Any]], optional - List of steps taken during execution. Defaults to None.execution_stats
Optional[Dict[str, Any]], optional - Statistics about the execution. Defaults to None.critiques
Optional[str], optional - Any critiques or feedback about the execution. Defaults to None.
from_dict
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "AgentResponseData"
Create an AgentResponseData instance from a dictionary.
Arguments:
data
Dict[str, Any] - Dictionary containing response data with keys:- input: The input provided to the agent
- output: The final output from the agent
- session_id: Identifier for the conversation session
- intermediate_steps: List of steps taken during execution
- executionStats: Statistics about the execution
- critiques: Any critiques or feedback
Returns:
AgentResponseData
- A new instance populated with the dictionary data.
to_dict
def to_dict() -> Dict[str, Any]
Convert the response data to a dictionary representation.
Returns:
Dict[str, Any]: A dictionary containing all response data with keys:
- input: The input provided to the agent
- output: The final output from the agent
- session_id: Identifier for the conversation session
- intermediate_steps: List of steps taken during execution
- executionStats: Statistics about the execution
- execution_stats: Alias for executionStats
- critiques: Any critiques or feedback
__getitem__
def __getitem__(key: str) -> Any
Get an attribute value using dictionary-style access.
Arguments:
key
str - The name of the attribute to get.
Returns:
Any
- The value of the attribute, or None if not found.
__setitem__
def __setitem__(key: str, value: Any) -> None
Set an attribute value using dictionary-style access.
Arguments:
key
str - The name of the attribute to set.value
Any - The value to assign to the attribute.
Raises:
KeyError
- If the key is not a valid attribute of the class.
__repr__
def __repr__() -> str
Return a string representation of the response data.
Returns:
str
- A string showing all attributes and their values in a readable format.
__contains__
def __contains__(key: Text) -> bool
Check if an attribute exists using 'in' operator.
Arguments:
key
Text - The name of the attribute to check.
Returns:
bool
- True if the attribute exists and is accessible, False otherwise.