aixplain.v2.agent
Agent Objects
class Agent(BaseResource, ListResourceMixin[BareListParams, "Agent"],
GetResourceMixin[BareGetParams, "Agent"])
Resource for agents.
Attributes:
RESOURCE_PATH
- str: The resource path.PAGINATE_PATH
- None: The path for pagination.PAGINATE_METHOD
- str: The method for pagination.PAGINATE_ITEMS_KEY
- None: The key for the response.
create_pipeline_tool
@classmethod
def create_pipeline_tool(cls,
description: str,
pipeline: Union["Pipeline", str],
name: Optional[str] = None) -> "PipelineTool"
Create a new pipeline tool.
create_python_interpreter_tool
@classmethod
def create_python_interpreter_tool(cls) -> "PythonInterpreterTool"
Create a new python interpreter tool.
create_custom_python_code_tool
@classmethod
def create_custom_python_code_tool(
cls,
code: Union[str, Callable],
name: str,
description: str = "") -> "CustomPythonCodeTool"
Create a new custom python code tool.
create_sql_tool
@classmethod
def create_sql_tool(cls,
name: str,
description: str,
source: str,
source_type: str,
schema: Optional[str] = None,
tables: Optional[List[str]] = None,
enable_commit: bool = False) -> "SQLTool"
Create a new SQL tool.
Arguments:
description
str - description of the database toolsource
Union[str, Dict] - database source - can be a connection string or dictionary with connection detailssource_type
str - type of source (sqlite, csv)schema
Optional[str], optional - database schema descriptiontables
Optional[List[str]], optional - table names to work with (optional)enable_commit
bool, optional - enable to modify the database (optional)
Returns:
SQLTool
- created SQLTool
Examples:
SQLite - Simple
sql_tool = Agent.create_sql_tool( description="My SQLite Tool", source="/path/to/database.sqlite", source_type="sqlite", tables=["users", "products"] )
CSV - Simple
sql_tool = Agent.create_sql_tool( description="My CSV Tool", source="/path/to/data.csv", source_type="csv", tables=["data"] )