Skip to main content
Version: 2.0

aixplain.v2.integration

Integration module for managing external service integrations.

ActionInputsProxy Objects

class ActionInputsProxy()

[view_source]

Proxy object that provides both dict-like and dot notation access to action input parameters.

This proxy dynamically fetches action input specifications from the container resource when needed, allowing for runtime discovery and validation of action inputs.

__init__

def __init__(container, action_name: str)

[view_source]

Initialize ActionInputsProxy with container and action name.

__getitem__

def __getitem__(key: str)

[view_source]

Get input value by key.

__setitem__

def __setitem__(key: str, value)

[view_source]

Set input value by key.

__contains__

def __contains__(key: str) -> bool

[view_source]

Check if input parameter exists.

__len__

def __len__() -> int

[view_source]

Return the number of input parameters.

__iter__

def __iter__()

[view_source]

Iterate over input parameter keys.

__getattr__

def __getattr__(name: str)

[view_source]

Get input value by attribute name.

__setattr__

def __setattr__(name: str, value)

[view_source]

Set input value by attribute name.

get

def get(key: str, default=None)

[view_source]

Get input value with optional default.

update

def update(**kwargs)

[view_source]

Update multiple inputs at once.

keys

def keys()

[view_source]

Get input parameter codes.

values

def values()

[view_source]

Get input parameter values.

items

def items()

[view_source]

Get input parameter code-value pairs.

reset_input

def reset_input(input_code: str)

[view_source]

Reset an input parameter to its backend default value.

reset_all_inputs

def reset_all_inputs()

[view_source]

Reset all input parameters to their backend default values.

__repr__

def __repr__()

[view_source]

Return string representation of the proxy.

Input Objects

@dataclass_json

@dataclass
class Input()

[view_source]

Input parameter for an action.

Action Objects

@dataclass_json

@dataclass(repr=False)
class Action()

[view_source]

Container for tool action information and inputs.

__repr__

def __repr__() -> str

[view_source]

Return a string representation showing name and input parameters.

get_inputs_proxy

def get_inputs_proxy(container) -> ActionInputsProxy

[view_source]

Get an ActionInputsProxy for this action from a container.

Arguments:

  • container - The container resource (Tool or Integration) that can fetch action specs

Returns:

  • ActionInputsProxy - A proxy object for accessing action inputs

ToolId Objects

@dataclass_json

@dataclass
class ToolId()

[view_source]

Result for tool operations.

IntegrationResult Objects

@dataclass_json

@dataclass
class IntegrationResult(Result)

[view_source]

Result for connection operations.

The backend returns the connection ID in data.id.

IntegrationSearchParams Objects

class IntegrationSearchParams(BaseSearchParams)

[view_source]

Parameters for listing integrations.

ActionMixin Objects

class ActionMixin()

[view_source]

Mixin class providing action-related functionality for integrations and tools.

list_actions

def list_actions() -> List[Action]

[view_source]

List available actions for the integration.

list_inputs

def list_inputs(*actions: str) -> List[Action]

[view_source]

List available inputs for the integration.

actions

@cached_property
def actions()

[view_source]

Get a proxy object that provides access to actions with their inputs.

This enables the syntax: mytool.actions['ACTION_NAME'].channel = 'value'

Returns:

  • ActionsProxy - A proxy object for accessing actions and their inputs

set_inputs

def set_inputs(inputs_dict: Dict[str, Dict[str, Any]]) -> None

[view_source]

Set multiple action inputs in bulk using a dictionary tree structure.

This method allows you to set inputs for multiple actions at once. Action names are automatically converted to lowercase for consistent lookup.

Arguments:

  • inputs_dict - Dictionary in the format: {
  • "ACTION_NAME" - {
  • "input_param1" - "value1",
  • "input_param2" - "value2", ... },
  • "ANOTHER_ACTION" - {
  • "input_param1" - "value1", ... } }

Example:

tool.set_inputs({

  • 'slack_send_message' - { # Will work regardless of case
  • 'channel' - 'general',
  • 'text' - 'Hello from bulk set!',
  • 'username' - 'MyBot' },
  • 'SLACK_SEND_MESSAGE' - { # Will also work
  • 'channel' - 'general',
  • 'text' - 'Hello from bulk set!',
  • 'username' - 'MyBot' },
  • 'uploadFile' - { # Will also work
  • 'channels' - 'general',
  • 'file' - 'document.pdf' } })

Raises:

  • ValueError - If an action name is not found or invalid
  • KeyError - If an input parameter is not found for an action

ActionsProxy Objects

class ActionsProxy()

[view_source]

Proxy object that provides access to actions with their inputs.

This enables the syntax: mytool.actions['ACTION_NAME'].channel = 'value'

__init__

def __init__(container)

[view_source]

Initialize ActionsProxy with container resource.

__getitem__

def __getitem__(action_name: str)

[view_source]

Get an action with its inputs proxy.

Converts action name to lowercase for consistent lookup.

__getattr__

def __getattr__(attr_name: str)

[view_source]

Get an action with its inputs proxy using attribute notation.

Converts attribute name to lowercase for consistent lookup.

__contains__

def __contains__(action_name: str) -> bool

[view_source]

Check if an action exists.

get_available_actions

def get_available_actions() -> List[str]

[view_source]

Get a list of available action names.

refresh_cache

def refresh_cache()

[view_source]

Clear the actions cache to force re-fetching.

Integration Objects

class Integration(Model, ActionMixin)

[view_source]

Resource for integrations.

Integrations are a subtype of models with Function.CONNECTOR. All connection logic is centralized here.

run

def run(**kwargs: Any) -> IntegrationResult

[view_source]

Run the integration with validation.

connect

def connect(**kwargs: Any) -> "Tool"

[view_source]

Connect the integration.

handle_run_response

def handle_run_response(response: dict, **kwargs: Any) -> IntegrationResult

[view_source]

Handle the response from the integration.