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:
inputOptional[Any] - The input provided to the agent.outputOptional[Any] - The final output from the agent.session_idstr - Identifier for the conversation session.intermediate_stepsList[Any] - List of steps taken during execution.execution_statsOptional[Dict[str, Any]] - Statistics about the execution.critiquesstr - 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:
inputOptional[Any], optional - The input provided to the agent. Defaults to None.outputOptional[Any], optional - The final output from the agent. Defaults to None.session_idstr, optional - Identifier for the conversation session. Defaults to "".intermediate_stepsOptional[List[Any]], optional - List of steps taken during execution. Defaults to None.execution_statsOptional[Dict[str, Any]], optional - Statistics about the execution. Defaults to None.critiquesOptional[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:
dataDict[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:
keystr - 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:
keystr - The name of the attribute to set.valueAny - 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:
keyText - The name of the attribute to check.
Returns:
bool- True if the attribute exists and is accessible, False otherwise.