Skip to main content
Version: 1.0

aixplain.modules.model.connection

Copyright 2025 The aiXplain SDK authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Author: Ahmet Gündüz Date: September 10th 2025 Description: Connection Tool Class.

ConnectAction Objects

class ConnectAction()

[view_source]

A class representing an action that can be performed by a connection.

This class defines the structure of a connection action with its name, description, code, and input parameters.

Attributes:

  • name Text - The display name of the action.
  • description Text - A detailed description of what the action does.
  • code Optional[Text] - The internal code/identifier for the action.
  • inputs Optional[Dict] - The input parameters required by the action.

__init__

def __init__(name: Text,
description: Text,
code: Optional[Text] = None,
inputs: Optional[Dict] = None)

[view_source]

Initialize a new ConnectAction instance.

Arguments:

  • name Text - The display name of the action.
  • description Text - A detailed description of what the action does.
  • code Optional[Text], optional - The internal code/identifier for the action. Defaults to None.
  • inputs Optional[Dict], optional - The input parameters required by the action. Defaults to None.

__repr__

def __repr__()

[view_source]

Return a string representation of the ConnectAction instance.

Returns:

  • str - A string in the format "Action(code=<code>, name=<name>)".

ConnectionTool Objects

class ConnectionTool(Model)

[view_source]

A class representing a connection tool.

This class defines the structure of a connection tool with its actions and action scope.

Attributes:

  • actions List[ConnectAction] - A list of available actions for this connection.
  • action_scope Optional[List[ConnectAction]] - The scope of actions for this connection.

__init__

def __init__(id: Text,
name: Text,
description: Text = "",
api_key: Optional[Text] = None,
supplier: Union[Dict, Text, Supplier, int] = "aiXplain",
version: Optional[Text] = None,
function: Optional[Function] = None,
is_subscribed: bool = False,
cost: Optional[Dict] = None,
function_type: Optional[FunctionType] = FunctionType.CONNECTION,
**additional_info) -> None

[view_source]

Initialize a new ConnectionTool instance.

Arguments:

  • id Text - ID of the Connection
  • name Text - Name of the Connection
  • description Text, optional - Description of the Connection. Defaults to "".
  • api_key Text, optional - API key of the Connection. Defaults to None.
  • supplier Union[Dict, Text, Supplier, int], optional - Supplier of the Connection. Defaults to "aiXplain".
  • version Text, optional - Version of the Connection. Defaults to "1.0".
  • function Function, optional - Function of the Connection. Defaults to None.
  • is_subscribed bool, optional - Is the user subscribed. Defaults to False.
  • cost Dict, optional - Cost of the Connection. Defaults to None.
  • function_type FunctionType, optional - Type of the Connection. Defaults to FunctionType.CONNECTION.
  • name0 - Any additional Connection info to be saved

get_action_inputs

def get_action_inputs(action: Union[ConnectAction, Text])

[view_source]

Retrieve the input parameters required for a specific action.

Arguments:

  • action Union[ConnectAction, Text] - The action to get inputs for, either as a ConnectAction object or as a string code.

Returns:

  • Dict - A dictionary containing the input parameters for the action.

Raises:

  • Exception - If the inputs cannot be retrieved from the server.

run

def run(action: Union[ConnectAction, Text], inputs: Dict)

[view_source]

Execute a specific action with the provided inputs.

Arguments:

  • action Union[ConnectAction, Text] - The action to execute, either as a ConnectAction object or as a string code.
  • inputs Dict - The input parameters for the action.

Returns:

  • Response - The response from the server after executing the action.

get_parameters

def get_parameters() -> List[Dict]

[view_source]

Get the parameters for all actions in the current action scope.

Returns:

  • List[Dict] - A list of dictionaries containing the parameters for each action in the action scope. Each dictionary contains the action's code, name, description, and input parameters.

Raises:

  • AssertionError - If the action scope is not set or is empty.

__repr__

def __repr__()

[view_source]

Return a string representation of the ConnectionTool instance.

Returns:

  • str - A string in the format "ConnectionTool(id=<id>, name=<name>)".