Skip to main content
To run the Python examples here, install aixplain 0.2.48, the last release that includes SDK v1: pip install aixplain==0.2.48 (Python 3.9 or later).
Version: v1.0

aixplain.v1.modules.agent.utils

process_variables​

def process_variables(query: Union[Text, Dict], data: Union[Dict, Text],
parameters: Dict,
agent_description: Union[Text, None]) -> Text

[view_source]

Process variables in an agent's description and input data.

This function validates and processes variables in an agent's description and input data, ensuring that all required variables are present and properly formatted.

Arguments:

  • query Union[Text, Dict] - The input data provided to the agent.
  • data Union[Dict, Text] - The data to be processed.
  • parameters Dict - The parameters available to the agent.
  • agent_description Union[Text, None] - The description of the agent.

Returns:

  • Text - The processed input data with all required variables included.

Raises:

  • AssertionError - If a required variable is not found in the data or parameters.

validate_history​

def validate_history(history)

[view_source]

Validates that history is a list of dicts, each with 'role' and 'content' keys. Raises a ValueError if validation fails.