diff --git a/aixplain/v1/modules/model/record.py b/aixplain/v1/modules/model/record.py index bd60b825c..281858b41 100644 --- a/aixplain/v1/modules/model/record.py +++ b/aixplain/v1/modules/model/record.py @@ -1,3 +1,5 @@ +"""Record module for index operations.""" + from aixplain.enums import DataType, StorageType from typing import Optional from uuid import uuid4 @@ -71,4 +73,3 @@ def validate(self): if is_supported_image_type(self.uri): self.value_type = DataType.IMAGE self.uri = FileFactory.to_link(self.uri) if storage_type == StorageType.FILE else self.uri - self.uri = FileFactory.to_link(self.uri) if storage_type == StorageType.FILE else self.uri diff --git a/aixplain/v1/modules/pipeline/pipeline.py b/aixplain/v1/modules/pipeline/pipeline.py index 9c3d83cd0..ba6698cf7 100644 --- a/aixplain/v1/modules/pipeline/pipeline.py +++ b/aixplain/v1/modules/pipeline/pipeline.py @@ -153,14 +153,12 @@ class BenchmarkScoringAsrInputs(Inputs): input: InputParam = None text: InputParam = None - text: InputParam = None def __init__(self, node=None): """Initialize BenchmarkScoringAsrInputs.""" super().__init__(node=node) self.input = self.create_param(code="input", data_type=DataType.AUDIO, is_required=True) self.text = self.create_param(code="text", data_type=DataType.TEXT, is_required=True) - self.text = self.create_param(code="text", data_type=DataType.TEXT, is_required=True) class BenchmarkScoringAsrOutputs(Outputs): @@ -4359,14 +4357,12 @@ class BenchmarkScoringMtInputs(Inputs): input: InputParam = None text: InputParam = None - text: InputParam = None def __init__(self, node=None): """Initialize BenchmarkScoringMtInputs.""" super().__init__(node=node) self.input = self.create_param(code="input", data_type=DataType.TEXT, is_required=True) self.text = self.create_param(code="text", data_type=DataType.TEXT, is_required=True) - self.text = self.create_param(code="text", data_type=DataType.TEXT, is_required=True) class BenchmarkScoringMtOutputs(Outputs): diff --git a/docs/api-reference/python/aixplain/compat.md b/docs/api-reference/python/aixplain/compat.md new file mode 100644 index 000000000..5b3e60fba --- /dev/null +++ b/docs/api-reference/python/aixplain/compat.md @@ -0,0 +1,25 @@ +--- +sidebar_label: _compat +title: aixplain._compat +--- + +Backward-compatible import redirector for the v1 → legacy reorganization. + +After the legacy code was moved from e.g. ``aixplain/modules/`` to +``aixplain/v1/modules/``, this module ensures that all existing import paths +(``from aixplain.modules import …``, ``from aixplain.factories.model_factory import …``, +etc.) continue to work transparently via a custom ``sys.meta_path`` finder. + +The redirector is installed once during package init and has negligible runtime +cost — it only activates for import paths that match a known legacy prefix. + +#### install + +```python +def install() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/_compat.py#L74) + +Install the legacy import redirector (idempotent). + diff --git a/docs/api-reference/python/aixplain/decorators/init.md b/docs/api-reference/python/aixplain/decorators/init.md index a9eee2644..bf725d6dc 100644 --- a/docs/api-reference/python/aixplain/decorators/init.md +++ b/docs/api-reference/python/aixplain/decorators/init.md @@ -1,5 +1,6 @@ --- draft: true +draft: true sidebar_label: decorators title: aixplain.decorators --- diff --git a/docs/api-reference/python/aixplain/enums/init.md b/docs/api-reference/python/aixplain/enums/init.md index 1c2c4064f..155b29eb8 100644 --- a/docs/api-reference/python/aixplain/enums/init.md +++ b/docs/api-reference/python/aixplain/enums/init.md @@ -1,5 +1,6 @@ --- draft: true +draft: true sidebar_label: enums title: aixplain.enums --- diff --git a/docs/api-reference/python/aixplain/factories/model_factory/mixins/init.md b/docs/api-reference/python/aixplain/factories/model_factory/mixins/init.md index d840aef71..ef2deb70e 100644 --- a/docs/api-reference/python/aixplain/factories/model_factory/mixins/init.md +++ b/docs/api-reference/python/aixplain/factories/model_factory/mixins/init.md @@ -1,5 +1,6 @@ --- draft: true +draft: true sidebar_label: mixins title: aixplain.factories.model_factory.mixins --- diff --git a/docs/api-reference/python/aixplain/init.md b/docs/api-reference/python/aixplain/init.md index dab9520f5..5dcad922e 100644 --- a/docs/api-reference/python/aixplain/init.md +++ b/docs/api-reference/python/aixplain/init.md @@ -4,7 +4,6 @@ title: aixplain --- aiXplain SDK Library. ---- aiXplain SDK enables python programmers to add AI functions to their software. diff --git a/docs/api-reference/python/aixplain/modules/pipeline/designer/init.md b/docs/api-reference/python/aixplain/modules/pipeline/designer/init.md index 10863e506..00b17b4ea 100644 --- a/docs/api-reference/python/aixplain/modules/pipeline/designer/init.md +++ b/docs/api-reference/python/aixplain/modules/pipeline/designer/init.md @@ -1,5 +1,6 @@ --- draft: true +draft: true sidebar_label: designer title: aixplain.modules.pipeline.designer --- diff --git a/docs/api-reference/python/aixplain/modules/pipeline/init.md b/docs/api-reference/python/aixplain/modules/pipeline/init.md index e8484be30..e9539050c 100644 --- a/docs/api-reference/python/aixplain/modules/pipeline/init.md +++ b/docs/api-reference/python/aixplain/modules/pipeline/init.md @@ -1,5 +1,6 @@ --- draft: true +draft: true sidebar_label: pipeline title: aixplain.modules.pipeline --- diff --git a/docs/api-reference/python/aixplain/processes/data_onboarding/init.md b/docs/api-reference/python/aixplain/processes/data_onboarding/init.md index a957d8dc4..d9ad88e4d 100644 --- a/docs/api-reference/python/aixplain/processes/data_onboarding/init.md +++ b/docs/api-reference/python/aixplain/processes/data_onboarding/init.md @@ -1,5 +1,6 @@ --- draft: true +draft: true sidebar_label: data_onboarding title: aixplain.processes.data_onboarding --- diff --git a/docs/api-reference/python/aixplain/processes/init.md b/docs/api-reference/python/aixplain/processes/init.md index 55a1d9660..cec153fe9 100644 --- a/docs/api-reference/python/aixplain/processes/init.md +++ b/docs/api-reference/python/aixplain/processes/init.md @@ -1,5 +1,6 @@ --- draft: true +draft: true sidebar_label: processes title: aixplain.processes --- diff --git a/docs/api-reference/python/aixplain/utils/llm_utils.md b/docs/api-reference/python/aixplain/utils/llm_utils.md index 15176fa29..2d62ac89e 100644 --- a/docs/api-reference/python/aixplain/utils/llm_utils.md +++ b/docs/api-reference/python/aixplain/utils/llm_utils.md @@ -3,6 +3,8 @@ sidebar_label: llm_utils title: aixplain.utils.llm_utils --- +Utils for LLM operations. + #### get\_llm\_instance ```python @@ -11,7 +13,7 @@ def get_llm_instance(llm_id: Text, use_cache: bool = True) -> LLM ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/utils/llm_utils.py#L6) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/utils/llm_utils.py#L8) Get an LLM instance with specific configuration. diff --git a/docs/api-reference/python/aixplain/v1/base/parameters.md b/docs/api-reference/python/aixplain/v1/base/parameters.md new file mode 100644 index 000000000..a8b70ea59 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/base/parameters.md @@ -0,0 +1,186 @@ +--- +sidebar_label: parameters +title: aixplain.v1.base.parameters +--- + +### Parameter Objects + +```python +@dataclass +class Parameter() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L6) + +A class representing a single parameter with its properties. + +**Attributes**: + +- `name` _str_ - The name of the parameter. +- `required` _bool_ - Whether the parameter is required or optional. +- `value` _Optional[Any]_ - The value of the parameter. Defaults to None. +- `is_fixed` _bool_ - Whether the parameter value is fixed. Defaults to False. +- `values` _List[Dict[str, Any]]_ - Pre-set values for the parameter. Defaults to empty list. +- `default_values` _List[Any]_ - Default values for the parameter. Defaults to empty list. +- `available_options` _List[Dict[str, Any]]_ - Available options for selection. Defaults to empty list. +- `data_type` _Optional[str]_ - The data type of the parameter (e.g., 'text', 'number'). +- `data_sub_type` _Optional[str]_ - The sub-type of the data (e.g., 'json', 'text'). +- `multiple_values` _bool_ - Whether multiple values are allowed. Defaults to False. + +#### \_\_post\_init\_\_ + +```python +def __post_init__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L33) + +Initialize mutable default values. + +### BaseParameters Objects + +```python +class BaseParameters() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L43) + +A base class for managing a collection of parameters. + +This class provides functionality to store, access, and manipulate parameters +in a structured way. Parameters can be accessed using attribute syntax or +dictionary-style access. + +**Attributes**: + +- `parameters` _Dict[str, Parameter]_ - Dictionary storing Parameter objects. + +#### \_\_init\_\_ + +```python +def __init__() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L54) + +Initialize the BaseParameters class. + +The initialization creates an empty dictionary to store parameters. + +#### get\_parameter + +```python +def get_parameter(name: str) -> Optional[Parameter] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L61) + +Get a parameter by name. + +**Arguments**: + +- `name` _str_ - Name of the parameter + + +**Returns**: + +- `Optional[Parameter]` - Parameter object if found, None otherwise + +#### to\_dict + +```python +def to_dict() -> Dict[str, Dict[str, Any]] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L72) + +Convert parameters back to dictionary format. + +**Returns**: + + Dict[str, Dict[str, Any]]: Dictionary representation of parameters + +#### to\_list + +```python +def to_list() -> List[str] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L94) + +Convert parameters to a list format. + +This method creates a list of dictionaries containing the name and value +of each parameter that has a value set. + +**Returns**: + +- `List[str]` - A list of dictionaries, each containing 'name' and 'value' + keys for parameters that have values set. + +#### \_\_str\_\_ + +```python +def __str__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L108) + +Create a pretty string representation of the parameters. + +**Returns**: + +- `str` - Formatted string showing all parameters + +#### \_\_setattr\_\_ + +```python +def __setattr__(name: str, value: Any) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L130) + +Allow setting parameters using attribute syntax. + +This special method enables setting parameter values using attribute syntax +(e.g., params.text = "Hello"). It only works for parameters that have been +previously defined. + +**Arguments**: + +- `name` _str_ - Name of the parameter to set. +- `value` _Any_ - Value to assign to the parameter. + + +**Raises**: + +- `AttributeError` - If attempting to set a parameter that hasn't been defined. + +#### \_\_getattr\_\_ + +```python +def __getattr__(name: str) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/base/parameters.py#L153) + +Allow getting parameter values using attribute syntax. + +This special method enables accessing parameter values using attribute syntax +(e.g., params.text). It only works for parameters that have been previously +defined. + +**Arguments**: + +- `name` _str_ - Name of the parameter to access. + + +**Returns**: + +- `Any` - The value of the requested parameter. + + +**Raises**: + +- `AttributeError` - If attempting to access a parameter that hasn't been defined. + diff --git a/docs/api-reference/python/aixplain/v1/decorators/api_key_checker.md b/docs/api-reference/python/aixplain/v1/decorators/api_key_checker.md new file mode 100644 index 000000000..f46e80ccd --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/decorators/api_key_checker.md @@ -0,0 +1,42 @@ +--- +sidebar_label: api_key_checker +title: aixplain.v1.decorators.api_key_checker +--- + +API key validation decorator for aiXplain SDK. + +#### check\_api\_key + +```python +def check_api_key(method) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/decorators/api_key_checker.py#L6) + +Decorator to verify that an API key is set before executing the method. + +This decorator uses the centralized API key validation logic from config.py +to ensure consistent behavior across the entire SDK. + +**Arguments**: + +- `method` _callable_ - The method to be decorated. + + +**Returns**: + +- `callable` - The wrapped method that includes API key verification. + + +**Raises**: + +- `Exception` - If neither TEAM_API_KEY nor AIXPLAIN_API_KEY is set. + + +**Example**: + + @check_api_key + def my_api_method(): + # Method implementation + pass + diff --git a/docs/api-reference/python/aixplain/v1/decorators/init.md b/docs/api-reference/python/aixplain/v1/decorators/init.md new file mode 100644 index 000000000..f31ce00ab --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/decorators/init.md @@ -0,0 +1,6 @@ +--- +draft: true +sidebar_label: decorators +title: aixplain.v1.decorators +--- + diff --git a/docs/api-reference/python/aixplain/v1/enums/asset_status.md b/docs/api-reference/python/aixplain/v1/enums/asset_status.md new file mode 100644 index 000000000..a4f47cbf0 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/asset_status.md @@ -0,0 +1,61 @@ +--- +sidebar_label: asset_status +title: aixplain.v1.enums.asset_status +--- + +#### \_\_author\_\_ + +Copyright 2024 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: February 21st 2024 +Description: + Asset Enum + +### AssetStatus Objects + +```python +class AssetStatus(Text, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/asset_status.py#L28) + +Enumeration of possible status values for an asset in the aiXplain system. + +This enum defines all possible states that an asset can be in throughout its lifecycle, +from creation to deletion. Each enum value corresponds to a specific state in the +asset's lifecycle. + +**Attributes**: + +- `DRAFT` _str_ - Initial state for a newly created asset. +- `HIDDEN` _str_ - Asset is hidden from public view. +- `SCHEDULED` _str_ - Asset is scheduled for processing. +- `ONBOARDING` _str_ - Asset is in the process of being onboarded. +- `ONBOARDED` _str_ - Asset has been successfully onboarded. +- `PENDING` _str_ - Asset is waiting for processing. +- `FAILED` _str_ - Asset processing has failed. +- `TRAINING` _str_ - Asset is currently in training. +- `REJECTED` _str_ - Asset has been rejected. +- `ENABLING` _str_ - Asset is in the process of being enabled. +- `HIDDEN`0 _str_ - Asset is in the process of being deleted. +- `HIDDEN`1 _str_ - Asset has been disabled. +- `HIDDEN`2 _str_ - Asset has been deleted. +- `HIDDEN`3 _str_ - Asset is currently being processed. +- `HIDDEN`4 _str_ - Asset has completed processing. +- `HIDDEN`5 _str_ - Asset operation is being canceled. +- `HIDDEN`6 _str_ - Asset operation has been canceled. +- `HIDDEN`7 _str_ - Draft state that has been deprecated. + diff --git a/docs/api-reference/python/aixplain/v1/enums/code_interpreter.md b/docs/api-reference/python/aixplain/v1/enums/code_interpreter.md new file mode 100644 index 000000000..917763cfc --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/code_interpreter.md @@ -0,0 +1,37 @@ +--- +sidebar_label: code_interpreter +title: aixplain.v1.enums.code_interpreter +--- + +### CodeInterpreterModel Objects + +```python +class CodeInterpreterModel(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/code_interpreter.py#L4) + +Enumeration of available Code Interpreter model identifiers. + +This enum defines the unique identifiers for different code interpreter models +available in the system. Each value represents a specific model's ID that can +be used for code interpretation tasks. + +**Attributes**: + +- `PYTHON_AZURE` _str_ - Model ID for the Python code interpreter running on Azure. + +#### \_\_str\_\_ + +```python +def __str__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/code_interpreter.py#L17) + +Return the string representation of the model ID. + +**Returns**: + +- `str` - The model ID value as a string. + diff --git a/docs/api-reference/python/aixplain/v1/enums/data_split.md b/docs/api-reference/python/aixplain/v1/enums/data_split.md new file mode 100644 index 000000000..418bf00ad --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/data_split.md @@ -0,0 +1,45 @@ +--- +sidebar_label: data_split +title: aixplain.v1.enums.data_split +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: March 20th 2023 +Description: + Data Split Enum + +### DataSplit Objects + +```python +class DataSplit(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/data_split.py#L27) + +Enumeration of dataset split types. + +This enum defines the standard dataset split types used for machine learning tasks, +including training, validation, and testing splits. + +**Attributes**: + +- `TRAIN` _str_ - Training dataset split used for model training. +- `VALIDATION` _str_ - Validation dataset split used for model tuning. +- `TEST` _str_ - Test dataset split used for final model evaluation. + diff --git a/docs/api-reference/python/aixplain/v1/enums/data_subtype.md b/docs/api-reference/python/aixplain/v1/enums/data_subtype.md new file mode 100644 index 000000000..cb2ad59c1 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/data_subtype.md @@ -0,0 +1,64 @@ +--- +sidebar_label: data_subtype +title: aixplain.v1.enums.data_subtype +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: May 3rd 2023 +Description: + Data Subtype Enum + +### DataSubtype Objects + +```python +class DataSubtype(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/data_subtype.py#L27) + +Enumeration of data subtypes for categorizing and organizing data. + +This enum defines various subtypes that can be used to further categorize +data points within the system, particularly useful for demographic and +content-based categorization. + +**Attributes**: + +- `AGE` _str_ - Age category subtype. +- `GENDER` _str_ - Gender category subtype. +- `INTERVAL` _str_ - Time interval subtype. +- `OTHER` _str_ - Miscellaneous/other subtype. +- `RACE` _str_ - Race/ethnicity category subtype. +- `SPLIT` _str_ - Data split category subtype. +- `TOPIC` _str_ - Content topic subtype. + +#### \_\_str\_\_ + +```python +def __str__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/data_subtype.py#L52) + +Return the string representation of the data subtype. + +**Returns**: + +- `str` - The data subtype value as a string. + diff --git a/docs/api-reference/python/aixplain/v1/enums/data_type.md b/docs/api-reference/python/aixplain/v1/enums/data_type.md new file mode 100644 index 000000000..ee1d191cb --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/data_type.md @@ -0,0 +1,67 @@ +--- +sidebar_label: data_type +title: aixplain.v1.enums.data_type +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: March 20th 2023 +Description: + Data Type Enum + +### DataType Objects + +```python +class DataType(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/data_type.py#L27) + +Enumeration of supported data types in the aiXplain system. + +This enum defines all the data types that can be processed by the system, +including various media types and basic data types. + +**Attributes**: + +- `AUDIO` _str_ - Audio data type. +- `FLOAT` _str_ - Floating-point number data type. +- `IMAGE` _str_ - Image data type. +- `INTEGER` _str_ - Integer number data type. +- `LABEL` _str_ - Label/category data type. +- `TENSOR` _str_ - Tensor/multi-dimensional array data type. +- `TEXT` _str_ - Text data type. +- `VIDEO` _str_ - Video data type. +- `EMBEDDING` _str_ - Vector embedding data type. +- `NUMBER` _str_ - Generic number data type. +- `FLOAT`0 _str_ - Boolean data type. + +#### \_\_str\_\_ + +```python +def __str__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/data_type.py#L59) + +Return the string representation of the data type. + +**Returns**: + +- `str` - The data type value as a string. + diff --git a/docs/api-reference/python/aixplain/v1/enums/database_source.md b/docs/api-reference/python/aixplain/v1/enums/database_source.md new file mode 100644 index 000000000..195cdaea8 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/database_source.md @@ -0,0 +1,65 @@ +--- +sidebar_label: database_source +title: aixplain.v1.enums.database_source +--- + +#### \_\_author\_\_ + +Copyright 2024 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: Lucas Pavanelli and Thiago Castro Ferreira and Ahmet Gunduz +Date: March 7th 2025 +Description: + Database Source Type Enum + +### DatabaseSourceType Objects + +```python +class DatabaseSourceType(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/database_source.py#L27) + +Enumeration of supported database source types. + +This enum defines the different types of database sources that can be used +for data storage and retrieval in the system. + +**Attributes**: + +- `POSTGRESQL` _str_ - PostgreSQL database source type. +- `SQLITE` _str_ - SQLite database source type. +- `CSV` _str_ - CSV file source type. + +#### from\_string + +```python +@classmethod +def from_string(cls, source_type: str) -> "DatabaseSourceType" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/database_source.py#L44) + +Convert string to DatabaseSourceType enum + +**Arguments**: + +- `source_type` _str_ - Source type string + + +**Returns**: + +- `DatabaseSourceType` - Corresponding enum value + diff --git a/docs/api-reference/python/aixplain/v1/enums/embedding_model.md b/docs/api-reference/python/aixplain/v1/enums/embedding_model.md new file mode 100644 index 000000000..e9db506bf --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/embedding_model.md @@ -0,0 +1,56 @@ +--- +sidebar_label: embedding_model +title: aixplain.v1.enums.embedding_model +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: February 17th 2025 +Description: + Embedding Model Enum + +### EmbeddingModel Objects + +```python +class EmbeddingModel(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/embedding_model.py#L23) + +Enumeration of available embedding models in the aiXplain system. + +This enum defines the unique identifiers for different embedding models that can +be used to generate vector representations of data. + +**Attributes**: + +- `OPENAI_ADA002` _str_ - OpenAI's Ada-002 text embedding model ID. +- `JINA_CLIP_V2_MULTIMODAL` _str_ - Jina CLIP v2 multimodal embedding model ID. +- `MULTILINGUAL_E5_LARGE` _str_ - Multilingual E5 Large text embedding model ID. +- `BGE_M3` _str_ - BGE-M3 embedding model ID. + +#### \_\_str\_\_ + +```python +def __str__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/embedding_model.py#L41) + +Return the string representation of the embedding model ID. + +**Returns**: + +- `str` - The model ID value as a string. + diff --git a/docs/api-reference/python/aixplain/v1/enums/error_handler.md b/docs/api-reference/python/aixplain/v1/enums/error_handler.md new file mode 100644 index 000000000..5caa986d3 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/error_handler.md @@ -0,0 +1,41 @@ +--- +sidebar_label: error_handler +title: aixplain.v1.enums.error_handler +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: May 26th 2023 +Description: + Error Handler Enum + +### ErrorHandler Objects + +```python +class ErrorHandler(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/error_handler.py#L27) + +Enumeration class defining different error handler strategies. + +**Attributes**: + +- `SKIP` _str_ - skip failed rows. +- `FAIL` _str_ - raise an exception. + diff --git a/docs/api-reference/python/aixplain/v1/enums/evolve_type.md b/docs/api-reference/python/aixplain/v1/enums/evolve_type.md new file mode 100644 index 000000000..ab0049c74 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/evolve_type.md @@ -0,0 +1,26 @@ +--- +sidebar_label: evolve_type +title: aixplain.v1.enums.evolve_type +--- + +### EvolveType Objects + +```python +class EvolveType(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/evolve_type.py#L4) + +Enumeration of evolution types for team agents. + +This enum defines the available evolution strategies that can be applied +to team agents during the evolution process. Each type represents a +different approach to improving agent performance. + +**Attributes**: + +- `TEAM_TUNING` _str_ - Evolution strategy focused on tuning team-level + configurations and interactions between agents. +- `INSTRUCTION_TUNING` _str_ - Evolution strategy focused on refining + individual agent instructions and prompts. + diff --git a/docs/api-reference/python/aixplain/v1/enums/file_type.md b/docs/api-reference/python/aixplain/v1/enums/file_type.md new file mode 100644 index 000000000..e0f178f68 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/file_type.md @@ -0,0 +1,58 @@ +--- +sidebar_label: file_type +title: aixplain.v1.enums.file_type +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: March 20th 2023 +Description: + File Type Enum + +### FileType Objects + +```python +class FileType(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/file_type.py#L27) + +Enumeration of supported file types in the aiXplain system. + +This enum defines the file extensions for various file formats that can be +processed by the system, including document, audio, image, and video formats. + +**Attributes**: + +- `CSV` _str_ - Comma-separated values file (.csv). +- `JSON` _str_ - JSON document file (.json). +- `TXT` _str_ - Plain text file (.txt). +- `XML` _str_ - XML document file (.xml). +- `FLAC` _str_ - Free Lossless Audio Codec file (.flac). +- `MP3` _str_ - MP3 audio file (.mp3). +- `WAV` _str_ - Waveform audio file (.wav). +- `JPEG` _str_ - JPEG image file (.jpeg). +- `PNG` _str_ - Portable Network Graphics file (.png). +- `JPG` _str_ - JPEG image file (.jpg). +- `JSON`0 _str_ - Graphics Interchange Format file (.gif). +- `JSON`1 _str_ - WebP image file (.webp). +- `JSON`2 _str_ - Audio Video Interleave file (.avi). +- `JSON`3 _str_ - MPEG-4 video file (.mp4). +- `JSON`4 _str_ - QuickTime movie file (.mov). +- `JSON`5 _str_ - MPEG-4 video file (.mpeg4). + diff --git a/docs/api-reference/python/aixplain/v1/enums/function.md b/docs/api-reference/python/aixplain/v1/enums/function.md new file mode 100644 index 000000000..ca4f5d340 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/function.md @@ -0,0 +1,5 @@ +--- +sidebar_label: function +title: aixplain.v1.enums.function +--- + diff --git a/docs/api-reference/python/aixplain/v1/enums/function_type.md b/docs/api-reference/python/aixplain/v1/enums/function_type.md new file mode 100644 index 000000000..19739f34a --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/function_type.md @@ -0,0 +1,53 @@ +--- +sidebar_label: function_type +title: aixplain.v1.enums.function_type +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: May 22th 2025 +Description: + Function Type Enum + +### FunctionType Objects + +```python +class FunctionType(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/function_type.py#L27) + +Enumeration of function types in the aiXplain system. + +This enum defines the different types of functions and services available +in the system, including AI models, data processing utilities, and +integration components. + +**Attributes**: + +- `AI` _str_ - Artificial Intelligence function type. +- `SEGMENTOR` _str_ - Data segmentation function type. +- `RECONSTRUCTOR` _str_ - Data reconstruction function type. +- `UTILITY` _str_ - Utility function type. +- `METRIC` _str_ - Metric/evaluation function type. +- `SEARCH` _str_ - Search function type. +- `INTEGRATION` _str_ - Integration connector function type. # i.e. slack +- `CONNECTION` _str_ - Connection function type. # slack - action +- `MCP_CONNECTION` _str_ - MCP connection function type. +- `MCPSERVER` _str_ - MCP server is for on-prem solution. It should be treated like a model. # ONPREM_MCP_MODEL + diff --git a/docs/api-reference/python/aixplain/v1/enums/generated_enums.md b/docs/api-reference/python/aixplain/v1/enums/generated_enums.md new file mode 100644 index 000000000..0cbceb689 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/generated_enums.md @@ -0,0 +1,109 @@ +--- +sidebar_label: generated_enums +title: aixplain.v1.enums.generated_enums +--- + +Auto-generated enum module containing static values from the backend API. + +### Function Objects + +```python +class Function(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/generated_enums.py#L12) + +Enum representing available functions in the aiXplain platform. + +#### get\_input\_output\_params + +```python +def get_input_output_params() -> Tuple[Dict, Dict] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/generated_enums.py#L143) + +Get the input and output parameters for this function. + +**Returns**: + + Tuple[Dict, Dict]: A tuple containing (input_params, output_params). + +#### get\_parameters + +```python +def get_parameters() -> "FunctionParameters" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/generated_enums.py#L156) + +Get a FunctionParameters object for this function. + +**Returns**: + +- `FunctionParameters` - Object containing the function's parameters. + +### FunctionParameters Objects + +```python +class FunctionParameters(BaseParameters) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/generated_enums.py#L4504) + +Class to store and manage function parameters. + +#### \_\_init\_\_ + +```python +def __init__(input_params: Dict) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/generated_enums.py#L4507) + +Initialize FunctionParameters with input parameters. + +**Arguments**: + +- `input_params` _Dict_ - Dictionary of input parameters. + +### Supplier Objects + +```python +class Supplier(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/generated_enums.py#L4522) + +Enum representing available suppliers in the aiXplain platform. + +#### \_\_str\_\_ + +```python +def __str__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/generated_enums.py#L4606) + +Return the supplier name. + +### Language Objects + +```python +class Language(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/generated_enums.py#L4611) + +Enum representing available languages in the aiXplain platform. + +### License Objects + +```python +class License(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/generated_enums.py#L4900) + +Enum representing available licenses in the aiXplain platform. + diff --git a/docs/api-reference/python/aixplain/v1/enums/index_stores.md b/docs/api-reference/python/aixplain/v1/enums/index_stores.md new file mode 100644 index 000000000..857518a24 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/index_stores.md @@ -0,0 +1,53 @@ +--- +sidebar_label: index_stores +title: aixplain.v1.enums.index_stores +--- + +### IndexStores Objects + +```python +class IndexStores(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/index_stores.py#L4) + +Enumeration of available index store providers in the aiXplain system. + +This enum defines the different index store providers that can be used for +storing and retrieving indexed data, along with their identifiers. + +**Attributes**: + +- `AIR` _dict_ - AIR index store configuration with name and ID. +- `VECTARA` _dict_ - Vectara index store configuration with name and ID. +- `GRAPHRAG` _dict_ - GraphRAG index store configuration with name and ID. +- `ZERO_ENTROPY` _dict_ - Zero Entropy index store configuration with name and ID. + +#### \_\_str\_\_ + +```python +def __str__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/index_stores.py#L22) + +Return the name of the index store. + +**Returns**: + +- `str` - The name value from the index store configuration. + +#### get\_model\_id + +```python +def get_model_id() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/index_stores.py#L30) + +Return the model ID of the index store. + +**Returns**: + +- `str` - The ID value from the index store configuration. + diff --git a/docs/api-reference/python/aixplain/v1/enums/init.md b/docs/api-reference/python/aixplain/v1/enums/init.md new file mode 100644 index 000000000..7a0dc4647 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/init.md @@ -0,0 +1,6 @@ +--- +draft: true +sidebar_label: enums +title: aixplain.v1.enums +--- + diff --git a/docs/api-reference/python/aixplain/v1/enums/language.md b/docs/api-reference/python/aixplain/v1/enums/language.md new file mode 100644 index 000000000..07da6a860 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/language.md @@ -0,0 +1,5 @@ +--- +sidebar_label: language +title: aixplain.v1.enums.language +--- + diff --git a/docs/api-reference/python/aixplain/v1/enums/license.md b/docs/api-reference/python/aixplain/v1/enums/license.md new file mode 100644 index 000000000..30693e937 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/license.md @@ -0,0 +1,5 @@ +--- +sidebar_label: license +title: aixplain.v1.enums.license +--- + diff --git a/docs/api-reference/python/aixplain/v1/enums/onboard_status.md b/docs/api-reference/python/aixplain/v1/enums/onboard_status.md new file mode 100644 index 000000000..ead1a9f5f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/onboard_status.md @@ -0,0 +1,46 @@ +--- +sidebar_label: onboard_status +title: aixplain.v1.enums.onboard_status +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: March 22th 2023 +Description: + Onboard Status Enum + +### OnboardStatus Objects + +```python +class OnboardStatus(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/onboard_status.py#L27) + +Enumeration of possible onboarding status values. + +This enum defines all possible states that an onboarding process can be in, +from initial onboarding to completed or failed states. + +**Attributes**: + +- `ONBOARDING` _str_ - Initial onboarding state. +- `ONBOARDED` _str_ - Successful onboarding state. +- `FAILED` _str_ - Failed onboarding state. +- `DELETED` _str_ - Deleted onboarding state. + diff --git a/docs/api-reference/python/aixplain/v1/enums/ownership_type.md b/docs/api-reference/python/aixplain/v1/enums/ownership_type.md new file mode 100644 index 000000000..0fb4c96ec --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/ownership_type.md @@ -0,0 +1,58 @@ +--- +sidebar_label: ownership_type +title: aixplain.v1.enums.ownership_type +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: November 22nd 2023 +Description: + Asset Ownership Type + +### OwnershipType Objects + +```python +class OwnershipType(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/ownership_type.py#L27) + +Enumeration of possible ownership types. + +This enum defines the different types of ownership that can be associated with +an asset or resource, including subscribed and owned ownership. + +**Attributes**: + +- `SUBSCRIBED` _str_ - Subscribed ownership type. +- `OWNED` _str_ - Owned ownership type. + +#### \_\_str\_\_ + +```python +def __str__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/ownership_type.py#L41) + +Return the string representation of the ownership type. + +**Returns**: + +- `str` - The ownership type value as a string. + diff --git a/docs/api-reference/python/aixplain/v1/enums/privacy.md b/docs/api-reference/python/aixplain/v1/enums/privacy.md new file mode 100644 index 000000000..101aa76ab --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/privacy.md @@ -0,0 +1,45 @@ +--- +sidebar_label: privacy +title: aixplain.v1.enums.privacy +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: March 20th 2023 +Description: + Privacy Enum + +### Privacy Objects + +```python +class Privacy(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/privacy.py#L27) + +Enumeration of possible privacy levels. + +This enum defines the different levels of privacy that can be associated with +an asset or resource, including public, private, and restricted privacy levels. + +**Attributes**: + +- `PUBLIC` _str_ - Public privacy level. +- `PRIVATE` _str_ - Private privacy level. +- `RESTRICTED` _str_ - Restricted privacy level. + diff --git a/docs/api-reference/python/aixplain/v1/enums/response_status.md b/docs/api-reference/python/aixplain/v1/enums/response_status.md new file mode 100644 index 000000000..31721ef92 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/response_status.md @@ -0,0 +1,59 @@ +--- +sidebar_label: response_status +title: aixplain.v1.enums.response_status +--- + +#### \_\_author\_\_ + +Copyright 2024 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: February 21st 2024 +Description: + Asset Enum + +### ResponseStatus Objects + +```python +class ResponseStatus(Text, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/response_status.py#L28) + +Enumeration of possible response status values. + +This enum defines the different statuses that a response can be in, including +in progress, success, and failure. + +**Attributes**: + +- `IN_PROGRESS` _str_ - Response is in progress. +- `SUCCESS` _str_ - Response was successful. +- `FAILED` _str_ - Response failed. + +#### \_\_str\_\_ + +```python +def __str__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/response_status.py#L44) + +Return the string representation of the response status. + +**Returns**: + +- `str` - The response status value as a string. + diff --git a/docs/api-reference/python/aixplain/v1/enums/sort_by.md b/docs/api-reference/python/aixplain/v1/enums/sort_by.md new file mode 100644 index 000000000..deaa5a597 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/sort_by.md @@ -0,0 +1,45 @@ +--- +sidebar_label: sort_by +title: aixplain.v1.enums.sort_by +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: March 20th 2023 +Description: + Sort By Enum + +### SortBy Objects + +```python +class SortBy(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/sort_by.py#L27) + +Enumeration of possible sorting criteria. + +This enum defines the different criteria that can be used to sort assets, +including creation date, price, and popularity. + +**Attributes**: + +- `CREATION_DATE` _str_ - Sort by creation date. +- `PRICE` _str_ - Sort by normalized price. +- `POPULARITY` _str_ - Sort by total number of subscriptions. + diff --git a/docs/api-reference/python/aixplain/v1/enums/sort_order.md b/docs/api-reference/python/aixplain/v1/enums/sort_order.md new file mode 100644 index 000000000..032eeec4b --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/sort_order.md @@ -0,0 +1,44 @@ +--- +sidebar_label: sort_order +title: aixplain.v1.enums.sort_order +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: March 20th 2023 +Description: + Sort By Enum + +### SortOrder Objects + +```python +class SortOrder(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/sort_order.py#L27) + +Enumeration of possible sorting orders. + +This enum defines the different directions that can be used to sort assets, +including ascending and descending order. + +**Attributes**: + +- `ASCENDING` _int_ - Sort in ascending order. +- `DESCENDING` _int_ - Sort in descending order. + diff --git a/docs/api-reference/python/aixplain/v1/enums/splitting_options.md b/docs/api-reference/python/aixplain/v1/enums/splitting_options.md new file mode 100644 index 000000000..5d330b3a4 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/splitting_options.md @@ -0,0 +1,61 @@ +--- +sidebar_label: splitting_options +title: aixplain.v1.enums.splitting_options +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: May 30th 2025 +Description: + Splitting Options Enum + +### SplittingOptions Objects + +```python +class SplittingOptions(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/splitting_options.py#L27) + +Enumeration of possible splitting options. + +This enum defines the different ways that text can be split into chunks, +including by word, sentence, passage, page, and line. + +**Attributes**: + +- `WORD` _str_ - Split by word. +- `SENTENCE` _str_ - Split by sentence. +- `PASSAGE` _str_ - Split by passage. +- `PAGE` _str_ - Split by page. +- `LINE` _str_ - Split by line. + +#### \_\_str\_\_ + +```python +def __str__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/splitting_options.py#L47) + +Return the string representation of the splitting option. + +**Returns**: + +- `str` - The splitting option value as a string. + diff --git a/docs/api-reference/python/aixplain/v1/enums/status.md b/docs/api-reference/python/aixplain/v1/enums/status.md new file mode 100644 index 000000000..f5798e02f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/status.md @@ -0,0 +1,24 @@ +--- +sidebar_label: status +title: aixplain.v1.enums.status +--- + +### Status Objects + +```python +class Status(Text, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/status.py#L5) + +Enumeration of possible status values. + +This enum defines the different statuses that a task or operation can be in, +including failed, in progress, and success. + +**Attributes**: + +- `FAILED` _str_ - Task failed. +- `IN_PROGRESS` _str_ - Task is in progress. +- `SUCCESS` _str_ - Task was successful. + diff --git a/docs/api-reference/python/aixplain/v1/enums/storage_type.md b/docs/api-reference/python/aixplain/v1/enums/storage_type.md new file mode 100644 index 000000000..cfaec7117 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/storage_type.md @@ -0,0 +1,59 @@ +--- +sidebar_label: storage_type +title: aixplain.v1.enums.storage_type +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: March 20th 2023 +Description: + Storage Type Enum + +### StorageType Objects + +```python +class StorageType(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/storage_type.py#L27) + +Enumeration of possible storage types. + +This enum defines the different types of storage that can be used to store +assets, including text, URL, and file. + +**Attributes**: + +- `TEXT` _str_ - Text storage type. +- `URL` _str_ - URL storage type. +- `FILE` _str_ - File storage type. + +#### \_\_str\_\_ + +```python +def __str__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/enums/storage_type.py#L43) + +Return the string representation of the storage type. + +**Returns**: + +- `str` - The storage type value as a string. + diff --git a/docs/api-reference/python/aixplain/v1/enums/supplier.md b/docs/api-reference/python/aixplain/v1/enums/supplier.md new file mode 100644 index 000000000..0931d9f5a --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/enums/supplier.md @@ -0,0 +1,5 @@ +--- +sidebar_label: supplier +title: aixplain.v1.enums.supplier +--- + diff --git a/docs/api-reference/python/aixplain/v1/factories/agent_factory/init.md b/docs/api-reference/python/aixplain/v1/factories/agent_factory/init.md new file mode 100644 index 000000000..61586c6ec --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/agent_factory/init.md @@ -0,0 +1,388 @@ +--- +sidebar_label: agent_factory +title: aixplain.v1.factories.agent_factory +--- + +Copyright 2024 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: Thiago Castro Ferreira and Lucas Pavanelli +Date: May 16th 2024 +Description: + Agent Factory Class + +#### to\_literal\_text + +```python +def to_literal_text(x) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L51) + +Convert value to literal text, escaping braces for string formatting. + +**Arguments**: + +- `x` - Value to convert (dict, list, or any other type) + + +**Returns**: + +- `str` - Escaped string representation + +### AgentFactory Objects + +```python +class AgentFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L64) + +Factory class for creating and managing agents in the aiXplain system. + +This class provides class methods for creating various types of agents and tools, +as well as managing existing agents in the platform. + +#### create + +```python +@classmethod +def create(cls, + name: Text, + description: Text, + instructions: Optional[Text] = None, + llm: Optional[Union[LLM, Text]] = None, + tools: Optional[List[Union[Tool, Model]]] = None, + api_key: Text = config.TEAM_API_KEY, + supplier: Union[Dict, Text, Supplier, int] = "aiXplain", + version: Optional[Text] = None, + tasks: List[WorkflowTask] = None, + workflow_tasks: Optional[List[WorkflowTask]] = None, + output_format: Optional[OutputFormat] = None, + expected_output: Optional[Union[BaseModel, Text, dict]] = None, + **kwargs) -> Agent +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L72) + +Create a new agent in the platform. + +**Warnings**: + + The 'instructions' parameter was recently added and serves the same purpose as 'description' did previously: set the role of the agent as a system prompt. + The 'description' parameter is still required and should be used to set a short summary of the agent's purpose. + For the next releases, the 'instructions' parameter will be required. + + +**Arguments**: + +- `name` _Text_ - name of the agent +- `description` _Text_ - description of the agent instructions. +- `instructions` _Text_ - instructions of the agent. +- `llm` _Optional[Union[LLM, Text]], optional_ - LLM instance to use as an object or as an ID. +- `tools` _List[Union[Tool, Model]], optional_ - list of tool for the agent. Defaults to []. +- `api_key` _Text, optional_ - team/user API key. Defaults to config.TEAM_API_KEY. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - owner of the agent. Defaults to "aiXplain". +- `version` _Optional[Text], optional_ - version of the agent. Defaults to None. +- `tasks` _List[WorkflowTask], optional_ - Deprecated. Use workflow_tasks instead. Defaults to None. +- `workflow_tasks` _List[WorkflowTask], optional_ - list of tasks for the agent. Defaults to []. +- `description`0 _OutputFormat, optional_ - default output format for agent responses. Defaults to OutputFormat.TEXT. +- `description`1 _Union[BaseModel, Text, dict], optional_ - expected output. Defaults to None. +- `description`2 - Additional keyword arguments. + + +**Returns**: + +- `description`3 - created Agent + +#### create\_from\_dict + +```python +@classmethod +def create_from_dict(cls, dict: Dict) -> Agent +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L239) + +Create an agent instance from a dictionary representation. + +**Arguments**: + +- `dict` _Dict_ - Dictionary containing agent configuration and properties. + + +**Returns**: + +- `Agent` - Instantiated agent object with properties from the dictionary. + + +**Raises**: + +- `Exception` - If agent validation fails or required properties are missing. + +#### create\_workflow\_task + +```python +@classmethod +def create_workflow_task( + cls, + name: Text, + description: Text, + expected_output: Text, + dependencies: Optional[List[Text]] = None) -> WorkflowTask +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L257) + +Create a new workflow task for an agent. + +**Arguments**: + +- `name` _Text_ - Name of the task +- `description` _Text_ - Description of what the task does +- `expected_output` _Text_ - Expected output format or content +- `dependencies` _Optional[List[Text]], optional_ - List of task names this task depends on. Defaults to None. + + +**Returns**: + +- `WorkflowTask` - Created workflow task object + +#### create\_task + +```python +@classmethod +def create_task(cls, *args, **kwargs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L284) + +Create a workflow task (deprecated - use create_workflow_task instead). + +.. deprecated:: + Use :meth:`create_workflow_task` instead. + +#### create\_model\_tool + +```python +@classmethod +def create_model_tool(cls, + model: Optional[Union[Model, Text]] = None, + function: Optional[Union[Function, Text]] = None, + supplier: Optional[Union[Supplier, Text]] = None, + description: Text = "", + parameters: Optional[Dict] = None, + name: Optional[Text] = None) -> ModelTool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L299) + +Create a new model tool for use with an agent. + +**Arguments**: + +- `model` _Optional[Union[Model, Text]], optional_ - Model instance or ID. Defaults to None. +- `function` _Optional[Union[Function, Text]], optional_ - Function enum or ID. Defaults to None. +- `supplier` _Optional[Union[Supplier, Text]], optional_ - Supplier enum or name. Defaults to None. +- `description` _Text, optional_ - Description of the tool. Defaults to "". +- `parameters` _Optional[Dict], optional_ - Tool parameters. Defaults to None. +- `name` _Optional[Text], optional_ - Name of the tool. Defaults to None. + + +**Returns**: + +- `ModelTool` - Created model tool object. + + +**Raises**: + +- `AssertionError` - If the supplier is not valid. + +#### create\_pipeline\_tool + +```python +@classmethod +def create_pipeline_tool(cls, + description: Text, + pipeline: Union[Pipeline, Text], + name: Optional[Text] = None) -> PipelineTool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L347) + +Create a new pipeline tool for use with an agent. + +**Arguments**: + +- `description` _Text_ - Description of what the pipeline tool does. +- `pipeline` _Union[Pipeline, Text]_ - Pipeline instance or pipeline ID. +- `name` _Optional[Text], optional_ - Name of the tool. Defaults to None. + + +**Returns**: + +- `PipelineTool` - Created pipeline tool object. + +#### create\_python\_interpreter\_tool + +```python +@classmethod +def create_python_interpreter_tool(cls) -> PythonInterpreterTool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L366) + +Create a new Python interpreter tool for use with an agent. + +This tool allows the agent to execute Python code in a controlled environment. + +**Returns**: + +- `PythonInterpreterTool` - Created Python interpreter tool object. + +#### create\_custom\_python\_code\_tool + +```python +@classmethod +def create_custom_python_code_tool(cls, + code: Union[Text, Callable], + name: Text, + description: Text = "", + **kwargs) -> ConnectionTool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L377) + +Create a new custom Python code tool for use with an agent. + +**Arguments**: + +- `code` _Union[Text, Callable]_ - Python code as string or callable function. +- `name` _Text_ - Name of the tool. +- `description` _Text, optional_ - Description of what the tool does. Defaults to "". +- `**kwargs` - Additional keyword arguments passed to the underlying connection tool. + + +**Returns**: + +- `ConnectionTool` - Created connection tool object. + +#### create\_sql\_tool + +```python +@classmethod +def create_sql_tool(cls, + name: Text, + description: Text, + source: str, + source_type: Union[str, DatabaseSourceType], + schema: Optional[Text] = None, + tables: Optional[List[Text]] = None, + enable_commit: bool = False) -> SQLTool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L399) + +Create a new SQL tool. + +**Arguments**: + +- `name` _Text_ - name of the tool +- `description` _Text_ - description of the database tool +- `source` _Union[Text, Dict]_ - database source - can be a connection string or dictionary with connection details +- `source_type` _Union[str, DatabaseSourceType]_ - type of source (postgresql, sqlite, csv) or DatabaseSourceType enum +- `schema` _Optional[Text], optional_ - database schema description +- `tables` _Optional[List[Text]], optional_ - table names to work with (optional) +- `enable_commit` _bool, optional_ - enable to modify the database (optional) + + +**Returns**: + +- `SQLTool` - created SQLTool + + +**Examples**: + + # CSV - Simple + sql_tool = AgentFactory.create_sql_tool( + description="My CSV Tool", + source="/path/to/data.csv", + source_type="csv", + tables=["data"] + ) + + # SQLite - Simple + sql_tool = AgentFactory.create_sql_tool( + description="My SQLite Tool", + source="/path/to/database.sqlite", + source_type="sqlite", + tables=["users", "products"] + ) + +#### list + +```python +@classmethod +def list(cls) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L535) + +List all agents available in the platform. + +**Returns**: + +- `Dict` - Dictionary containing: + - results (List[Agent]): List of available agents. + - page_total (int): Number of agents in current page. + - page_number (int): Current page number. + - total (int): Total number of agents. + + +**Raises**: + +- `Exception` - If there is an error listing the agents. + +#### get + +```python +@classmethod +def get(cls, + agent_id: Optional[Text] = None, + name: Optional[Text] = None, + api_key: Optional[Text] = None) -> Agent +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/__init__.py#L589) + +Retrieve an agent by its ID or name. + +**Arguments**: + +- `agent_id` _Optional[Text], optional_ - ID of the agent to retrieve. +- `name` _Optional[Text], optional_ - Name of the agent to retrieve. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `Agent` - Retrieved agent object. + + +**Raises**: + +- `Exception` - If the agent cannot be retrieved or doesn't exist. +- `ValueError` - If neither agent_id nor name is provided, or if both are provided. + diff --git a/docs/api-reference/python/aixplain/v1/factories/agent_factory/utils.md b/docs/api-reference/python/aixplain/v1/factories/agent_factory/utils.md new file mode 100644 index 000000000..3ec6f3538 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/agent_factory/utils.md @@ -0,0 +1,103 @@ +--- +sidebar_label: utils +title: aixplain.v1.factories.agent_factory.utils +--- + +Utils for building tools and agents. + +#### build\_tool\_payload + +```python +def build_tool_payload(tool: Union[Tool, Model]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/utils.py#L25) + +Build a tool payload from a tool or model object. + +**Arguments**: + +- `tool` _Union[Tool, Model]_ - The tool or model object to build the payload from. + + +**Returns**: + +- `Dict` - The tool payload. + +#### build\_tool + +```python +def build_tool(tool: Dict) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/utils.py#L63) + +Build a tool from a dictionary. + +**Arguments**: + +- `tool` _Dict_ - Tool dictionary. + + +**Returns**: + +- `Tool` - Tool object. + +#### build\_llm + +```python +def build_llm(payload: Dict, api_key: Text = config.TEAM_API_KEY) -> LLM +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/utils.py#L140) + +Build a Large Language Model (LLM) instance from a dictionary configuration. + +This function attempts to create an LLM instance either from a cached LLM object +in the payload or by creating a new instance using the provided configuration. + +**Arguments**: + +- `payload` _Dict_ - Dictionary containing LLM configuration and possibly a cached + LLM object. +- `api_key` _Text, optional_ - API key for authentication. Defaults to config.TEAM_API_KEY. + + +**Returns**: + +- `LLM` - Instantiated LLM object with configured parameters. + +#### build\_agent + +```python +def build_agent(payload: Dict, + tools: List[Tool] = None, + api_key: Text = config.TEAM_API_KEY) -> Agent +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/agent_factory/utils.py#L190) + +Build an agent instance from a dictionary configuration. + +This function creates an agent with its associated tools, LLM, and tasks based +on the provided configuration. + +**Arguments**: + +- `payload` _Dict_ - Dictionary containing agent configuration including tools, + LLM settings, and tasks. +- `tools` _List[Tool], optional_ - List of pre-configured tools to use. If None, + tools will be built from the payload. Defaults to None. +- `api_key` _Text, optional_ - API key for authentication. Defaults to config.TEAM_API_KEY. + + +**Returns**: + +- `Agent` - Instantiated agent object with configured tools, LLM, and tasks. + + +**Raises**: + +- `ValueError` - If a tool type is not supported. +- `AssertionError` - If tool configuration is invalid. + diff --git a/docs/api-reference/python/aixplain/v1/factories/api_key_factory.md b/docs/api-reference/python/aixplain/v1/factories/api_key_factory.md new file mode 100644 index 000000000..49d166942 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/api_key_factory.md @@ -0,0 +1,187 @@ +--- +sidebar_label: api_key_factory +title: aixplain.v1.factories.api_key_factory +--- + +### APIKeyFactory Objects + +```python +class APIKeyFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/api_key_factory.py#L10) + +Factory class for managing API keys in the aiXplain platform. + +This class provides functionality for creating, retrieving, updating, and +monitoring API keys, including their usage limits and budgets. + +**Attributes**: + +- `backend_url` _str_ - Base URL for the aiXplain backend API. + +#### get + +```python +@classmethod +def get(cls, api_key: Text, **kwargs) -> APIKey +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/api_key_factory.py#L23) + +Retrieve an API key by its value. + +This method searches for an API key by matching the first and last 4 +characters of the provided key. + +**Arguments**: + +- `api_key` _Text_ - The API key value to search for. + + +**Returns**: + +- `APIKey` - The matching API key object. + + +**Raises**: + +- `Exception` - If no matching API key is found. + +#### list + +```python +@classmethod +def list(cls, **kwargs) -> List[APIKey] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/api_key_factory.py#L46) + +List all API keys accessible to the current user. + +This method retrieves all API keys that the authenticated user has access to, +using the configured TEAM_API_KEY. + +**Returns**: + +- `List[APIKey]` - List of API key objects. + + +**Raises**: + +- `Exception` - If the API request fails or returns an error, including cases + where authentication fails or the service is unavailable. + +#### create + +```python +@classmethod +def create(cls, name: Text, budget: int, global_limits: Union[Dict, + APIKeyLimits], + asset_limits: List[Union[Dict, APIKeyLimits]], expires_at: datetime, + **kwargs) -> APIKey +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/api_key_factory.py#L89) + +Create a new API key with specified limits and budget. + +This method creates a new API key with configured usage limits, budget, +and expiration date. + +**Arguments**: + +- `name` _Text_ - Name or description for the API key. +- `budget` _int_ - Total budget allocated to this API key. +- `global_limits` _Union[Dict, APIKeyLimits]_ - Global usage limits for the key, + either as a dictionary or APIKeyLimits object. +- `asset_limits` _List[Union[Dict, APIKeyLimits]]_ - List of per-asset usage + limits, each either as a dictionary or APIKeyLimits object. +- `expires_at` _datetime_ - Expiration date and time for the API key. + + +**Returns**: + +- `APIKey` - Created API key object with its access key and configuration. + + +**Raises**: + +- `Exception` - If the API request fails or returns an error, including cases + where validation fails or the service is unavailable. + +#### update + +```python +@classmethod +def update(cls, api_key_obj: APIKey, **kwargs) -> APIKey +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/api_key_factory.py#L151) + +Update an existing API key's configuration. + +This method updates an API key's settings such as limits, budget, and +expiration date. The API key must be validated before update. + +**Arguments**: + +- `api_key` _APIKey_ - API key object with updated configuration. + Must have a valid ID of an existing key. + + +**Returns**: + +- `APIKey` - Updated API key object with new configuration. + + +**Raises**: + +- `Exception` - If: + - API key validation fails + - API key ID is invalid + - Update request fails + - Service is unavailable + +#### get\_usage\_limits + +```python +@classmethod +def get_usage_limits(cls, + api_key: Text = None, + asset_id: Optional[Text] = None, + **kwargs) -> List[APIKeyUsageLimit] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/api_key_factory.py#L203) + +Retrieve current usage limits and counts for an API key. + +This method fetches the current usage statistics and limits for an API key, +optionally filtered by a specific asset. + +**Arguments**: + +- `api_key` _Text, optional_ - API key to check usage for. Defaults to + config.TEAM_API_KEY. +- `asset_id` _Optional[Text], optional_ - Filter usage limits for a specific + asset. Defaults to None, showing all assets. + + +**Returns**: + +- `List[APIKeyUsageLimit]` - List of usage limit objects containing: + - daily_request_count: Current number of requests today + - daily_request_limit: Maximum allowed requests per day + - daily_token_count: Current number of tokens used today + - daily_token_limit: Maximum allowed tokens per day + - model: Asset ID if limit is asset-specific, None if global + + +**Raises**: + +- `Exception` - If: + - API key is invalid + - User is not the key owner + - Service is unavailable + diff --git a/docs/api-reference/python/aixplain/v1/factories/asset_factory.md b/docs/api-reference/python/aixplain/v1/factories/asset_factory.md new file mode 100644 index 000000000..898c8726c --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/asset_factory.md @@ -0,0 +1,64 @@ +--- +sidebar_label: asset_factory +title: aixplain.v1.factories.asset_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: December 27th 2022 +Description: + Asset Factory Class + +### AssetFactory Objects + +```python +class AssetFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/asset_factory.py#L30) + +Base class for asset factories. + +This class provides a common interface for creating and retrieving assets +from the aiXplain platform. Subclasses should implement the abstract methods +to define specific asset types. + +**Attributes**: + +- `backend_url` _str_ - Base URL for the aiXplain backend API. + +#### get + +```python +@abstractmethod +def get(asset_id: Text) -> Asset +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/asset_factory.py#L44) + +Create a 'Asset' object from id + +**Arguments**: + +- `asset_id` _str_ - ID of required asset. + + +**Returns**: + +- `Asset` - Created 'Asset' object + diff --git a/docs/api-reference/python/aixplain/v1/factories/benchmark_factory.md b/docs/api-reference/python/aixplain/v1/factories/benchmark_factory.md new file mode 100644 index 000000000..9d75a5068 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/benchmark_factory.md @@ -0,0 +1,201 @@ +--- +sidebar_label: benchmark_factory +title: aixplain.v1.factories.benchmark_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: December 2nd 2022 +Description: + Benchmark Factory Class + +### BenchmarkFactory Objects + +```python +class BenchmarkFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/benchmark_factory.py#L39) + +Factory class for creating and managing benchmarks in the aiXplain platform. + +This class provides functionality for creating benchmarks, managing benchmark jobs, +retrieving results, and configuring normalization options. Benchmarks can be used +to evaluate and compare multiple models using specified datasets and metrics. + +**Attributes**: + +- `backend_url` _str_ - Base URL for the aiXplain backend API. + +#### get + +```python +@classmethod +def get(cls, benchmark_id: str, api_key: str = None) -> Benchmark +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/benchmark_factory.py#L108) + +Create a 'Benchmark' object from Benchmark id + +**Arguments**: + +- `benchmark_id` _str_ - Unique identifier of the benchmark to retrieve. + + +**Returns**: + +- `Benchmark` - Retrieved benchmark object with all components loaded. + + +**Raises**: + +- `Exception` - If: + - Benchmark ID is invalid + - Authentication fails + - Service is unavailable + +#### get\_job + +```python +@classmethod +def get_job(cls, job_id: Text, api_key: str = None) -> BenchmarkJob +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/benchmark_factory.py#L152) + +Create a 'BenchmarkJob' object from job id + +**Arguments**: + +- `job_id` _Text_ - Unique identifier of the benchmark job to retrieve. + + +**Returns**: + +- `BenchmarkJob` - Retrieved benchmark job object with its current status. + + +**Raises**: + +- `Exception` - If the job ID is invalid or the request fails. + +#### create + +```python +@classmethod +def create(cls, name: str, dataset_list: List[Dataset], + model_list: List[Model], metric_list: List[Metric]) -> Benchmark +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/benchmark_factory.py#L235) + +Create a new benchmark configuration. + +This method creates a new benchmark that can be used to evaluate and compare +multiple models using specified datasets and metrics. Note that this only +creates the benchmark configuration - you need to run it separately using +start_benchmark_job. + +**Arguments**: + +- `name` _str_ - Unique name for the benchmark. +- `dataset_list` _List[Dataset]_ - List of datasets to use for evaluation. + Currently only supports a single dataset. +- `model_list` _List[Model]_ - List of models to evaluate. All models must + either have additional configuration info or none should have it. +- `metric_list` _List[Metric]_ - List of metrics to use for evaluation. + Must provide at least one metric. + + +**Returns**: + +- `Benchmark` - Created benchmark object ready for execution. + + +**Raises**: + +- `Exception` - If: + - No dataset is provided or multiple datasets are provided + - No metrics are provided + - No models are provided + - Model configuration is inconsistent + - Request fails or returns an error + +#### list\_normalization\_options + +```python +@classmethod +def list_normalization_options(cls, metric: Metric, model: Model) -> List[str] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/benchmark_factory.py#L309) + +List supported normalization options for a metric-model pair. + +This method retrieves the list of normalization options that can be used +when evaluating a specific model with a specific metric in a benchmark. + +**Arguments**: + +- `metric` _Metric_ - Metric to get normalization options for. +- `model` _Model_ - Model to check compatibility with. + + +**Returns**: + +- `List[str]` - List of supported normalization option identifiers. + + +**Raises**: + +- `Exception` - If: + - Metric or model is invalid + - Request fails + - Service is unavailable + +#### get\_benchmark\_job\_scores + +```python +@classmethod +def get_benchmark_job_scores(cls, job_id: Text) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/benchmark_factory.py#L353) + +Retrieve and format benchmark job scores. + +This method fetches the scores from a benchmark job and formats them into +a pandas DataFrame, with model names properly formatted to include supplier +and version information. + +**Arguments**: + +- `job_id` _Text_ - Unique identifier of the benchmark job. + + +**Returns**: + +- `pandas.DataFrame` - DataFrame containing benchmark scores with formatted + model names. + + +**Raises**: + +- `Exception` - If the job ID is invalid or the request fails. + diff --git a/docs/api-reference/python/aixplain/v1/factories/cli/model_factory_cli.md b/docs/api-reference/python/aixplain/v1/factories/cli/model_factory_cli.md new file mode 100644 index 000000000..8c19b274a --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/cli/model_factory_cli.md @@ -0,0 +1,317 @@ +--- +sidebar_label: model_factory_cli +title: aixplain.v1.factories.cli.model_factory_cli +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Michael Lam +Date: September 18th 2023 +Description: + Model Factory CLI + +#### list\_host\_machines + +```python +@click.command("hosts") +@click.option("--api-key", + default=None, + help="TEAM_API_KEY if not already set in environment") +def list_host_machines(api_key: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/cli/model_factory_cli.py#L32) + +List available host machines for model deployment. + +This CLI command wraps the ModelFactory.list_host_machines function and outputs +the results in YAML format. + +**Arguments**: + +- `api_key` _Text, optional_ - Team API key for authentication. Defaults to None, + using the configured environment variable. + + +**Returns**: + +- `None` - Prints the host machines list in YAML format to stdout. + +#### list\_functions + +```python +@click.command("functions") +@click.option("--verbose", + is_flag=True, + help="List all function details, False by default.") +@click.option("--api-key", + default=None, + help="TEAM_API_KEY if not already set in environment.") +def list_functions(verbose: bool, api_key: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/cli/model_factory_cli.py#L53) + +List available functions for model deployment. + +This CLI command wraps the ModelFactory.list_functions function and outputs +the results in YAML format. Functions represent the different types of +operations that models can perform. + +**Arguments**: + +- `verbose` _bool_ - If True, includes detailed information about each function. + If False, provides a simplified list. +- `api_key` _Text, optional_ - Team API key for authentication. Defaults to None, + using the configured environment variable. + + +**Returns**: + +- `None` - Prints the functions list in YAML format to stdout. + +#### list\_gpus + +```python +@click.command("gpus") +@click.option("--api-key", + default=None, + help="TEAM_API_KEY if not already set in environment.") +def list_gpus(api_key: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/cli/model_factory_cli.py#L76) + +List available GPUs for model deployment. + +This CLI command wraps the ModelFactory.list_gpus function and outputs +the results in YAML format. Shows available GPU resources that can be +used for model hosting. + +**Arguments**: + +- `api_key` _Text, optional_ - Team API key for authentication. Defaults to None, + using the configured environment variable. + + +**Returns**: + +- `None` - Prints the GPU list in YAML format to stdout. + +#### create\_asset\_repo + +```python +@click.command("image-repo") +@click.option("--name", help="Model name.") +@click.option("--description", help="Description of model.") +@click.option("--function", help="Function name obtained from LIST_FUNCTIONS.") +@click.option( + "--source-language", + default="en", + help= + "Model source language in 2-character 639-1 code or 3-character 639-3 code." +) +@click.option("--input-modality", help="Input type (text, video, image, etc.)") +@click.option("--output-modality", + help="Output type (text, video, image, etc.)") +@click.option("--documentation-url", + default="", + help="Link to model documentation.") +@click.option("--api-key", + default=None, + help="TEAM_API_KEY if not already set in environment.") +def create_asset_repo(name: Text, + description: Text, + function: Text, + source_language: Text, + input_modality: Text, + output_modality: Text, + documentation_url: Optional[Text] = "", + api_key: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/cli/model_factory_cli.py#L106) + +Create a new asset repository for a model. + +This CLI command wraps the ModelFactory.create_asset_repo function and outputs +the results in YAML format. Creates a new repository for storing model assets +and configurations. + +**Arguments**: + +- `name` _Text_ - Name of the model. +- `description` _Text_ - Description of the model's purpose and functionality. +- `function` _Text_ - Model function name obtained via list_functions. +- `source_language` _Text_ - Language code in ISO 639-1 (2-char) or 639-3 (3-char) format. +- `input_modality` _Text_ - Type of input the model accepts (e.g., text, video, image). +- `output_modality` _Text_ - Type of output the model produces (e.g., text, video, image). +- `documentation_url` _Text, optional_ - URL to model documentation. Defaults to "". +- `api_key` _Text, optional_ - Team API key for authentication. Defaults to None, + using the configured environment variable. + + +**Returns**: + +- `None` - Prints the created repository details in YAML format to stdout. + +#### asset\_repo\_login + +```python +@click.command("image-repo-login") +@click.option("--api-key", + default=None, + help="TEAM_API_KEY if not already set in environment.") +def asset_repo_login(api_key: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/cli/model_factory_cli.py#L145) + +Get login credentials for the asset repository. + +This CLI command wraps the ModelFactory.asset_repo_login function and outputs +the results in YAML format. Provides authentication details needed to access +the model asset repository. + +**Arguments**: + +- `api_key` _Text, optional_ - Team API key for authentication. Defaults to None, + using the configured environment variable. + + +**Returns**: + +- `None` - Prints the login credentials in YAML format to stdout. + +#### onboard\_model + +```python +@click.command("model") +@click.option("--model-id", help="Model ID from CREATE_IMAGE_REPO.") +@click.option("--image-tag", + help="The tag of the image that you would like hosted.") +@click.option("--image-hash", + help="The hash of the image you would like onboarded.") +@click.option("--host-machine", + default="", + help="The machine on which to host the model.") +@click.option("--api-key", + default=None, + help="TEAM_API_KEY if not already set in environment.") +def onboard_model(model_id: Text, + image_tag: Text, + image_hash: Text, + host_machine: Optional[Text] = "", + api_key: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/cli/model_factory_cli.py#L170) + +Onboard a model image for deployment. + +This CLI command wraps the ModelFactory.onboard_model function and outputs +the results in YAML format. Prepares a model image for deployment by registering +it with the platform. + +**Arguments**: + +- `model_id` _Text_ - Model ID obtained from create_asset_repo. +- `image_tag` _Text_ - Tag of the Docker image to be onboarded. +- `image_hash` _Text_ - Hash of the Docker image for verification. +- `host_machine` _Text, optional_ - ID of the machine to host the model. Defaults to "". +- `api_key` _Text, optional_ - Team API key for authentication. Defaults to None, + using the configured environment variable. + + +**Returns**: + +- `None` - Prints the onboarding results in YAML format to stdout. + +#### deploy\_huggingface\_model + +```python +@click.command("hf-model") +@click.option("--name", help="User-defined name for Hugging Face model.") +@click.option( + "--hf-repo-id", + help="Repository ID from Hugging Face in {supplier}/{model name} form.") +@click.option("--revision", default="", help="Commit hash of repository.") +@click.option("--hf-token", + default=None, + help="Hugging Face token used to authenticate to this model.") +@click.option("--api-key", + default=None, + help="TEAM_API_KEY if not already set in environment.") +def deploy_huggingface_model(name: Text, + hf_repo_id: Text, + hf_token: Optional[Text] = None, + revision: Optional[Text] = None, + api_key: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/cli/model_factory_cli.py#L201) + +Deploy a model from Hugging Face Hub. + +This CLI command wraps the ModelFactory.deploy_huggingface_model function and outputs +the results in YAML format. Deploys a model directly from Hugging Face's model hub. + +**Arguments**: + +- `name` _Text_ - User-defined name for the Hugging Face model. +- `hf_repo_id` _Text_ - Repository ID from Hugging Face in 'org/model-name' format. +- `hf_token` _Text, optional_ - Hugging Face token for private models. Defaults to None. +- `revision` _Text, optional_ - Specific model revision/commit hash. Defaults to None. +- `api_key` _Text, optional_ - Team API key for authentication. Defaults to None, + using the configured environment variable. + + +**Returns**: + +- `None` - Prints the deployment results in YAML format to stdout. + +#### get\_huggingface\_model\_status + +```python +@click.command("hf-model-status") +@click.option("--model-id", help="Model ID from DEPLOY_HUGGINGFACE_MODEL.") +@click.option("--api-key", + default=None, + help="TEAM_API_KEY if not already set in environment.") +def get_huggingface_model_status(model_id: Text, + api_key: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/cli/model_factory_cli.py#L232) + +Check the deployment status of a Hugging Face model. + +This CLI command wraps the ModelFactory.get_huggingface_model_status function and +outputs the results in YAML format. Retrieves the current status of a Hugging Face +model deployment. + +**Arguments**: + +- `model_id` _Text_ - Model ID obtained from deploy_huggingface_model. +- `api_key` _Text, optional_ - Team API key for authentication. Defaults to None, + using the configured environment variable. + + +**Returns**: + +- `None` - Prints the model status in YAML format to stdout. + diff --git a/docs/api-reference/python/aixplain/v1/factories/corpus_factory.md b/docs/api-reference/python/aixplain/v1/factories/corpus_factory.md new file mode 100644 index 000000000..f818b64a6 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/corpus_factory.md @@ -0,0 +1,229 @@ +--- +sidebar_label: corpus_factory +title: aixplain.v1.factories.corpus_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: March 27th 2023 +Description: + Corpus Factory Class + +### CorpusFactory Objects + +```python +class CorpusFactory(AssetFactory) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/corpus_factory.py#L50) + +Factory class for creating and managing corpora in the aiXplain platform. + +This class provides functionality for creating, retrieving, and managing +corpora, which are collections of data assets used for training and +evaluating AI models. + +**Attributes**: + +- `backend_url` _str_ - Base URL for the aiXplain backend API. + +#### get + +```python +@classmethod +def get(cls, corpus_id: Text, api_key: str = None) -> Corpus +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/corpus_factory.py#L129) + +Create a 'Corpus' object from corpus id + +**Arguments**: + +- `corpus_id` _Text_ - Corpus ID of required corpus. +- `api_key` _str, optional_ - Team API key. Defaults to None. + + +**Returns**: + +- `Corpus` - Retrieved corpus object with all data assets loaded. + + +**Raises**: + +- `Exception` - If: + - Corpus ID is invalid + - Authentication fails + - Service is unavailable + +#### list + +```python +@classmethod +def list(cls, + query: Optional[Text] = None, + function: Optional[Function] = None, + language: Optional[Union[Language, List[Language]]] = None, + data_type: Optional[DataType] = None, + license: Optional[License] = None, + page_number: int = 0, + page_size: int = 20) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/corpus_factory.py#L174) + +List and filter corpora with pagination support. + +This method provides comprehensive filtering and pagination capabilities +for retrieving corpora from the aiXplain platform. + +**Arguments**: + +- `query` _Optional[Text], optional_ - Search query to filter corpora by name + or description. Defaults to None. +- `function` _Optional[Function], optional_ - Filter by AI function type. + Defaults to None. +- `language` _Optional[Union[Language, List[Language]]], optional_ - Filter by + language(s). Can be single language or list. Defaults to None. +- `data_type` _Optional[DataType], optional_ - Filter by data type. + Defaults to None. +- `license` _Optional[License], optional_ - Filter by license type. + Defaults to None. +- `page_number` _int, optional_ - Zero-based page number. Defaults to 0. +- `page_size` _int, optional_ - Number of items per page (1-100). + Defaults to 20. + + +**Returns**: + +- `Dict` - Response containing: + - results (List[Corpus]): List of corpus objects + - page_total (int): Total items in current page + - page_number (int): Current page number + - total (int): Total number of items across all pages + + +**Raises**: + +- `Exception` - If: + - page_size is not between 1 and 100 + - Request fails + - Service is unavailable +- `AssertionError` - If page_size is invalid. + +#### get\_assets\_from\_page + +```python +@classmethod +def get_assets_from_page(cls, + page_number: int = 1, + task: Optional[Function] = None, + language: Optional[Text] = None) -> List[Corpus] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/corpus_factory.py#L276) + +Retrieve a paginated list of corpora with optional filters. + +**Notes**: + + This method is deprecated. Use list() instead. + + +**Arguments**: + +- `page_number` _int, optional_ - One-based page number. Defaults to 1. +- `task` _Optional[Function], optional_ - Filter by AI task/function. + Defaults to None. +- `language` _Optional[Text], optional_ - Filter by language code. + Defaults to None. + + +**Returns**: + +- `List[Corpus]` - List of corpus objects matching the filters. + + Deprecated: + Use list() method instead for more comprehensive filtering and + pagination capabilities. + +#### create + +```python +@classmethod +def create(cls, + name: Text, + description: Text, + license: License, + content_path: Union[Union[Text, Path], List[Union[Text, Path]]], + schema: List[Union[Dict, MetaData]], + ref_data: List[Any] = [], + tags: List[Text] = [], + functions: List[Function] = [], + privacy: Privacy = Privacy.PRIVATE, + error_handler: ErrorHandler = ErrorHandler.SKIP, + api_key: Optional[Text] = None) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/corpus_factory.py#L308) + +Create a new corpus from data files. + +This method asynchronously uploads and processes data files to create a new +corpus in the user's dashboard. The data files are processed according to +the provided schema and combined with any referenced existing data. + +**Arguments**: + +- `name` _Text_ - Name for the new corpus. +- `description` _Text_ - Description of the corpus's contents and purpose. +- `license` _License_ - License type for the corpus. +- `content_path` _Union[Union[Text, Path], List[Union[Text, Path]]]_ - Path(s) + to CSV files containing the data. Can be single path or list. +- `schema` _List[Union[Dict, MetaData]]_ - Metadata configurations defining + how to process the data files. +- `ref_data` _List[Any], optional_ - References to existing data assets to + include in the corpus. Can be Data objects or IDs. Defaults to []. +- `tags` _List[Text], optional_ - Tags describing the corpus content. + Defaults to []. +- `functions` _List[Function], optional_ - AI functions this corpus is + suitable for. Defaults to []. +- `privacy` _Privacy, optional_ - Visibility setting for the corpus. + Defaults to Privacy.PRIVATE. +- `error_handler` _ErrorHandler, optional_ - Strategy for handling data + processing errors. Defaults to ErrorHandler.SKIP. +- `description`0 _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `description`1 - Response containing: + - status: Current processing status + - asset_id: ID of the created corpus + + +**Raises**: + +- `description`2 - If: + - No schema or reference data provided + - Referenced data asset doesn't exist + - Reserved column names are used + - Data rows are misaligned + - Processing or upload fails + diff --git a/docs/api-reference/python/aixplain/v1/factories/data_factory.md b/docs/api-reference/python/aixplain/v1/factories/data_factory.md new file mode 100644 index 000000000..8d9ad4772 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/data_factory.md @@ -0,0 +1,77 @@ +--- +sidebar_label: data_factory +title: aixplain.v1.factories.data_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: May 15th 2023 +Description: + Data Factory Class + +### DataFactory Objects + +```python +class DataFactory(AssetFactory) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/data_factory.py#L38) + +Factory class for creating and managing data assets. + +This class provides functionality for creating, retrieving, and managing +data assets in the aiXplain platform. Data assets represent individual +pieces of data (e.g., text, audio) that can be used in corpora or +directly with models. + +**Attributes**: + +- `backend_url` _str_ - Base URL for the aiXplain backend API. + +#### get + +```python +@classmethod +def get(cls, data_id: Text, api_key: str = None) -> Data +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/data_factory.py#L95) + +Retrieve a data asset by its ID. + +This method fetches a data asset from the platform using its unique +identifier. + +**Arguments**: + +- `data_id` _Text_ - Unique identifier of the data asset to retrieve. +- `api_key` _str_ - Optional API key for authentication. + + +**Returns**: + +- `Data` - Retrieved data asset object with its configuration. + + +**Raises**: + +- `Exception` - If: + - Data asset ID is invalid or not found + - Authentication fails + - Service is unavailable + diff --git a/docs/api-reference/python/aixplain/v1/factories/dataset_factory.md b/docs/api-reference/python/aixplain/v1/factories/dataset_factory.md new file mode 100644 index 000000000..66e7d3c65 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/dataset_factory.md @@ -0,0 +1,240 @@ +--- +sidebar_label: dataset_factory +title: aixplain.v1.factories.dataset_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: December 1st 2022 +Description: + Dataset Factory Class + +### DatasetFactory Objects + +```python +class DatasetFactory(AssetFactory) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/dataset_factory.py#L54) + +Factory class for creating and managing datasets in the aiXplain platform. + +This class provides functionality for creating, retrieving, and managing +datasets, which are structured collections of data assets used for training, +evaluating, and benchmarking AI models. Datasets can include input data, +target data, hypotheses, and metadata. + +**Attributes**: + +- `backend_url` _str_ - Base URL for the aiXplain backend API. + +#### get + +```python +@classmethod +def get(cls, dataset_id: Text, api_key: str = None) -> Dataset +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/dataset_factory.py#L177) + +Retrieve a dataset by its ID. + +This method fetches a dataset and all its associated data assets from +the platform. + +**Arguments**: + +- `dataset_id` _Text_ - Unique identifier of the dataset to retrieve. +- `api_key` _str, optional_ - Team API key. Defaults to None. + + +**Returns**: + +- `Dataset` - Retrieved dataset object with all components loaded. + + +**Raises**: + +- `Exception` - If: + - Dataset ID is invalid + - Authentication fails + - Service is unavailable + +#### list + +```python +@classmethod +def list(cls, + query: Optional[Text] = None, + function: Optional[Function] = None, + source_languages: Optional[Union[Language, List[Language]]] = None, + target_languages: Optional[Union[Language, List[Language]]] = None, + data_type: Optional[DataType] = None, + license: Optional[License] = None, + is_referenceless: Optional[bool] = None, + page_number: int = 0, + page_size: int = 20) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/dataset_factory.py#L216) + +List and filter datasets with pagination support. + +This method provides comprehensive filtering and pagination capabilities +for retrieving datasets from the aiXplain platform. + +**Arguments**: + +- `query` _Optional[Text], optional_ - Search query to filter datasets by name + or description. Defaults to None. +- `function` _Optional[Function], optional_ - Filter by AI function type. + Defaults to None. + source_languages (Optional[Union[Language, List[Language]]], optional): + Filter by input data language(s). Can be single language or list. + Defaults to None. + target_languages (Optional[Union[Language, List[Language]]], optional): + Filter by output data language(s). Can be single language or list. + Defaults to None. +- `data_type` _Optional[DataType], optional_ - Filter by data type. + Defaults to None. +- `license` _Optional[License], optional_ - Filter by license type. + Defaults to None. +- `is_referenceless` _Optional[bool], optional_ - Filter by whether dataset + has references. Defaults to None. +- `page_number` _int, optional_ - Zero-based page number. Defaults to 0. +- `page_size` _int, optional_ - Number of items per page (1-100). + Defaults to 20. + + +**Returns**: + +- `Dict` - Response containing: + - results (List[Dataset]): List of dataset objects + - page_total (int): Total items in current page + - page_number (int): Current page number + - total (int): Total number of items across all pages + + +**Raises**: + +- `Exception` - If: + - page_size is not between 1 and 100 + - Request fails + - Service is unavailable +- `AssertionError` - If page_size is invalid. + +#### create + +```python +@classmethod +def create(cls, + name: Text, + description: Text, + license: License, + function: Function, + input_schema: List[Union[Dict, MetaData]], + output_schema: List[Union[Dict, MetaData]] = [], + hypotheses_schema: List[Union[Dict, MetaData]] = [], + metadata_schema: List[Union[Dict, MetaData]] = [], + content_path: Union[Union[Text, Path], List[Union[Text, + Path]]] = [], + input_ref_data: Dict[Text, Any] = {}, + output_ref_data: Dict[Text, List[Any]] = {}, + hypotheses_ref_data: Dict[Text, Any] = {}, + meta_ref_data: Dict[Text, Any] = {}, + tags: List[Text] = [], + privacy: Privacy = Privacy.PRIVATE, + split_labels: Optional[List[Text]] = None, + split_rate: Optional[List[float]] = None, + error_handler: ErrorHandler = ErrorHandler.SKIP, + s3_link: Optional[Text] = None, + aws_credentials: Optional[Dict[Text, Text]] = { + "AWS_ACCESS_KEY_ID": None, + "AWS_SECRET_ACCESS_KEY": None + }, + api_key: Optional[Text] = None) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/dataset_factory.py#L331) + +Create a new dataset from data files and references. + +This method processes data files and existing data assets to create a new +dataset in the platform. It supports various data types, multiple input and +output configurations, and optional data splitting. + +**Arguments**: + +- `name` _Text_ - Name for the new dataset. +- `description` _Text_ - Description of the dataset's contents and purpose. +- `license` _License_ - License type for the dataset. +- `function` _Function_ - AI function this dataset is suitable for. +- `input_schema` _List[Union[Dict, MetaData]]_ - Metadata configurations for + input data processing. +- `output_schema` _List[Union[Dict, MetaData]], optional_ - Metadata configs + for output/target data. Defaults to []. +- `hypotheses_schema` _List[Union[Dict, MetaData]], optional_ - Metadata + configs for hypothesis data. Defaults to []. +- `metadata_schema` _List[Union[Dict, MetaData]], optional_ - Additional + metadata configurations. Defaults to []. + content_path (Union[Union[Text, Path], List[Union[Text, Path]]], optional): + Path(s) to data files. Can be single path or list. Defaults to []. +- `input_ref_data` _Dict[Text, Any], optional_ - References to existing + input data assets. Defaults to \{}. +- `output_ref_data` _Dict[Text, List[Any]], optional_ - References to + existing output data assets. Defaults to \{}. +- `description`0 _Dict[Text, Any], optional_ - References to + existing hypothesis data. Defaults to \{}. +- `description`1 _Dict[Text, Any], optional_ - References to existing + metadata assets. Defaults to \{}. +- `description`2 _List[Text], optional_ - Tags describing the dataset. + Defaults to []. +- `description`3 _Privacy, optional_ - Visibility setting. + Defaults to Privacy.PRIVATE. +- `description`4 _Optional[List[Text]], optional_ - Labels for dataset + splits (e.g., ["train", "test"]). Defaults to None. +- `description`5 _Optional[List[float]], optional_ - Ratios for dataset + splits (must sum to 1). Defaults to None. +- `description`6 _ErrorHandler, optional_ - Strategy for handling data + processing errors. Defaults to ErrorHandler.SKIP. +- `description`7 _Optional[Text], optional_ - S3 URL for data files. + Defaults to None. +- `description`8 _Optional[Dict[Text, Text]], optional_ - AWS credentials + with access_key_id and secret_access_key. Defaults to None values. +- `description`9 _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `license`0 - Response containing: + - status: Current processing status + - asset_id: ID of the created dataset + + +**Raises**: + +- `license`1 - If: + - No input data is provided + - Referenced data asset doesn't exist + - Reserved column names are used + - Data rows are misaligned + - Split configuration is invalid + - Processing or upload fails +- `license`2 - If split configuration is invalid. + diff --git a/docs/api-reference/python/aixplain/v1/factories/file_factory.md b/docs/api-reference/python/aixplain/v1/factories/file_factory.md new file mode 100644 index 000000000..932c47dc6 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/file_factory.md @@ -0,0 +1,191 @@ +--- +sidebar_label: file_factory +title: aixplain.v1.factories.file_factory +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: March 20th 2023 +Description: + File Factory Class + +### FileFactory Objects + +```python +class FileFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/file_factory.py#L39) + +Factory class for managing file uploads and storage in the aiXplain platform. + +This class provides functionality for uploading files to S3 storage, +checking storage types, and managing file links. It supports various file +types with different size limits and handles both temporary and permanent +storage. + +#### upload + +```python +@classmethod +def upload(cls, + local_path: Text, + tags: Optional[List[Text]] = None, + license: Optional[License] = None, + is_temp: bool = True, + return_download_link: bool = False, + api_key: Optional[Text] = None) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/file_factory.py#L49) + +Upload a file to the aiXplain S3 storage. + +This method uploads a file to S3 storage with size limits based on file type: +- Audio: 50MB +- Application: 25MB +- Video: 300MB +- Image: 25MB +- Database: 300MB +- Other: 50MB + +**Arguments**: + +- `local_path` _Text_ - Path to the file to upload. +- `tags` _Optional[List[Text]], optional_ - Tags to associate with the file. + Defaults to None. +- `license` _Optional[License], optional_ - License type for the file. + Required for non-temporary files. Defaults to None. +- `is_temp` _bool, optional_ - Whether this is a temporary upload. + Defaults to True. +- `return_download_link` _bool, optional_ - Whether to return a download + link instead of S3 path. Only valid for temporary files. + Defaults to False. + + +**Returns**: + +- `Text` - Either: + - S3 path where the file was uploaded (if return_download_link=False) + - Download URL for the file (if return_download_link=True) + + +**Raises**: + +- `FileNotFoundError` - If the local file doesn't exist. +- `Exception` - If: + - File size exceeds the type-specific limit + - Requesting download link for non-temporary file +- `AssertionError` - If requesting download link for non-temporary file. + +#### check\_storage\_type + +```python +@classmethod +def check_storage_type(cls, input_link: Any) -> StorageType +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/file_factory.py#L138) + +Determine the storage type of a given input. + +This method checks whether the input is a local file path, a URL +(including S3 and HTTP/HTTPS links), or raw text content. + +**Arguments**: + +- `input_link` _Any_ - Input to check. Can be a file path, URL, or text. + + +**Returns**: + +- `StorageType` - Storage type enum value: + - StorageType.FILE: Local file path + - StorageType.URL: S3 or HTTP/HTTPS URL + - StorageType.TEXT: Raw text content + +#### to\_link + +```python +@classmethod +def to_link(cls, data: Union[Text, Dict], **kwargs) -> Union[Text, Dict] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/file_factory.py#L166) + +Convert local file paths to aiXplain platform links. + +This method checks if the input contains local file paths and uploads +them to the platform, replacing the paths with the resulting URLs. +Other types of input (URLs, text) are left unchanged. + +**Arguments**: + +- `data` _Union[Text, Dict]_ - Input data to process. Can be: + - Text: Single file path, URL, or text content + - Dict: Dictionary with string values that may be file paths +- `**kwargs` - Additional arguments passed to upload() method. + + +**Returns**: + + Union[Text, Dict]: Processed input where any local file paths have + been replaced with platform URLs. Structure matches input type. + +#### create + +```python +@classmethod +def create(cls, + local_path: Text, + tags: Optional[List[Text]] = None, + license: Optional[License] = None, + is_temp: bool = False) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/file_factory.py#L194) + +Create a permanent or temporary file asset in the platform. + +This method is similar to upload() but with a focus on creating file +assets. For permanent assets (is_temp=False), a license is required. + +**Arguments**: + +- `local_path` _Text_ - Path to the file to upload. +- `tags` _Optional[List[Text]], optional_ - Tags to associate with the file. + Defaults to None. +- `license` _Optional[License], optional_ - License type for the file. + Required for non-temporary files. Defaults to None. +- `is_temp` _bool, optional_ - Whether this is a temporary upload. + Defaults to False. + + +**Returns**: + +- `Text` - Either: + - S3 path for permanent files (is_temp=False) + - Download URL for temporary files (is_temp=True) + + +**Raises**: + +- `FileNotFoundError` - If the local file doesn't exist. +- `Exception` - If file size exceeds the type-specific limit. +- `AssertionError` - If license is not provided for non-temporary files. + diff --git a/docs/api-reference/python/aixplain/v1/factories/finetune_factory/init.md b/docs/api-reference/python/aixplain/v1/factories/finetune_factory/init.md new file mode 100644 index 000000000..f7e2f05d6 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/finetune_factory/init.md @@ -0,0 +1,91 @@ +--- +sidebar_label: finetune_factory +title: aixplain.v1.factories.finetune_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: June 14th 2023 +Description: + Finetune Factory Class + +### FinetuneFactory Objects + +```python +class FinetuneFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/finetune_factory/__init__.py#L40) + +Factory class for creating and managing model fine-tuning operations. + +This class provides static methods to create and manage fine-tuning jobs +for machine learning models. It handles cost estimation, dataset preparation, +and fine-tuning configuration. + +**Attributes**: + +- `backend_url` _str_ - Base URL for the aiXplain backend API. + +#### create + +```python +@classmethod +def create(cls, + name: Text, + dataset_list: List[Union[Dataset, Text]], + model: Union[Model, Text], + prompt_template: Optional[Text] = None, + hyperparameters: Optional[Hyperparameters] = None, + train_percentage: Optional[float] = 100, + dev_percentage: Optional[float] = 0) -> Finetune +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/finetune_factory/__init__.py#L68) + +Create a new fine-tuning job with the specified configuration. + +This method sets up a fine-tuning job by validating the configuration, +estimating costs, and preparing the datasets and model. It supports both +direct Dataset/Model objects and their IDs as inputs. + +**Arguments**: + +- `name` _Text_ - Name for the fine-tuning job. +- `dataset_list` _List[Union[Dataset, Text]]_ - List of Dataset objects or dataset IDs + to use for fine-tuning. +- `model` _Union[Model, Text]_ - Model object or model ID to be fine-tuned. +- `prompt_template` _Text, optional_ - Template for formatting training examples. + Use <<COLUMN_NAME>> to reference dataset columns. Defaults to None. +- `hyperparameters` _Hyperparameters, optional_ - Fine-tuning hyperparameters + configuration. Defaults to None. +- `train_percentage` _float, optional_ - Percentage of data to use for training. + Must be > 0. Defaults to 100. +- `dev_percentage` _float, optional_ - Percentage of data to use for validation. + train_percentage + dev_percentage must be <= 100. Defaults to 0. + + +**Returns**: + +- `Finetune` - Configured fine-tuning job object, or None if creation failed. + + +**Raises**: + +- `AssertionError` - If train_percentage <= 0 or train_percentage + dev_percentage > 100. + diff --git a/docs/api-reference/python/aixplain/v1/factories/finetune_factory/prompt_validator.md b/docs/api-reference/python/aixplain/v1/factories/finetune_factory/prompt_validator.md new file mode 100644 index 000000000..5d26645a5 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/finetune_factory/prompt_validator.md @@ -0,0 +1,40 @@ +--- +sidebar_label: prompt_validator +title: aixplain.v1.factories.finetune_factory.prompt_validator +--- + +#### validate\_prompt + +```python +def validate_prompt(prompt: Text, dataset_list: List[Dataset]) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/finetune_factory/prompt_validator.py#L23) + +Validate and normalize a prompt template against a list of datasets. + +This function processes a prompt template that contains references to dataset +columns in the format <<COLUMN_NAME>> or <<COLUMN_ID>>. It validates that all +referenced columns exist in the provided datasets and normalizes column IDs +to their corresponding names. + +**Arguments**: + +- `prompt` _Text_ - Prompt template containing column references in + <<COLUMN_NAME>> or <<COLUMN_ID>> format. +- `dataset_list` _List[Dataset]_ - List of datasets to validate the + prompt template against. + + +**Returns**: + +- `Text` - Normalized prompt template with column references converted + to \{COLUMN_NAME} format. + + +**Raises**: + +- `AssertionError` - If any of these conditions are met: + - Multiple datasets have the same referenced column name + - Referenced columns are not found in any dataset + diff --git a/docs/api-reference/python/aixplain/v1/factories/index_factory/init.md b/docs/api-reference/python/aixplain/v1/factories/index_factory/init.md new file mode 100644 index 000000000..1efdea8df --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/index_factory/init.md @@ -0,0 +1,149 @@ +--- +sidebar_label: index_factory +title: aixplain.v1.factories.index_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Abdul Basit Anees, Thiago Castro Ferreira, Zaina Abushaban +Date: December 26th 2024 +Description: + Index Factory Class + +#### validate\_embedding\_model + +```python +def validate_embedding_model(model_id: Union[EmbeddingModel, str]) -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/__init__.py#L42) + +Validate that a model is a text embedding model. + +**Arguments**: + +- `model_id` _Union[EmbeddingModel, str]_ - The model ID or EmbeddingModel enum + value to validate. + + +**Returns**: + +- `bool` - True if the model is a text embedding model, False otherwise. + +### IndexFactory Objects + +```python +class IndexFactory(ModelFactory, Generic[T]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/__init__.py#L56) + +Factory class for creating and managing index collections. + +This class extends ModelFactory to provide specialized functionality for +managing index collections, which are used for efficient data retrieval +and searching. It supports various index types through the generic +parameter T. + +**Attributes**: + +- `T` _TypeVar_ - Type variable bound to BaseIndexParams, representing + the specific index parameters type. + +#### create + +```python +@classmethod +def create(cls, + name: Optional[Text] = None, + description: Optional[Text] = None, + embedding_model: Union[EmbeddingModel, + str] = EmbeddingModel.OPENAI_ADA002, + params: Optional[T] = None, + **kwargs) -> IndexModel +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/__init__.py#L70) + +Create a new index collection for efficient data retrieval. + +This method supports two ways of creating an index: +1. Using individual parameters (name, description, embedding_model) - Deprecated +2. Using a params object of type T (recommended) + +**Arguments**: + +- `name` _Optional[Text], optional_ - Name of the index collection. + Deprecated, use params instead. Defaults to None. +- `description` _Optional[Text], optional_ - Description of the index collection. + Deprecated, use params instead. Defaults to None. +- `embedding_model` _Union[EmbeddingModel, str], optional_ - Model to use for text embeddings. + Deprecated, use params instead. Defaults to EmbeddingModel.OPENAI_ADA002. +- `params` _Optional[T], optional_ - Index parameters object. This is the + recommended way to create an index. Defaults to None. +- `**kwargs` - Additional keyword arguments. + + +**Returns**: + +- `IndexModel` - Created index collection model. + + +**Raises**: + +- `AssertionError` - If neither params nor all legacy parameters are provided, + or if both params and legacy parameters are provided. +- `Exception` - If index creation fails. + +#### list + +```python +@classmethod +def list(cls, + query: Optional[Text] = "", + suppliers: Optional[Union[Supplier, List[Supplier]]] = None, + ownership: Optional[Tuple[OwnershipType, List[OwnershipType]]] = None, + sort_by: Optional[SortBy] = None, + sort_order: SortOrder = SortOrder.ASCENDING, + page_number: int = 0, + page_size: int = 20) -> List[IndexModel] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/__init__.py#L142) + +List available index collections with optional filtering and sorting. + +**Arguments**: + +- `query` _Optional[Text], optional_ - Search query to filter indexes. + Defaults to "". +- `suppliers` _Optional[Union[Supplier, List[Supplier]]], optional_ - Filter by + supplier(s). Defaults to None. + ownership (Optional[Tuple[OwnershipType, List[OwnershipType]]], optional): + Filter by ownership type. Defaults to None. +- `sort_by` _Optional[SortBy], optional_ - Field to sort results by. + Defaults to None. +- `sort_order` _SortOrder, optional_ - Sort direction (ascending/descending). + Defaults to SortOrder.ASCENDING. +- `page_number` _int, optional_ - Page number for pagination. Defaults to 0. +- `page_size` _int, optional_ - Number of results per page. Defaults to 20. + + +**Returns**: + +- `List[IndexModel]` - List of index models matching the specified criteria. + diff --git a/docs/api-reference/python/aixplain/v1/factories/index_factory/utils.md b/docs/api-reference/python/aixplain/v1/factories/index_factory/utils.md new file mode 100644 index 000000000..4aff4d82d --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/index_factory/utils.md @@ -0,0 +1,243 @@ +--- +sidebar_label: utils +title: aixplain.v1.factories.index_factory.utils +--- + +### BaseIndexParams Objects + +```python +class BaseIndexParams(BaseModel, ABC) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L9) + +Abstract base class for index parameters. + +This class defines the common parameters and functionality for all index types. +It uses Pydantic for data validation and serialization. + +**Attributes**: + +- `model_config` _ConfigDict_ - Pydantic configuration using enum values. +- `name` _Text_ - Name of the index. +- `description` _Optional[Text]_ - Description of the index. Defaults to "". + +#### to\_dict + +```python +def to_dict() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L25) + +Convert the parameters to a dictionary format. + +Converts the parameters to a dictionary suitable for API requests, +renaming 'name' to 'data' in the process. + +**Returns**: + +- `Dict` - Dictionary representation of the parameters. + +#### id + +```python +@property +@abstractmethod +def id() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L40) + +Abstract property that must be implemented in subclasses. + +### BaseIndexParamsWithEmbeddingModel Objects + +```python +class BaseIndexParamsWithEmbeddingModel(BaseIndexParams, ABC) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L45) + +Abstract base class for index parameters that require an embedding model. + +This class extends BaseIndexParams to add support for embedding model configuration, +including model selection and embedding size settings. + +**Attributes**: + +- `embedding_model` _Optional[Union[EmbeddingModel, str]]_ - Model to use for text + embeddings. Defaults to EmbeddingModel.OPENAI_ADA002. +- `embedding_size` _Optional[int]_ - Size of the embeddings to generate. + Defaults to None. + +#### validate\_embedding\_model + +```python +@field_validator("embedding_model") +def validate_embedding_model(cls, model_id) -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L62) + +Validate that the provided model is a text embedding model. + +**Arguments**: + +- `model_id` _Union[EmbeddingModel, str]_ - Model ID or enum value to validate. + + +**Returns**: + +- `str` - The validated model ID. + + +**Raises**: + +- `ValueError` - If the model is not a text embedding model. + +#### to\_dict + +```python +def to_dict() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L80) + +Convert the parameters to a dictionary format. + +Extends the base to_dict method to handle embedding-specific parameters, +renaming fields and restructuring as needed for the API. + +**Returns**: + +- `Dict` - Dictionary representation of the parameters with embedding + configuration properly formatted. + +### VectaraParams Objects + +```python +class VectaraParams(BaseIndexParams) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L98) + +Parameters for creating a Vectara index. + +This class defines the configuration for Vectara's vector search index. + +**Attributes**: + +- `_id` _ClassVar[str]_ - Static model ID for Vectara index type. + +#### id + +```python +@property +def id() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L110) + +Get the model ID for Vectara index type. + +**Returns**: + +- `str` - The Vectara model ID. + +### ZeroEntropyParams Objects + +```python +class ZeroEntropyParams(BaseIndexParams) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L119) + +Parameters for creating a Zero Entropy index. + +This class defines the configuration for Zero Entropy's vector search index. + +**Attributes**: + +- `_id` _ClassVar[str]_ - Static model ID for Zero Entropy index type. + +#### id + +```python +@property +def id() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L131) + +Get the model ID for Zero Entropy index type. + +**Returns**: + +- `str` - The Zero Entropy model ID. + +### AirParams Objects + +```python +class AirParams(BaseIndexParamsWithEmbeddingModel) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L140) + +Parameters for creating an AIR (aiXplain Index and Retrieval) index. + +This class defines the configuration for AIR's vector search index, +including embedding model settings. + +**Attributes**: + +- `_id` _ClassVar[str]_ - Static model ID for AIR index type. + +#### id + +```python +@property +def id() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L153) + +Get the model ID for AIR index type. + +**Returns**: + +- `str` - The AIR model ID. + +### GraphRAGParams Objects + +```python +class GraphRAGParams(BaseIndexParamsWithEmbeddingModel) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L162) + +Parameters for creating a GraphRAG (Graph-based Retrieval-Augmented Generation) index. + +This class defines the configuration for GraphRAG's vector search index, +including embedding model and LLM settings. + +**Attributes**: + +- `_id` _ClassVar[str]_ - Static model ID for GraphRAG index type. +- `llm` _Optional[Text]_ - ID of the LLM to use for generation. Defaults to None. + +#### id + +```python +@property +def id() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/index_factory/utils.py#L177) + +Get the model ID for GraphRAG index type. + +**Returns**: + +- `str` - The GraphRAG model ID. + diff --git a/docs/api-reference/python/aixplain/v1/factories/init.md b/docs/api-reference/python/aixplain/v1/factories/init.md new file mode 100644 index 000000000..cdd0dae79 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/init.md @@ -0,0 +1,25 @@ +--- +sidebar_label: factories +title: aixplain.v1.factories +--- + +aiXplain SDK Library. +--- + +aiXplain SDK enables python programmers to add AI functions +to their software. + +Copyright 2022 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. + diff --git a/docs/api-reference/python/aixplain/v1/factories/integration_factory.md b/docs/api-reference/python/aixplain/v1/factories/integration_factory.md new file mode 100644 index 000000000..776c48120 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/integration_factory.md @@ -0,0 +1,96 @@ +--- +sidebar_label: integration_factory +title: aixplain.v1.factories.integration_factory +--- + +Integration factory for creating and managing Integration models. + +This module provides the IntegrationFactory class which handles the creation, +retrieval, and management of Integration models in the aiXplain platform. + +### IntegrationFactory Objects + +```python +class IntegrationFactory(ModelGetterMixin, ModelListMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/integration_factory.py#L17) + +Factory class for creating and managing Integration models. + +This class provides functionality to get and list Integration models using the backend API. +It inherits from ModelGetterMixin and ModelListMixin to provide model retrieval and listing capabilities. + +**Attributes**: + +- `backend_url` - The URL of the backend API endpoint. + +#### get + +```python +@classmethod +def get(cls, + model_id: Optional[Text] = None, + name: Optional[Text] = None, + api_key: Optional[Text] = None, + use_cache: bool = False) -> Integration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/integration_factory.py#L30) + +Retrieves a specific Integration model by its ID or name. + +**Arguments**: + +- `model_id` _Optional[Text], optional_ - The unique identifier of the Integration model. +- `name` _Optional[Text], optional_ - The name of the Integration model. +- `api_key` _Optional[Text], optional_ - API key for authentication. Defaults to None. +- `use_cache` _bool, optional_ - Whether to use cached data. Defaults to False. + + +**Returns**: + +- `Integration` - The retrieved Integration model. + + +**Raises**: + +- `AssertionError` - If the provided ID/name does not correspond to an Integration model. +- `ValueError` - If neither model_id nor name is provided, or if both are provided. +- `Exception` - If the integration with the given name is not found. + +#### list + +```python +@classmethod +def list(cls, + query: Optional[Text] = "", + suppliers: Optional[Union[Supplier, List[Supplier]]] = None, + ownership: Optional[Tuple[OwnershipType, List[OwnershipType]]] = None, + sort_by: Optional[SortBy] = None, + sort_order: SortOrder = SortOrder.ASCENDING, + page_number: int = 0, + page_size: int = 20, + api_key: Optional[Text] = None) -> List[Integration] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/integration_factory.py#L77) + +Lists Integration models based on the provided filters and pagination parameters. + +**Arguments**: + +- `query` _Optional[Text], optional_ - Search query string. Defaults to "". +- `suppliers` _Optional[Union[Supplier, List[Supplier]]], optional_ - Filter by supplier(s). Defaults to None. +- `ownership` _Optional[Tuple[OwnershipType, List[OwnershipType]]], optional_ - Filter by ownership type. Defaults to None. +- `sort_by` _Optional[SortBy], optional_ - Field to sort results by. Defaults to None. +- `sort_order` _SortOrder, optional_ - Sort order (ascending/descending). Defaults to SortOrder.ASCENDING. +- `page_number` _int, optional_ - Page number for pagination. Defaults to 0. +- `page_size` _int, optional_ - Number of items per page. Defaults to 20. +- `api_key` _Optional[Text], optional_ - API key for authentication. Defaults to None. + + +**Returns**: + +- `List[Integration]` - A list of Integration models matching the specified criteria. + diff --git a/docs/api-reference/python/aixplain/v1/factories/metric_factory.md b/docs/api-reference/python/aixplain/v1/factories/metric_factory.md new file mode 100644 index 000000000..527f8426a --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/metric_factory.md @@ -0,0 +1,110 @@ +--- +sidebar_label: metric_factory +title: aixplain.v1.factories.metric_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: December 1st 2022 +Description: + Metric Factory Class + +### MetricFactory Objects + +```python +class MetricFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/metric_factory.py#L33) + +A static factory class for creating and managing Metric objects. + +This class provides functionality to create, retrieve, and list Metric objects +through the backend API. It includes methods for fetching individual metrics +by ID and listing metrics with various filtering options. + +**Attributes**: + +- `backend_url` _str_ - The URL endpoint for the backend API. + +#### get + +```python +@classmethod +def get(cls, metric_id: Text, api_key: str = None) -> Metric +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/metric_factory.py#L67) + +Create a Metric object from a metric ID. + +**Arguments**: + +- `metric_id` _Text_ - The unique identifier of the metric to retrieve. +- `api_key` _str, optional_ - API key for authentication. Defaults to None. + + +**Returns**: + +- `Metric` - The retrieved Metric object. + + +**Raises**: + +- `Exception` - If the metric creation fails, with status code and error message. + +#### list + +```python +@classmethod +def list(cls, + model_id: Text = None, + is_source_required: Optional[bool] = None, + is_reference_required: Optional[bool] = None, + page_number: int = 0, + page_size: int = 20, + api_key: str = None) -> List[Metric] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/metric_factory.py#L101) + +Get a list of supported metrics based on the given filters. + +**Arguments**: + +- `model_id` _Text, optional_ - ID of model for which metric is to be used. Defaults to None. +- `is_source_required` _bool, optional_ - Should the metric use source. Defaults to None. +- `is_reference_required` _bool, optional_ - Should the metric use reference. Defaults to None. +- `page_number` _int, optional_ - page number. Defaults to 0. +- `page_size` _int, optional_ - page size. Defaults to 20. +- `api_key` _str, optional_ - API key for authentication. Defaults to None. + + +**Returns**: + +- `Dict` - A dictionary containing: + - results (List[Metric]): List of filtered metrics + - page_total (int): Number of items in the current page + - page_number (int): Current page number + - total (int): Total number of items matching the filters + + +**Raises**: + +- `Exception` - If there is an error retrieving the metrics list. + diff --git a/docs/api-reference/python/aixplain/v1/factories/model_factory/init.md b/docs/api-reference/python/aixplain/v1/factories/model_factory/init.md new file mode 100644 index 000000000..ea531231f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/model_factory/init.md @@ -0,0 +1,373 @@ +--- +sidebar_label: model_factory +title: aixplain.v1.factories.model_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: September 1st 2022 +Description: + Model Factory Class + +### ModelFactory Objects + +```python +class ModelFactory(ModelGetterMixin, ModelListMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L39) + +Factory class for creating, managing, and exploring models. + +This class provides functionality for creating various types of models, +managing model repositories, and interacting with the aiXplain platform's +model-related features. + +**Attributes**: + +- `backend_url` _str_ - Base URL for the aiXplain backend API. + +#### PYTHON\_SANDBOX\_ID + +Python sandbox integration ID + +#### create\_utility\_model + +```python +@classmethod +def create_utility_model(cls, + name: Optional[Text] = None, + code: Union[Text, Callable] = None, + inputs: List[UtilityModelInput] = [], + description: Optional[Text] = None, + output_examples: Text = "", + api_key: Optional[Text] = None, + **kwargs) -> UtilityModel +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L54) + +Create a new utility model for custom functionality. + +.. deprecated:: +This method is deprecated. Please use :meth:`create_script_connection_tool` instead. + +This method creates a utility model that can execute custom code or functions +with specified inputs and outputs. + +**Arguments**: + +- `name` _Optional[Text]_ - Name of the utility model. +- `code` _Union[Text, Callable]_ - Python code as string or callable function + implementing the model's functionality. +- `inputs` _List[UtilityModelInput], optional_ - List of input specifications. + Defaults to empty list. +- `description` _Optional[Text], optional_ - Description of what the model does. + Defaults to None. +- `output_examples` _Text, optional_ - Examples of expected outputs. + Defaults to empty string. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `UtilityModel` - Created and registered utility model instance. + + +**Raises**: + +- `Exception` - If model creation fails or validation fails. + +#### create\_script\_connection\_tool + +```python +@classmethod +def create_script_connection_tool(cls, + name: Optional[Text] = None, + code: Union[Text, Callable] = None, + description: Optional[Text] = None, + api_key: Optional[Text] = None, + **kwargs) -> ConnectionTool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L131) + +Create a new script connection tool for custom functionality. + +This method creates a connection tool that can execute custom code or functions +with specified inputs and outputs. It uses the Python sandbox integration +via ToolFactory.create as the underlying implementation. + +**Arguments**: + +- `name` _Optional[Text]_ - Name of the connection tool. +- `code` _Union[Text, Callable]_ - Python code as string or callable function + implementing the connection tool's functionality. +- `description` _Optional[Text], optional_ - Description of what the connection tool does. + Defaults to None. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `ConnectionTool` - Created and registered connection tool instance. + + +**Raises**: + +- `Exception` - If model creation fails or validation fails. + +#### list\_host\_machines + +```python +@classmethod +def list_host_machines(cls, + api_key: Optional[Text] = None, + **kwargs) -> List[Dict] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L209) + +Lists available hosting machines for model. + +**Arguments**: + +- `api_key` _Text, optional_ - Team API key. Defaults to None. + + +**Returns**: + +- `List[Dict]` - List of dictionaries containing information about + each hosting machine. + +#### list\_gpus + +```python +@classmethod +def list_gpus(cls, + api_key: Optional[Text] = None, + **kwargs) -> List[List[Text]] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L230) + +List GPU names on which you can host your language model. + +**Arguments**: + +- `api_key` _Text, optional_ - Team API key. Defaults to None. + + +**Returns**: + +- `List[List[Text]]` - List of all available GPUs and their prices. + +#### list\_functions + +```python +@classmethod +def list_functions(cls, + verbose: Optional[bool] = False, + api_key: Optional[Text] = None, + **kwargs) -> List[Dict] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L250) + +Lists supported model functions on platform. + +**Arguments**: + +- `verbose` _Boolean, optional_ - Set to True if a detailed response + is desired; is otherwise False by default. +- `api_key` _Text, optional_ - Team API key. Defaults to None. + + +**Returns**: + +- `List[Dict]` - List of dictionaries containing information about + each supported function. + +#### create\_asset\_repo + +```python +@classmethod +def create_asset_repo(cls, + name: Text, + description: Text, + function: Text, + source_language: Text, + input_modality: Text, + output_modality: Text, + documentation_url: Optional[Text] = "", + api_key: Optional[Text] = None, + **kwargs) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L283) + +Create a new model repository in the platform. + +This method creates and registers a new model repository, setting up the +necessary infrastructure for model deployment. + +**Arguments**: + +- `name` _Text_ - Name of the model. +- `description` _Text_ - Description of the model's functionality. +- `function` _Text_ - Function name from list_functions() defining model's task. +- `source_language` _Text_ - Language code in ISO 639-1 (2-char) or 639-3 (3-char) format. +- `input_modality` _Text_ - Type of input the model accepts (e.g., text, audio). +- `output_modality` _Text_ - Type of output the model produces (e.g., text, audio). +- `documentation_url` _Optional[Text], optional_ - URL to model documentation. + Defaults to empty string. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `Dict` - Repository creation response containing model ID and other details. + + +**Raises**: + +- `Exception` - If function name is invalid. +- `description`0 - If response status code is not 201. + +#### asset\_repo\_login + +```python +@classmethod +def asset_repo_login(cls, api_key: Optional[Text] = None, **kwargs) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L353) + +Return login credentials for the image repository that corresponds with +the given API_KEY. + +**Arguments**: + +- `api_key` _Text, optional_ - Team API key. Defaults to None. + + +**Returns**: + +- `Dict` - Backend response + +#### onboard\_model + +```python +@classmethod +def onboard_model(cls, + model_id: Text, + image_tag: Text, + image_hash: Text, + host_machine: Optional[Text] = "", + api_key: Optional[Text] = None, + **kwargs) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L375) + +Onboard a model after its image has been pushed to ECR. + +**Arguments**: + +- `model_id` _Text_ - Model ID obtained from CREATE_ASSET_REPO. +- `image_tag` _Text_ - Image tag to be onboarded. +- `image_hash` _Text_ - Image digest. +- `host_machine` _Text, optional_ - Machine on which to host model. +- `api_key` _Text, optional_ - Team API key. Defaults to None. + + +**Returns**: + +- `Dict` - Backend response + +#### deploy\_huggingface\_model + +```python +@classmethod +def deploy_huggingface_model(cls, + name: Text, + hf_repo_id: Text, + revision: Optional[Text] = "", + hf_token: Optional[Text] = "", + api_key: Optional[Text] = None, + **kwargs) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L411) + +Deploy a model from Hugging Face Hub to the aiXplain platform. + +This method handles the deployment of a Hugging Face model, including +authentication and configuration setup. + +**Arguments**: + +- `name` _Text_ - Display name for the deployed model. +- `hf_repo_id` _Text_ - Hugging Face repository ID in 'author/model-name' format. +- `revision` _Optional[Text], optional_ - Specific model revision/commit hash. + Defaults to empty string (latest version). +- `hf_token` _Optional[Text], optional_ - Hugging Face access token for private models. + Defaults to empty string. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `Dict` - Deployment response containing model ID and status information. + +#### get\_huggingface\_model\_status + +```python +@classmethod +def get_huggingface_model_status(cls, + model_id: Text, + api_key: Optional[Text] = None, + **kwargs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/__init__.py#L468) + +Check the deployment status of a Hugging Face model. + +This method retrieves the current status and details of a deployed +Hugging Face model. + +**Arguments**: + +- `model_id` _Text_ - Model ID returned by deploy_huggingface_model. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `Dict` - Status response containing: + - status: Current deployment status + - name: Model name + - id: Model ID + - pricing: Pricing information + diff --git a/docs/api-reference/python/aixplain/v1/factories/model_factory/mixins/init.md b/docs/api-reference/python/aixplain/v1/factories/model_factory/mixins/init.md new file mode 100644 index 000000000..b200b98a7 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/model_factory/mixins/init.md @@ -0,0 +1,6 @@ +--- +draft: true +sidebar_label: mixins +title: aixplain.v1.factories.model_factory.mixins +--- + diff --git a/docs/api-reference/python/aixplain/v1/factories/model_factory/mixins/model_getter.md b/docs/api-reference/python/aixplain/v1/factories/model_factory/mixins/model_getter.md new file mode 100644 index 000000000..63b923b29 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/model_factory/mixins/model_getter.md @@ -0,0 +1,61 @@ +--- +sidebar_label: model_getter +title: aixplain.v1.factories.model_factory.mixins.model_getter +--- + +Model getter mixin providing model retrieval functionality. + +This module contains the ModelGetterMixin class which provides methods for retrieving +model instances from the backend by ID or name, with support for caching. + +### ModelGetterMixin Objects + +```python +class ModelGetterMixin() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/mixins/model_getter.py#L18) + +Mixin class providing model retrieval functionality. + +This mixin provides methods for retrieving model instances from the backend, +with support for caching to improve performance. + +#### get + +```python +@classmethod +def get(cls, + model_id: Optional[Text] = None, + name: Optional[Text] = None, + api_key: Optional[Text] = None, + use_cache: bool = False) -> Model +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/mixins/model_getter.py#L26) + +Retrieve a model instance by its ID or name. + +This method attempts to retrieve a model from the cache if enabled, +falling back to fetching from the backend if necessary. + +**Arguments**: + +- `model_id` _Optional[Text], optional_ - ID of the model to retrieve. +- `name` _Optional[Text], optional_ - Name of the model to retrieve. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. +- `use_cache` _bool, optional_ - Whether to attempt retrieving from cache. + Defaults to False. + + +**Returns**: + +- `Model` - Retrieved model instance. + + +**Raises**: + +- `Exception` - If the model cannot be retrieved or doesn't exist. +- `ValueError` - If neither model_id nor name is provided, or if both are provided. + diff --git a/docs/api-reference/python/aixplain/v1/factories/model_factory/mixins/model_list.md b/docs/api-reference/python/aixplain/v1/factories/model_factory/mixins/model_list.md new file mode 100644 index 000000000..efdd30221 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/model_factory/mixins/model_list.md @@ -0,0 +1,90 @@ +--- +sidebar_label: model_list +title: aixplain.v1.factories.model_factory.mixins.model_list +--- + +### ModelListMixin Objects + +```python +class ModelListMixin() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/mixins/model_list.py#L7) + +Mixin class providing model listing functionality. + +This mixin provides methods for retrieving lists of models with various +filtering and sorting options. + +#### list + +```python +@classmethod +def list(cls, + query: Optional[Text] = "", + function: Optional[Function] = None, + suppliers: Optional[Union[Supplier, List[Supplier]]] = None, + source_languages: Optional[Union[Language, List[Language]]] = None, + target_languages: Optional[Union[Language, List[Language]]] = None, + is_finetunable: Optional[bool] = None, + ownership: Optional[Tuple[OwnershipType, List[OwnershipType]]] = None, + sort_by: Optional[SortBy] = None, + sort_order: SortOrder = SortOrder.ASCENDING, + page_number: int = 0, + page_size: int = 20, + model_ids: Optional[List[Text]] = None, + api_key: Optional[Text] = None, + **kwargs) -> List[Model] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/mixins/model_list.py#L15) + +List and filter available models with pagination support. + +This method provides comprehensive filtering capabilities for retrieving +models. It supports two modes: +1. Filtering by model IDs (exclusive of other filters) +2. Filtering by various criteria (function, language, etc.) + +**Arguments**: + +- `query` _Optional[Text], optional_ - Search query to filter models. + Defaults to "". +- `function` _Optional[Function], optional_ - Filter by model function/task. + Defaults to None. +- `suppliers` _Optional[Union[Supplier, List[Supplier]]], optional_ - Filter by + supplier(s). Defaults to None. + source_languages (Optional[Union[Language, List[Language]]], optional): + Filter by input language(s). Defaults to None. + target_languages (Optional[Union[Language, List[Language]]], optional): + Filter by output language(s). Defaults to None. +- `is_finetunable` _Optional[bool], optional_ - Filter by fine-tuning capability. + Defaults to None. + ownership (Optional[Tuple[OwnershipType, List[OwnershipType]]], optional): + Filter by ownership type (e.g., SUBSCRIBED, OWNER). Defaults to None. +- `sort_by` _Optional[SortBy], optional_ - Attribute to sort results by. + Defaults to None. +- `sort_order` _SortOrder, optional_ - Sort direction (ascending/descending). + Defaults to SortOrder.ASCENDING. +- `page_number` _int, optional_ - Page number for pagination. Defaults to 0. +- `page_size` _int, optional_ - Number of results per page. Defaults to 20. +- `model_ids` _Optional[List[Text]], optional_ - List of specific model IDs to retrieve. + If provided, other filters are ignored. Defaults to None. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `function`0 - Dictionary containing: + - results (List[Model]): List of models matching the criteria + - page_total (int): Number of models in current page + - page_number (int): Current page number + - total (int): Total number of models matching the criteria + + +**Raises**: + +- `function`1 - If model_ids is provided with other filters, or if + page_size is less than the number of requested model_ids. + diff --git a/docs/api-reference/python/aixplain/v1/factories/model_factory/utils.md b/docs/api-reference/python/aixplain/v1/factories/model_factory/utils.md new file mode 100644 index 000000000..8c2c0259e --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/model_factory/utils.md @@ -0,0 +1,135 @@ +--- +sidebar_label: utils +title: aixplain.v1.factories.model_factory.utils +--- + +#### create\_model\_from\_response + +```python +def create_model_from_response(response: Dict) -> Model +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/utils.py#L30) + +Convert API response JSON into appropriate Model object. + +This function creates the correct type of Model object (Model, LLM, IndexModel, +Integration, ConnectionTool, MCPConnection, or UtilityModel) based on the +function type and parameters in the response. + +**Arguments**: + +- `response` _Dict_ - API response containing model information including: + - id: Model identifier + - name: Model name + - function: Function type information + - params: Model parameters + - api_key: Optional API key + - attributes: Optional model attributes + - code: Optional model code + - version: Optional version information + + +**Returns**: + +- `Model` - Instantiated model object of the appropriate subclass based on + the function type. + + +**Raises**: + +- `Exception` - If required code is not found for UtilityModel. + +#### get\_assets\_from\_page + +```python +def get_assets_from_page(query, + page_number: int, + page_size: int, + function: Function, + suppliers: Union[Supplier, List[Supplier]], + source_languages: Union[Language, List[Language]], + target_languages: Union[Language, List[Language]], + is_finetunable: bool = None, + ownership: Optional[Tuple[ + OwnershipType, List[OwnershipType]]] = None, + sort_by: Optional[SortBy] = None, + sort_order: SortOrder = SortOrder.ASCENDING, + api_key: Optional[str] = None) -> List[Model] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/utils.py#L161) + +Retrieve a paginated list of models with specified filters. + +This function fetches a page of models from the aiXplain platform, applying +various filters such as function type, suppliers, languages, and ownership. + +**Arguments**: + +- `query` - Search query string to filter models. +- `page_number` _int_ - Page number to retrieve (0-based). +- `page_size` _int_ - Number of models per page. +- `function` _Function_ - Function type to filter models by. +- `suppliers` _Union[Supplier, List[Supplier]]_ - Single supplier or list of + suppliers to filter models by. +- `source_languages` _Union[Language, List[Language]]_ - Source language(s) + supported by the models. +- `target_languages` _Union[Language, List[Language]]_ - Target language(s) + for translation models. +- `is_finetunable` _bool, optional_ - Filter for fine-tunable models. + Defaults to None. + ownership (Optional[Tuple[OwnershipType, List[OwnershipType]]], optional): + Filter by model ownership type. Defaults to None. +- `sort_by` _Optional[SortBy], optional_ - Field to sort results by. + Defaults to None. +- `sort_order` _SortOrder, optional_ - Sort direction (ascending/descending). + Defaults to SortOrder.ASCENDING. +- `page_number`0 _Optional[str], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + + Tuple[List[Model], int]: A tuple containing: + - List of Model objects matching the filters + - Total number of models matching the filters + + +**Raises**: + +- `page_number`1 - If the API request fails or returns an error. + +#### get\_model\_from\_ids + +```python +def get_model_from_ids(model_ids: List[str], + api_key: Optional[str] = None) -> List[Model] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/model_factory/utils.py#L274) + +Retrieve multiple models by their IDs. + +This function fetches multiple models from the aiXplain platform in a single +request using their unique identifiers. + +**Arguments**: + +- `model_ids` _List[str]_ - List of model IDs to retrieve. +- `api_key` _Optional[str], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `List[Model]` - List of Model objects corresponding to the provided IDs. + Each model will be instantiated as the appropriate subclass based + on its function type. + + +**Raises**: + +- `Exception` - If the API request fails or returns an error, including + cases where models are not found or access is denied. + diff --git a/docs/api-reference/python/aixplain/v1/factories/pipeline_factory/init.md b/docs/api-reference/python/aixplain/v1/factories/pipeline_factory/init.md new file mode 100644 index 000000000..6c8618d83 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/pipeline_factory/init.md @@ -0,0 +1,261 @@ +--- +sidebar_label: pipeline_factory +title: aixplain.v1.factories.pipeline_factory +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: September 1st 2022 +Description: + Pipeline Factory Class + +### PipelineFactory Objects + +```python +class PipelineFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/pipeline_factory/__init__.py#L39) + +Factory class for creating, managing, and exploring pipeline objects. + +This class provides functionality for creating new pipelines, retrieving existing +pipelines, and managing pipeline configurations in the aiXplain platform. + +**Attributes**: + +- `backend_url` _str_ - Base URL for the aiXplain backend API. + +#### get + +```python +@classmethod +def get(cls, pipeline_id: Text, api_key: Optional[Text] = None) -> Pipeline +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/pipeline_factory/__init__.py#L52) + +Retrieve a pipeline by its ID. + +This method fetches an existing pipeline from the aiXplain platform using +its unique identifier. + +**Arguments**: + +- `pipeline_id` _Text_ - Unique identifier of the pipeline to retrieve. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `Pipeline` - Retrieved pipeline object with its configuration and architecture. + + +**Raises**: + +- `Exception` - If the pipeline cannot be retrieved, including cases where: + - Pipeline ID is invalid + - Network error occurs + - Authentication fails + +#### get\_assets\_from\_page + +```python +@classmethod +def get_assets_from_page(cls, page_number: int) -> List[Pipeline] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/pipeline_factory/__init__.py#L123) + +Retrieve a paginated list of pipelines. + +This method fetches a page of pipelines from the aiXplain platform. +Each page contains up to 10 pipelines. + +**Arguments**: + +- `page_number` _int_ - Zero-based page number to retrieve. + + +**Returns**: + +- `List[Pipeline]` - List of pipeline objects on the specified page. + Returns an empty list if an error occurs or no pipelines are found. + + +**Notes**: + + This method is primarily used internally by get_first_k_assets. + For more control over pipeline listing, use the list method instead. + +#### get\_first\_k\_assets + +```python +@classmethod +def get_first_k_assets(cls, k: int) -> List[Pipeline] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/pipeline_factory/__init__.py#L159) + +Retrieve the first K pipelines from the platform. + +This method fetches up to K pipelines by making multiple paginated requests +as needed (10 pipelines per page). + +**Arguments**: + +- `k` _int_ - Number of pipelines to retrieve. Must be positive. + + +**Returns**: + +- `List[Pipeline]` - List of up to K pipeline objects. + Returns an empty list if an error occurs. + + +**Notes**: + + For more control over pipeline listing, use the list method instead. + This method is maintained for backwards compatibility. + +#### list + +```python +@classmethod +def list(cls, + query: Optional[Text] = None, + functions: Optional[Union[Function, List[Function]]] = None, + suppliers: Optional[Union[Supplier, List[Supplier]]] = None, + models: Optional[Union[Model, List[Model]]] = None, + input_data_types: Optional[Union[DataType, List[DataType]]] = None, + output_data_types: Optional[Union[DataType, List[DataType]]] = None, + page_number: int = 0, + page_size: int = 20, + drafts_only: bool = False, + api_key: Optional[Text] = None) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/pipeline_factory/__init__.py#L188) + +List and filter pipelines with pagination support. + +This method provides comprehensive filtering and pagination capabilities +for retrieving pipelines from the aiXplain platform. + +**Arguments**: + +- `query` _Optional[Text], optional_ - Search query to filter pipelines by name + or description. Defaults to None. +- `functions` _Optional[Union[Function, List[Function]]], optional_ - Filter by + function type(s). Defaults to None. +- `suppliers` _Optional[Union[Supplier, List[Supplier]]], optional_ - Filter by + supplier(s). Defaults to None. +- `models` _Optional[Union[Model, List[Model]]], optional_ - Filter by specific + model(s) used in pipelines. Defaults to None. + input_data_types (Optional[Union[DataType, List[DataType]]], optional): + Filter by input data type(s). Defaults to None. + output_data_types (Optional[Union[DataType, List[DataType]]], optional): + Filter by output data type(s). Defaults to None. +- `page_number` _int, optional_ - Zero-based page number. Defaults to 0. +- `page_size` _int, optional_ - Number of items per page (1-100). + Defaults to 20. +- `drafts_only` _bool, optional_ - If True, only return draft pipelines. + Defaults to False. + + +**Returns**: + +- `Dict` - Response containing: + - results (List[Pipeline]): List of pipeline objects + - page_total (int): Total items in current page + - page_number (int): Current page number + - total (int): Total number of items across all pages + + +**Raises**: + +- `Exception` - If the request fails or if page_size is invalid. +- `AssertionError` - If page_size is not between 1 and 100. + +#### init + +```python +@classmethod +def init(cls, name: Text, api_key: Optional[Text] = None) -> Pipeline +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/pipeline_factory/__init__.py#L312) + +Initialize a new empty pipeline. + +This method creates a new pipeline instance with no nodes or links, +ready for configuration. + +**Arguments**: + +- `name` _Text_ - Name of the pipeline. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `Pipeline` - New pipeline instance with empty configuration. + +#### create + +```python +@classmethod +def create(cls, + name: Text, + pipeline: Union[Text, Dict], + api_key: Optional[Text] = None) -> Pipeline +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/pipeline_factory/__init__.py#L338) + +Create a new draft pipeline. + +This method creates a new pipeline in draft status from a configuration +provided either as a Python dictionary or a JSON file. + +**Arguments**: + +- `name` _Text_ - Name of the pipeline. +- `pipeline` _Union[Text, Dict]_ - Pipeline configuration either as: + - Dict: Python dictionary containing nodes and links + - Text: Path to a JSON file containing the configuration +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `Pipeline` - Created pipeline instance in draft status. + + +**Raises**: + +- `Exception` - If: + - JSON file path is invalid + - File extension is not .json + - Pipeline creation request fails + - Pipeline configuration is invalid +- `AssertionError` - If the pipeline file doesn't exist or isn't a JSON file. + diff --git a/docs/api-reference/python/aixplain/v1/factories/pipeline_factory/utils.md b/docs/api-reference/python/aixplain/v1/factories/pipeline_factory/utils.md new file mode 100644 index 000000000..7e7499ee9 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/pipeline_factory/utils.md @@ -0,0 +1,46 @@ +--- +sidebar_label: utils +title: aixplain.v1.factories.pipeline_factory.utils +--- + +#### build\_from\_response + +```python +def build_from_response(response: Dict, + load_architecture: bool = False) -> Pipeline +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/pipeline_factory/utils.py#L23) + +Convert API response into a Pipeline object. + +This function creates a Pipeline object from an API response, optionally loading +its full architecture including nodes and links. The architecture can include +various node types like Input, Output, BareAsset, BareMetric, Decision, Router, +Script, BareSegmentor, and BareReconstructor. + +**Arguments**: + +- `response` _Dict_ - API response containing pipeline information including: + - id: Pipeline identifier + - name: Pipeline name + - api_key: Optional API key + - status: Pipeline status (defaults to "draft") + - nodes: Optional list of node configurations + - links: Optional list of link configurations +- `load_architecture` _bool, optional_ - Whether to load the full pipeline + architecture including nodes and links. Defaults to False. + + +**Returns**: + +- `Pipeline` - Instantiated pipeline object. If load_architecture is True, + includes all configured nodes and links. If architecture loading fails, + returns a pipeline with empty nodes and links lists. + + +**Notes**: + + When loading architecture, decision nodes with passthrough parameters are + processed first to ensure proper parameter linking. + diff --git a/docs/api-reference/python/aixplain/v1/factories/script_factory.md b/docs/api-reference/python/aixplain/v1/factories/script_factory.md new file mode 100644 index 000000000..55800d46d --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/script_factory.md @@ -0,0 +1,45 @@ +--- +sidebar_label: script_factory +title: aixplain.v1.factories.script_factory +--- + +### ScriptFactory Objects + +```python +class ScriptFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/script_factory.py#L10) + +A factory class for handling script file operations. + +This class provides functionality for uploading script files to the backend +and managing their metadata. + +#### upload\_script + +```python +@classmethod +def upload_script(cls, script_path: str) -> Tuple[str, str] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/script_factory.py#L18) + +Uploads a script file to the backend and returns its ID and metadata. + +**Arguments**: + +- `script_path` _str_ - The file system path to the script file to be uploaded. + + +**Returns**: + + Tuple[str, str]: A tuple containing: + - file_id (str): The unique identifier assigned to the uploaded file. + - metadata (str): JSON string containing file metadata (name and size). + + +**Raises**: + +- `Exception` - If the upload fails or the file cannot be accessed. + diff --git a/docs/api-reference/python/aixplain/v1/factories/team_agent_factory/init.md b/docs/api-reference/python/aixplain/v1/factories/team_agent_factory/init.md new file mode 100644 index 000000000..bda9a0a46 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/team_agent_factory/init.md @@ -0,0 +1,188 @@ +--- +sidebar_label: team_agent_factory +title: aixplain.v1.factories.team_agent_factory +--- + +Copyright 2024 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: Thiago Castro Ferreira and Lucas Pavanelli +Date: August 15th 2024 +Description: + TeamAgent Factory Class + +### TeamAgentFactory Objects + +```python +class TeamAgentFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/team_agent_factory/__init__.py#L40) + +Factory class for creating and managing team agents. + +This class provides functionality for creating new team agents, retrieving existing +team agents, and managing team agent configurations in the aiXplain platform. +Team agents can be composed of multiple individual agents, LLMs +working together to accomplish complex tasks. + +#### create + +```python +@classmethod +def create(cls, + name: Text, + agents: List[Union[Text, Agent]], + llm: Optional[Union[LLM, Text]] = None, + supervisor_llm: Optional[Union[LLM, Text]] = None, + description: Text = "", + api_key: Text = config.TEAM_API_KEY, + supplier: Union[Dict, Text, Supplier, int] = "aiXplain", + version: Optional[Text] = None, + instructions: Optional[Text] = None, + output_format: Optional[OutputFormat] = None, + expected_output: Optional[Union[BaseModel, Text, dict]] = None, + **kwargs) -> TeamAgent +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/team_agent_factory/__init__.py#L50) + +Create a new team agent in the platform. + +**Arguments**: + +- `name` - The name of the team agent. +- `agents` - A list of agents to be added to the team. +- `llm` _Optional[Union[LLM, Text]], optional_ - The LLM to be used for the team agent. +- `supervisor_llm` _Optional[Union[LLM, Text]], optional_ - Main supervisor LLM. Defaults to None. +- `description` - The description of the team agent to be displayed in the aiXplain platform. +- `api_key` - The API key to be used for the team agent. +- `supplier` - The supplier of the team agent. +- `version` - The version of the team agent. +- `instructions` - The instructions to guide the team agent (i.e. appended in the prompt of the team agent). +- `output_format` - The output format to be used for the team agent. +- `agents`0 - The expected output to be used for the team agent. +- `agents`1 - Additional keyword arguments for backward compatibility (deprecated parameters). + + +**Returns**: + + A new team agent instance. + + Deprecated Args: +- `agents`2 - DEPRECATED. Use 'llm' parameter instead. The ID of the LLM to be used for the team agent. +- `agents`3 - DEPRECATED. LLM for planning. +- `agents`4 - DEPRECATED. Whether to use the mentalist agent. + +#### create\_from\_dict + +```python +@classmethod +def create_from_dict(cls, dict: Dict) -> TeamAgent +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/team_agent_factory/__init__.py#L295) + +Create a team agent from a dictionary representation. + +This method instantiates a TeamAgent object from a dictionary containing +the agent's configuration. + +**Arguments**: + +- `dict` _Dict_ - Dictionary containing team agent configuration including: + - id: Team agent identifier + - name: Team agent name + - agents: List of agent configurations + - llm: Optional LLM configuration + - supervisor_llm: Optional supervisor LLM configuration + - mentalist_llm: Optional mentalist LLM configuration + + +**Returns**: + +- `TeamAgent` - Instantiated team agent with validated configuration. + + +**Raises**: + +- `Exception` - If validation fails or required fields are missing. + +#### list + +```python +@classmethod +def list(cls) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/team_agent_factory/__init__.py#L322) + +List all team agents available in the platform. + +This method retrieves all team agents accessible to the current user, +using the configured API key. + +**Returns**: + +- `Dict` - Response containing: + - results (List[TeamAgent]): List of team agent objects + - page_total (int): Total items in current page + - page_number (int): Current page number (always 0) + - total (int): Total number of team agents + + +**Raises**: + +- `Exception` - If the request fails or returns an error, including cases + where authentication fails or the service is unavailable. + +#### get + +```python +@classmethod +def get(cls, + agent_id: Optional[Text] = None, + name: Optional[Text] = None, + api_key: Optional[Text] = None) -> TeamAgent +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/team_agent_factory/__init__.py#L374) + +Retrieve a team agent by its ID or name. + +This method fetches a specific team agent from the platform using its +unique identifier or name. + +**Arguments**: + +- `agent_id` _Optional[Text], optional_ - Unique identifier of the team agent to retrieve. +- `name` _Optional[Text], optional_ - Name of the team agent to retrieve. +- `api_key` _Optional[Text], optional_ - API key for authentication. + Defaults to None, using the configured TEAM_API_KEY. + + +**Returns**: + +- `TeamAgent` - Retrieved team agent with its full configuration. + + +**Raises**: + +- `Exception` - If: + - Team agent ID/name is invalid + - Authentication fails + - Service is unavailable + - Other API errors occur +- `ValueError` - If neither agent_id nor name is provided, or if both are provided. + diff --git a/docs/api-reference/python/aixplain/v1/factories/team_agent_factory/utils.md b/docs/api-reference/python/aixplain/v1/factories/team_agent_factory/utils.md new file mode 100644 index 000000000..c48043608 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/team_agent_factory/utils.md @@ -0,0 +1,96 @@ +--- +sidebar_label: utils +title: aixplain.v1.factories.team_agent_factory.utils +--- + +Utils for building team agents. + +#### build\_team\_agent + +```python +def build_team_agent(payload: Dict, + agents: List[Agent] = None, + api_key: Text = config.TEAM_API_KEY) -> TeamAgent +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/team_agent_factory/utils.py#L24) + +Build a TeamAgent instance from configuration payload. + +This function creates a TeamAgent instance from a configuration payload, +handling the setup of agents, LLMs,and task dependencies. + +**Arguments**: + +- `payload` _Dict_ - Configuration dictionary containing: + - id: Optional team agent ID + - name: Team agent name + - agents: List of agent configurations + - description: Optional description + - instructions: Optional instructions + - teamId: Optional supplier information + - version: Optional version + - cost: Optional cost information + - llmId: LLM model ID (defaults to GPT-4) + - plannerId: Optional planner model ID + - status: Team agent status + - tools: Optional list of tool configurations +- `agents` _List[Agent], optional_ - Pre-instantiated agent objects. If not + provided, agents will be instantiated from IDs in the payload. + Defaults to None. +- `api_key` _Text, optional_ - API key for authentication. Defaults to + config.TEAM_API_KEY. + + +**Returns**: + +- `TeamAgent` - Configured team agent instance with all components initialized. + + +**Raises**: + +- `Exception` - If a task dependency referenced in an agent's configuration + cannot be found. + +#### parse\_tool\_from\_yaml + +```python +def parse_tool_from_yaml(tool: str) -> ModelTool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/team_agent_factory/utils.py#L177) + +Parse a tool from a string. + +#### is\_yaml\_formatted + +```python +def is_yaml_formatted(text) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/team_agent_factory/utils.py#L211) + +Check if a string is valid YAML format with additional validation. + +**Arguments**: + +- `text` _str_ - The string to check + + +**Returns**: + +- `bool` - True if valid YAML, False otherwise + +#### build\_team\_agent\_from\_yaml + +```python +def build_team_agent_from_yaml(yaml_code: str, + llm_id: str, + api_key: str, + team_id: Optional[str] = None) -> TeamAgent +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/team_agent_factory/utils.py#L244) + +Build a team agent from a YAML string. + diff --git a/docs/api-reference/python/aixplain/v1/factories/tool_factory.md b/docs/api-reference/python/aixplain/v1/factories/tool_factory.md new file mode 100644 index 000000000..0c9936745 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/tool_factory.md @@ -0,0 +1,150 @@ +--- +sidebar_label: tool_factory +title: aixplain.v1.factories.tool_factory +--- + +### ToolFactory Objects + +```python +class ToolFactory(ModelGetterMixin, ModelListMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/tool_factory.py#L23) + +A factory class for creating and managing various types of tools including indexes, scripts, and connections. + +This class provides functionality to create and manage different types of tools: +- Script models (utility models) +- Search collections (index models) +- Connectors (integration models) + +The factory inherits from ModelGetterMixin and ModelListMixin to provide model retrieval +and listing capabilities. + +**Attributes**: + +- `backend_url` - The URL endpoint for the backend API. + +#### recreate + +```python +@classmethod +def recreate(cls, + integration: Optional[Union[Text, Model]] = None, + tool: Optional[Union[Text, Model]] = None, + params: Optional[Union[BaseUtilityModelParams, BaseIndexParams, + BaseAuthenticationParams]] = None, + data: Optional[Dict] = None, + **kwargs) -> Model +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/tool_factory.py#L41) + +Recreates a tool based on an existing tool's configuration. + +This method creates a new tool instance using the configuration of an existing tool. +It's useful for creating copies or variations of existing tools. + +**Arguments**: + +- `integration` _Optional[Union[Text, Model]], optional_ - The integration model or its ID. Defaults to None. +- `tool` _Optional[Union[Text, Model]], optional_ - The existing tool model or its ID to recreate from. Defaults to None. + params (Optional[Union[BaseUtilityModelParams, BaseIndexParams, BaseAuthenticationParams]], optional): + Parameters for the new tool. Defaults to None. +- `data` _Optional[Dict], optional_ - Additional data for tool creation. Defaults to None. +- `**kwargs` - Additional keyword arguments passed to the tool creation process. + + +**Returns**: + +- `Model` - The newly created tool model. + +#### create + +```python +@classmethod +def create(cls, + integration: Optional[Union[Text, Model]] = None, + params: Optional[Union[BaseUtilityModelParams, BaseIndexParams, + BaseAuthenticationParams]] = None, + authentication_schema: Optional[AuthenticationSchema] = None, + data: Optional[Dict] = None, + **kwargs) -> Model +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/tool_factory.py#L71) + +Factory method to create indexes, script models and connections + +**Examples**: + + Create a script model (option 1): + Option 1: + from aixplain.modules.model.utility_model import BaseUtilityModelParams + + def add(a: int, b: int) -> int: + return a + b + + params = BaseUtilityModelParams( + name="My Script Model", + description="My Script Model Description", + code=add + ) + tool = ToolFactory.create(params=params) + + Option 2: + def add(a: int, b: int) -> int: + """Add two numbers""" + return a + b + + tool = ToolFactory.create( + name="My Script Model", + code=add + ) + + Create a search collection: + Option 1: + from aixplain.factories.index_factory.utils import AirParams + + params = AirParams( + name="My Search Collection", + description="My Search Collection Description" + ) + tool = ToolFactory.create(params=params) + + Option 2: + from aixplain.enums.index_stores import IndexStores + + tool = ToolFactory.create( + integration=IndexStores.VECTARA.get_model_id(), + name="My Search Collection", + description="My Search Collection Description" + ) + + Create a connector: + Option 1: + from aixplain.modules.model.connector import BearerAuthenticationParams + + params = BearerAuthenticationParams( + connector_id="my_connector_id", + token="my_token", + name="My Connection" + ) + tool = ToolFactory.create(params=params) + + Option 2: + tool = ToolFactory.create( + integration="my_connector_id", + name="My Connection", + token="my_token" + ) + + +**Arguments**: + +- `params` - The parameters for the tool + +**Returns**: + + The created tool + diff --git a/docs/api-reference/python/aixplain/v1/factories/wallet_factory.md b/docs/api-reference/python/aixplain/v1/factories/wallet_factory.md new file mode 100644 index 000000000..81c089310 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/factories/wallet_factory.md @@ -0,0 +1,50 @@ +--- +sidebar_label: wallet_factory +title: aixplain.v1.factories.wallet_factory +--- + +### WalletFactory Objects + +```python +class WalletFactory() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/wallet_factory.py#L8) + +A factory class for retrieving wallet information. + +This class provides functionality to fetch wallet details including total +and reserved balance information from the backend API. + +**Attributes**: + +- `backend_url` - The URL endpoint for the backend API. + +#### get + +```python +@classmethod +def get(cls, api_key: Text = config.TEAM_API_KEY) -> Wallet +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/factories/wallet_factory.py#L21) + +Retrieves the current wallet information from the backend. + +This method fetches the wallet details including total balance and reserved balance +using the provided API key. + +**Arguments**: + +- `api_key` _Text, optional_ - The API key for authentication. Defaults to config.TEAM_API_KEY. + + +**Returns**: + +- `Wallet` - A Wallet object containing the total and reserved balance information. + + +**Raises**: + +- `Exception` - If the wallet information cannot be retrieved from the backend. + diff --git a/docs/api-reference/python/aixplain/v1/init.md b/docs/api-reference/python/aixplain/v1/init.md new file mode 100644 index 000000000..71e87edfe --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/init.md @@ -0,0 +1,7 @@ +--- +sidebar_label: v1 +title: aixplain.v1 +--- + +aiXplain SDK v1 - Legacy SDK modules, factories, and enums. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/agent_response.md b/docs/api-reference/python/aixplain/v1/modules/agent/agent_response.md new file mode 100644 index 000000000..e63f061a5 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/agent_response.md @@ -0,0 +1,148 @@ +--- +sidebar_label: agent_response +title: aixplain.v1.modules.agent.agent_response +--- + +### AgentResponse Objects + +```python +class AgentResponse(ModelResponse) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response.py#L10) + +A response object for agent execution results. + +This class extends ModelResponse to handle agent-specific response data, +including intermediate steps and execution statistics. It provides dictionary-like +access to response data and serialization capabilities. + +**Attributes**: + +- `status` _ResponseStatus_ - The status of the agent execution. +- `data` _Optional[AgentResponseData]_ - Structured data from the agent execution. +- `details` _Optional[Union[Dict, List]]_ - Additional execution details. +- `completed` _bool_ - Whether the execution has completed. +- `error_message` _Text_ - Error message if execution failed. +- `used_credits` _float_ - Number of credits used for execution. +- `run_time` _float_ - Total execution time in seconds. +- `usage` _Optional[Dict]_ - Resource usage information. +- `url` _Optional[Text]_ - URL for asynchronous result polling. + +#### \_\_init\_\_ + +```python +def __init__(status: ResponseStatus = ResponseStatus.FAILED, + data: Optional[Union[AgentResponseData, + "EvolverResponseData"]] = None, + details: Optional[Union[Dict, List]] = {}, + completed: bool = False, + error_message: Text = "", + used_credits: float = 0.0, + run_time: float = 0.0, + usage: Optional[Dict] = None, + url: Optional[Text] = None, + **kwargs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response.py#L29) + +Initialize a new AgentResponse instance. + +**Arguments**: + +- `status` _ResponseStatus, optional_ - The status of the agent execution. + Defaults to ResponseStatus.FAILED. +- `data` _Optional[AgentResponseData], optional_ - Structured data from the + agent execution. Defaults to None. +- `details` _Optional[Union[Dict, List]], optional_ - Additional execution + details. Defaults to \{}. +- `completed` _bool, optional_ - Whether the execution has completed. + Defaults to False. +- `error_message` _Text, optional_ - Error message if execution failed. + Defaults to "". +- `used_credits` _float, optional_ - Number of credits used for execution. + Defaults to 0.0. +- `run_time` _float, optional_ - Total execution time in seconds. + Defaults to 0.0. +- `usage` _Optional[Dict], optional_ - Resource usage information. + Defaults to None. +- `url` _Optional[Text], optional_ - URL for asynchronous result polling. + Defaults to None. +- `**kwargs` - Additional keyword arguments passed to ModelResponse. + +#### \_\_getitem\_\_ + +```python +def __getitem__(key: Text) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response.py#L79) + +Get a response attribute using dictionary-style access. + +Overrides the parent class's __getitem__ to handle AgentResponseData +serialization when accessing the 'data' key. + +**Arguments**: + +- `key` _Text_ - The name of the attribute to get. + + +**Returns**: + +- `Any` - The value of the attribute. For 'data' key, returns the + serialized dictionary form. + +#### \_\_setitem\_\_ + +```python +def __setitem__(key: Text, value: Any) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response.py#L96) + +Set a response attribute using dictionary-style access. + +Overrides the parent class's __setitem__ to handle AgentResponseData +deserialization when setting the 'data' key. + +**Arguments**: + +- `key` _Text_ - The name of the attribute to set. +- `value` _Any_ - The value to assign. For 'data' key, can be either a + dictionary or AgentResponseData instance. + +#### to\_dict + +```python +def to_dict() -> Dict[Text, Any] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response.py#L114) + +Convert the response to a dictionary representation. + +Overrides the parent class's to_dict to handle AgentResponseData +serialization in the output dictionary. + +**Returns**: + + Dict[Text, Any]: A dictionary containing all response data, with the + 'data' field containing the serialized AgentResponseData. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response.py#L128) + +Return a string representation of the response. + +**Returns**: + +- `str` - A string showing all attributes and their values in a readable format, + with the class name changed from ModelResponse to AgentResponse. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/agent_response_data.md b/docs/api-reference/python/aixplain/v1/modules/agent/agent_response_data.md new file mode 100644 index 000000000..040109d3e --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/agent_response_data.md @@ -0,0 +1,209 @@ +--- +sidebar_label: agent_response_data +title: aixplain.v1.modules.agent.agent_response_data +--- + +Agent response data. + +This module contains the AgentResponseData class, which is used to encapsulate the +input, output, and execution details of an agent's response, including intermediate +steps and execution statistics. + +### AgentResponseData Objects + +```python +class AgentResponseData() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response_data.py#L11) + +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**: + +- `input` _Optional[Any]_ - The input provided to the agent. +- `output` _Optional[Any]_ - The final output from the agent. +- `session_id` _str_ - Identifier for the conversation session. +- `intermediate_steps` _List[Any]_ - List of steps taken during execution. +- `steps` _List[Any]_ - Reformatted list of steps with detailed execution info. +- `execution_stats` _Optional[Dict[str, Any]]_ - Statistics about the execution. +- `critiques` _str_ - Any critiques or feedback about the execution. + +#### \_\_init\_\_ + +```python +def __init__(input: Optional[Any] = None, + output: Optional[Any] = None, + session_id: str = "", + intermediate_steps: Optional[List[Any]] = None, + steps: Optional[List[Any]] = None, + execution_stats: Optional[Dict[str, Any]] = None, + critiques: Optional[str] = None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response_data.py#L27) + +Initialize a new AgentResponseData instance. + +**Arguments**: + +- `input` _Optional[Any], optional_ - The input provided to the agent. + Defaults to None. +- `output` _Optional[Any], optional_ - The final output from the agent. + Defaults to None. +- `session_id` _str, optional_ - Identifier for the conversation session. + Defaults to "". +- `intermediate_steps` _Optional[List[Any]], optional_ - List of steps taken + during execution. Defaults to None. +- `steps` _Optional[List[Any]], optional_ - Reformatted list of steps with + detailed execution info. Defaults to None. +- `execution_stats` _Optional[Dict[str, Any]], optional_ - Statistics about + the execution. Defaults to None. +- `critiques` _Optional[str], optional_ - Any critiques or feedback about + the execution. Defaults to None. + +#### from\_dict + +```python +@classmethod +def from_dict(cls, data: Dict[str, Any]) -> "AgentResponseData" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response_data.py#L64) + +Create an AgentResponseData instance from a dictionary. + +**Arguments**: + +- `data` _Dict[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 + - steps: Reformatted list of steps with detailed execution info + - executionStats: Statistics about the execution + - critiques: Any critiques or feedback + + +**Returns**: + +- `AgentResponseData` - A new instance populated with the dictionary data. + +#### to\_dict + +```python +def to_dict() -> Dict[str, Any] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response_data.py#L90) + +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 + - steps: Reformatted list of steps with detailed execution info + - executionStats: Statistics about the execution + - execution_stats: Alias for executionStats + - critiques: Any critiques or feedback + +#### get + +```python +def get(key: str, default: Optional[Any] = None) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response_data.py#L115) + +Get an attribute value using attribute-style access. + +**Arguments**: + +- `key` _str_ - The name of the attribute to get. +- `default` _Optional[Any], optional_ - The value to return if the attribute + is not found. Defaults to None. + + +**Returns**: + +- `Any` - The value of the attribute, or the default value if not found. + +#### \_\_getitem\_\_ + +```python +def __getitem__(key: str) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response_data.py#L128) + +Get an attribute value using dictionary-style access. + +**Arguments**: + +- `key` _str_ - The name of the attribute to get. + + +**Returns**: + +- `Any` - The value of the attribute, or None if not found. + +#### \_\_setitem\_\_ + +```python +def __setitem__(key: str, value: Any) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response_data.py#L139) + +Set an attribute value using dictionary-style access. + +**Arguments**: + +- `key` _str_ - The name of the attribute to set. +- `value` _Any_ - The value to assign to the attribute. + + +**Raises**: + +- `KeyError` - If the key is not a valid attribute of the class. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response_data.py#L154) + +Return a string representation of the response data. + +**Returns**: + +- `str` - A string showing all attributes and their values in a readable format. + +#### \_\_contains\_\_ + +```python +def __contains__(key: Text) -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_response_data.py#L171) + +Check if an attribute exists using 'in' operator. + +**Arguments**: + +- `key` _Text_ - The name of the attribute to check. + + +**Returns**: + +- `bool` - True if the attribute exists and is accessible, False otherwise. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/agent_task.md b/docs/api-reference/python/aixplain/v1/modules/agent/agent_task.md new file mode 100644 index 000000000..179949d87 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/agent_task.md @@ -0,0 +1,89 @@ +--- +sidebar_label: agent_task +title: aixplain.v1.modules.agent.agent_task +--- + +### WorkflowTask Objects + +```python +class WorkflowTask() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_task.py#L5) + +A task definition for an AI agent to execute. + +This class represents a task that can be assigned to an agent, including its +description, expected output, and any dependencies on other tasks. + +**Attributes**: + +- `name` _Text_ - The unique identifier/name of the task. +- `description` _Text_ - Detailed description of what the task should accomplish. +- `expected_output` _Text_ - Description of the expected output format or content. +- `dependencies` _Optional[List[Union[Text, WorkflowTask]]]_ - List of tasks or task + names that must be completed before this task. Defaults to None. + +#### \_\_init\_\_ + +```python +def __init__(name: Text, + description: Text, + expected_output: Text, + dependencies: Optional[List[Union[Text, "WorkflowTask"]]] = []) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_task.py#L19) + +Initialize a new WorkflowTask instance. + +**Arguments**: + +- `name` _Text_ - The unique identifier/name of the task. +- `description` _Text_ - Detailed description of what the task should accomplish. +- `expected_output` _Text_ - Description of the expected output format or content. +- `dependencies` _Optional[List[Union[Text, WorkflowTask]]], optional_ - List of + tasks or task names that must be completed before this task. + Defaults to None. + +#### to\_dict + +```python +def to_dict() -> dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_task.py#L41) + +Convert the task to a dictionary representation. + +This method serializes the task data, converting any WorkflowTask dependencies +to their name strings. + +**Returns**: + +- `dict` - A dictionary containing the task data with keys: + - name: The task name + - description: The task description + - expectedOutput: The expected output description + - dependencies: List of dependency names or None + +#### from\_dict + +```python +@classmethod +def from_dict(cls, data: dict) -> "WorkflowTask" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/agent_task.py#L68) + +Create an WorkflowTask instance from a dictionary representation. + +**Arguments**: + +- `data` - Dictionary containing WorkflowTask parameters + + +**Returns**: + + WorkflowTask instance + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/evolve_param.md b/docs/api-reference/python/aixplain/v1/modules/agent/evolve_param.md new file mode 100644 index 000000000..619a7c6d9 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/evolve_param.md @@ -0,0 +1,155 @@ +--- +sidebar_label: evolve_param +title: aixplain.v1.modules.agent.evolve_param +--- + +#### \_\_author\_\_ + +Copyright 2024 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: aiXplain Team +Date: December 2024 +Description: + EvolveParam Base Model Class for Agent and TeamAgent evolve functionality + +### EvolveParam Objects + +```python +@dataclass +class EvolveParam() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/evolve_param.py#L29) + +Base model for evolve parameters used in Agent and TeamAgent evolution. + +**Attributes**: + +- `to_evolve` _bool_ - Whether to enable evolution. Defaults to False. +- `evolve_type` _Optional[EvolveType]_ - Type of evolve. +- `max_successful_generations` _int_ - Maximum number of successful generations. +- `max_failed_generation_retries` _int_ - Maximum number of failed generation retries. +- `max_iterations` _int_ - Maximum number of iterations. +- `max_non_improving_generations` _Optional[int]_ - Maximum number of non-improving generations. +- `llm` _Optional[Dict[str, Any]]_ - LLM configuration with all parameters. +- `additional_params` _Optional[Dict[str, Any]]_ - Additional parameters. + +#### \_\_post\_init\_\_ + +```python +def __post_init__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/evolve_param.py#L52) + +Validate parameters after initialization. + +#### validate + +```python +def validate() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/evolve_param.py#L56) + +Validate evolve parameters. + +**Raises**: + +- `ValueError` - If any parameter is invalid. + +#### from\_dict + +```python +@classmethod +def from_dict(cls, data: Union[Dict[str, Any], None]) -> "EvolveParam" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/evolve_param.py#L107) + +Create EvolveParam instance from dictionary. + +**Arguments**: + +- `data` _Union[Dict[str, Any], None]_ - Dictionary containing evolve parameters. + + +**Returns**: + +- `EvolveParam` - Instance with parameters set from dictionary. + + +**Raises**: + +- `ValueError` - If data format is invalid. + +#### to\_dict + +```python +def to_dict() -> Dict[str, Any] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/evolve_param.py#L160) + +Convert EvolveParam instance to dictionary for API calls. + +**Returns**: + + Dict[str, Any]: Dictionary representation with API-compatible keys. + +#### merge + +```python +def merge(other: Union[Dict[str, Any], "EvolveParam"]) -> "EvolveParam" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/evolve_param.py#L188) + +Merge this EvolveParam with another set of parameters. + +**Arguments**: + +- `other` _Union[Dict[str, Any], EvolveParam]_ - Other parameters to merge. + + +**Returns**: + +- `EvolveParam` - New instance with merged parameters. + +#### validate\_evolve\_param + +```python +def validate_evolve_param( + evolve_param: Union[Dict[str, Any], EvolveParam, None]) -> EvolveParam +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/evolve_param.py#L242) + +Utility function to validate and convert evolve parameters. + +**Arguments**: + +- `evolve_param` _Union[Dict[str, Any], EvolveParam, None]_ - Input evolve parameters. + + +**Returns**: + +- `EvolveParam` - Validated EvolveParam instance. + + +**Raises**: + +- `ValueError` - If parameters are invalid. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/init.md b/docs/api-reference/python/aixplain/v1/modules/agent/init.md new file mode 100644 index 000000000..5248ec87f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/init.md @@ -0,0 +1,475 @@ +--- +sidebar_label: agent +title: aixplain.v1.modules.agent +--- + +Agent module for aiXplain SDK. + +This module provides the Agent class and related functionality for creating and managing +AI agents that can execute tasks using various tools and models. + +Copyright 2024 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: Lucas Pavanelli and Thiago Castro Ferreira +Date: May 16th 2024 +Description: + Agentification Class + +### Agent Objects + +```python +class Agent(Model, DeployableMixin[Union[Tool, DeployableTool]]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L57) + +An advanced AI system that performs tasks using specialized tools from the aiXplain marketplace. + +This class represents an AI agent that can understand natural language instructions, +use various tools and models, and execute complex tasks. It combines a large language +model (LLM) with specialized tools to provide comprehensive task-solving capabilities. + +**Attributes**: + +- `id` _Text_ - ID of the Agent. +- `name` _Text_ - Name of the Agent. +- `tools` _List[Union[Tool, Model]]_ - Collection of tools and models the Agent can use. +- `description` _Text, optional_ - Detailed description of the Agent's capabilities. + Defaults to "". +- `instructions` _Text_ - System instructions/prompt defining the Agent's behavior. +- `llm_id` _Text_ - ID of the large language model. Defaults to GPT-5 Mini + (6895d6d1d50c89537c1cf237). +- `llm` _Optional[LLM]_ - The LLM instance used by the Agent. +- `supplier` _Text_ - The provider/creator of the Agent. +- `version` _Text_ - Version identifier of the Agent. +- `status` _AssetStatus_ - Current status of the Agent (DRAFT or ONBOARDED). +- `name`0 _List[AgentTask]_ - List of tasks the Agent can perform. +- `name`1 _str_ - URL endpoint for the backend API. +- `name`2 _str_ - Authentication key for API access. +- `name`3 _Dict, optional_ - Pricing information for using the Agent. Defaults to None. +- `name`4 _bool_ - Whether the Agent's configuration is valid. +- `name`5 _OutputFormat_ - default output format for agent responses. +- `name`6 _Union[BaseModel, Text, dict], optional_ - expected output. Defaults to None. + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text, + description: Text, + instructions: Optional[Text] = None, + tools: List[Union[Tool, Model]] = [], + llm_id: Text = "6895d6d1d50c89537c1cf237", + llm: Optional[LLM] = None, + api_key: Optional[Text] = config.TEAM_API_KEY, + supplier: Union[Dict, Text, Supplier, int] = "aiXplain", + version: Optional[Text] = None, + cost: Optional[Dict] = None, + status: AssetStatus = AssetStatus.DRAFT, + tasks: List[AgentTask] = [], + workflow_tasks: List[WorkflowTask] = [], + output_format: OutputFormat = OutputFormat.TEXT, + expected_output: Optional[Union[BaseModel, Text, dict]] = None, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L88) + +Initialize a new Agent instance. + +**Arguments**: + +- `id` _Text_ - ID of the Agent. +- `name` _Text_ - Name of the Agent. +- `description` _Text_ - Detailed description of the Agent's capabilities. +- `instructions` _Optional[Text], optional_ - System instructions/prompt defining + the Agent's behavior. Defaults to None. +- `tools` _List[Union[Tool, Model]], optional_ - Collection of tools and models + the Agent can use. Defaults to empty list. +- `llm_id` _Text, optional_ - ID of the large language model. Defaults to GPT-5 Mini + (6895d6d1d50c89537c1cf237). +- `llm` _Optional[LLM], optional_ - The LLM instance to use. If provided, takes + precedence over llm_id. Defaults to None. +- `api_key` _Optional[Text], optional_ - Authentication key for API access. + Defaults to config.TEAM_API_KEY. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - The provider/creator + of the Agent. Defaults to "aiXplain". +- `version` _Optional[Text], optional_ - Version identifier. Defaults to None. +- `name`0 _Optional[Dict], optional_ - Pricing information. Defaults to None. +- `name`1 _AssetStatus, optional_ - Current status of the Agent. + Defaults to AssetStatus.DRAFT. +- `name`2 _List[AgentTask], optional_ - List of tasks the Agent can perform. + Defaults to empty list. +- `name`3 _List[WorkflowTask], optional_ - List of workflow tasks + the Agent can execute. Defaults to empty list. +- `name`4 _OutputFormat, optional_ - default output format for agent responses. Defaults to OutputFormat.TEXT. +- `name`5 _Union[BaseModel, Text, dict], optional_ - expected output. Defaults to None. +- `name`6 - Additional configuration parameters. + +#### validate + +```python +def validate(raise_exception: bool = False) -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L215) + +Validate the Agent's configuration and mark its validity status. + +This method runs all validation checks and updates the is_valid flag. +If validation fails, it can either raise an exception or log warnings. + +**Arguments**: + +- `raise_exception` _bool, optional_ - Whether to raise exceptions on validation + failures. If False, failures are logged as warnings. Defaults to False. + + +**Returns**: + +- `bool` - True if validation passed, False otherwise. + + +**Raises**: + +- `Exception` - If validation fails and raise_exception is True. + +#### generate\_session\_id + +```python +def generate_session_id(history: list = None) -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L243) + +Generate a unique session ID for agent conversations. + +**Arguments**: + +- `history` _list, optional_ - Previous conversation history. Defaults to None. + + +**Returns**: + +- `str` - A unique session identifier based on timestamp and random components. + +#### poll + +```python +def poll(poll_url: Text, name: Text = "model_process") -> "AgentResponse" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L322) + +Override poll to normalize progress data from camelCase to snake_case. + +**Arguments**: + +- `poll_url` _Text_ - URL to poll for operation status. +- `name` _Text, optional_ - Identifier for the operation. Defaults to "model_process". + + +**Returns**: + +- `AgentResponse` - Response with normalized progress data. + +#### sync\_poll + +```python +def sync_poll( + poll_url: Text, + name: Text = "model_process", + wait_time: float = 0.5, + timeout: float = 300, + progress_verbosity: Optional[str] = "compact") -> "AgentResponse" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L487) + +Poll the platform until agent execution completes or times out. + +**Arguments**: + +- `poll_url` _Text_ - URL to poll for operation status. +- `name` _Text, optional_ - Identifier for the operation. Defaults to "model_process". +- `wait_time` _float, optional_ - Initial wait time in seconds between polls. Defaults to 0.5. +- `timeout` _float, optional_ - Maximum total time to poll in seconds. Defaults to 300. +- `progress_verbosity` _Optional[str], optional_ - Progress display mode - "full" (detailed), "compact" (brief), or None (no progress). Defaults to "compact". + + +**Returns**: + +- `AgentResponse` - The final response from the agent execution. + +#### run + +```python +def run(data: Optional[Union[Dict, Text]] = None, + query: Optional[Text] = None, + session_id: Optional[Text] = None, + history: Optional[List[Dict]] = None, + name: Text = "model_process", + timeout: float = 300, + parameters: Dict = {}, + wait_time: float = 0.5, + content: Optional[Union[Dict[Text, Text], List[Text]]] = None, + max_tokens: int = 4096, + max_iterations: int = 5, + trace_request: bool = False, + progress_verbosity: Optional[str] = "compact", + run_response_generation: bool = True, + **kwargs) -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L564) + +Runs an agent call. + +**Arguments**: + +- `data` _Optional[Union[Dict, Text]], optional_ - data to be processed by the agent. Defaults to None. +- `query` _Optional[Text], optional_ - query to be processed by the agent. Defaults to None. +- `session_id` _Optional[Text], optional_ - conversation Session ID. Defaults to None. +- `history` _Optional[List[Dict]], optional_ - chat history (in case session ID is None). Defaults to None. +- `name` _Text, optional_ - ID given to a call. Defaults to "model_process". +- `timeout` _float, optional_ - total polling time. Defaults to 300. +- `parameters` _Dict, optional_ - optional parameters to the model. Defaults to "\{}". +- `wait_time` _float, optional_ - wait time in seconds between polling calls. Defaults to 0.5. +- `content` _Union[Dict[Text, Text], List[Text]], optional_ - Content inputs to be processed according to the query. Defaults to None. +- `max_tokens` _int, optional_ - maximum number of tokens which can be generated by the agent. Defaults to 2048. +- `query`0 _int, optional_ - maximum number of iterations between the agent and the tools. Defaults to 10. +- `query`1 _bool, optional_ - return the request id for tracing the request. Defaults to False. +- `query`2 _Optional[str], optional_ - Progress display mode - "full" (detailed), "compact" (brief), or None (no progress). Defaults to "compact". +- `query`3 _bool, optional_ - Whether to run response generation. Defaults to True. +- `query`4 - Additional keyword arguments. + + +**Returns**: + +- `query`5 - parsed output from model + +#### run\_async + +```python +def run_async(data: Optional[Union[Dict, Text]] = None, + query: Optional[Text] = None, + session_id: Optional[Text] = None, + history: Optional[List[Dict]] = None, + name: Text = "model_process", + parameters: Dict = {}, + content: Optional[Union[Dict[Text, Text], List[Text]]] = None, + max_tokens: int = 2048, + max_iterations: int = 5, + output_format: Optional[OutputFormat] = None, + expected_output: Optional[Union[BaseModel, Text, dict]] = None, + evolve: Union[Dict[str, Any], EvolveParam, None] = None, + trace_request: bool = False, + run_response_generation: bool = True) -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L721) + +Runs asynchronously an agent call. + +**Arguments**: + +- `data` _Optional[Union[Dict, Text]], optional_ - data to be processed by the agent. Defaults to None. +- `query` _Optional[Text], optional_ - query to be processed by the agent. Defaults to None. +- `session_id` _Optional[Text], optional_ - conversation Session ID. Defaults to None. +- `history` _Optional[List[Dict]], optional_ - chat history (in case session ID is None). Defaults to None. +- `name` _Text, optional_ - ID given to a call. Defaults to "model_process". +- `parameters` _Dict, optional_ - optional parameters to the model. Defaults to "\{}". +- `content` _Union[Dict[Text, Text], List[Text]], optional_ - Content inputs to be processed according to the query. Defaults to None. +- `max_tokens` _int, optional_ - maximum number of tokens which can be generated by the agent. Defaults to 2048. +- `max_iterations` _int, optional_ - maximum number of iterations between the agent and the tools. Defaults to 10. +- `output_format` _OutputFormat, optional_ - response format. If not provided, uses the format set during initialization. +- `query`0 _Union[BaseModel, Text, dict], optional_ - expected output. Defaults to None. +- `query`1 _Union[Dict[str, Any], EvolveParam, None], optional_ - evolve the agent configuration. Can be a dictionary, EvolveParam instance, or None. +- `query`2 _bool, optional_ - return the request id for tracing the request. Defaults to False. +- `query`3 _bool, optional_ - Whether to run response generation. Defaults to True. + + +**Returns**: + +- `query`4 - polling URL in response + +#### to\_dict + +```python +def to_dict() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L867) + +Convert the Agent instance to a dictionary representation. + +**Returns**: + +- `Dict` - Dictionary containing the agent's configuration and metadata. + +#### from\_dict + +```python +@classmethod +def from_dict(cls, data: Dict) -> "Agent" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L904) + +Create an Agent instance from a dictionary representation. + +**Arguments**: + +- `data` - Dictionary containing Agent parameters + + +**Returns**: + + Agent instance + +#### delete + +```python +def delete() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L979) + +Delete this Agent from the aiXplain platform. + +This method attempts to delete the Agent. The operation will fail if the +Agent is being used by any team agents. + +**Raises**: + +- `Exception` - If deletion fails, with detailed error messages for different + failure scenarios: + - Agent is in use by accessible team agents (lists team agent IDs) + - Agent is in use by inaccessible team agents + - Other deletion errors (with HTTP status code) + +#### update + +```python +def update() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L1042) + +Update the Agent's configuration on the aiXplain platform. + +This method validates and updates the Agent's configuration. It is deprecated +in favor of the save() method. + +**Raises**: + +- `Exception` - If validation fails or if there are errors during the update. +- `DeprecationWarning` - This method is deprecated, use save() instead. + + +**Notes**: + + This method is deprecated and will be removed in a future version. + Please use save() instead. + +#### save + +```python +def save() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L1089) + +Save the Agent's current configuration to the aiXplain platform. + +This method validates and saves any changes made to the Agent's configuration. +It is the preferred method for updating an Agent's settings. + +**Raises**: + +- `Exception` - If validation fails or if there are errors during the save operation. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L1100) + +Return a string representation of the Agent. + +**Returns**: + +- `str` - A string in the format "Agent: <name> (id=<id>)". + +#### evolve\_async + +```python +def evolve_async(evolve_type: Union[EvolveType, str] = EvolveType.TEAM_TUNING, + max_successful_generations: int = 3, + max_failed_generation_retries: int = 3, + max_iterations: int = 50, + max_non_improving_generations: Optional[int] = 2, + llm: Optional[Union[Text, LLM]] = None) -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L1108) + +Asynchronously evolve the Agent and return a polling URL in the AgentResponse. + +**Arguments**: + +- `evolve_type` _Union[EvolveType, str]_ - Type of evolution (TEAM_TUNING or INSTRUCTION_TUNING). Defaults to TEAM_TUNING. +- `max_successful_generations` _int_ - Maximum number of successful generations to evolve. Defaults to 3. +- `max_failed_generation_retries` _int_ - Maximum retry attempts for failed generations. Defaults to 3. +- `max_iterations` _int_ - Maximum number of iterations. Defaults to 50. +- `max_non_improving_generations` _Optional[int]_ - Stop condition parameter for non-improving generations. Defaults to 2, can be None. +- `llm` _Optional[Union[Text, LLM]]_ - LLM to use for evolution. Can be an LLM ID string or LLM object. Defaults to None. + + +**Returns**: + +- `AgentResponse` - Response containing polling URL and status. + +#### evolve + +```python +def evolve(evolve_type: Union[EvolveType, str] = EvolveType.TEAM_TUNING, + max_successful_generations: int = 3, + max_failed_generation_retries: int = 3, + max_iterations: int = 50, + max_non_improving_generations: Optional[int] = 2, + llm: Optional[Union[Text, LLM]] = None) -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/__init__.py#L1147) + +Synchronously evolve the Agent and poll for the result. + +**Arguments**: + +- `evolve_type` _Union[EvolveType, str]_ - Type of evolution (TEAM_TUNING or INSTRUCTION_TUNING). Defaults to TEAM_TUNING. +- `max_successful_generations` _int_ - Maximum number of successful generations to evolve. Defaults to 3. +- `max_failed_generation_retries` _int_ - Maximum retry attempts for failed generations. Defaults to 3. +- `max_iterations` _int_ - Maximum number of iterations. Defaults to 50. +- `max_non_improving_generations` _Optional[int]_ - Stop condition parameter for non-improving generations. Defaults to 2, can be None. +- `llm` _Optional[Union[Text, LLM]]_ - LLM to use for evolution. Can be an LLM ID string or LLM object. Defaults to None. + + +**Returns**: + +- `AgentResponse` - Final response from the evolution process. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/model_with_params.md b/docs/api-reference/python/aixplain/v1/modules/agent/model_with_params.md new file mode 100644 index 000000000..264aab0b7 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/model_with_params.md @@ -0,0 +1,95 @@ +--- +sidebar_label: model_with_params +title: aixplain.v1.modules.agent.model_with_params +--- + +A generic class that wraps a model with extra parameters. + +This is an abstract base class that must be extended by specific model wrappers. + +Example usage: + +class MyModel(ModelWithParams): + model_id: Text = "my_model" + extra_param: int = 10 + + @field_validator("extra_param") + def validate_extra_param(cls, v: int) -> int: + if v < 0: + raise ValueError("Extra parameter must be positive") + return v + +### ModelWithParams Objects + +```python +class ModelWithParams(BaseModel, ABC) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/model_with_params.py#L25) + +A generic class that wraps a model with extra parameters. + +The extra parameters are not part of the model's input/output parameters. +This is an abstract base class that must be extended by specific model wrappers. + +**Attributes**: + +- `model_id` - The ID of the model to wrap. + +#### validate\_model\_id + +```python +@field_validator("model_id") +def validate_model_id(cls, v: Text) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/model_with_params.py#L43) + +Validate the model_id field. + +This validator ensures that the model_id is not empty or whitespace-only. + +**Arguments**: + +- `cls` - The class (automatically provided by pydantic). +- `v` _Text_ - The value to validate. + + +**Returns**: + +- `Text` - The validated model ID. + + +**Raises**: + +- `ValueError` - If the model ID is empty or contains only whitespace. + +#### \_\_new\_\_ + +```python +def __new__(cls, *args, **kwargs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/model_with_params.py#L62) + +Create a new instance of a ModelWithParams subclass. + +This method prevents direct instantiation of the abstract base class while +allowing subclasses to be instantiated normally. + +**Arguments**: + +- `cls` - The class being instantiated. +- `*args` - Positional arguments for instance creation. +- `**kwargs` - Keyword arguments for instance creation. + + +**Returns**: + +- `ModelWithParams` - A new instance of a ModelWithParams subclass. + + +**Raises**: + +- `TypeError` - If attempting to instantiate ModelWithParams directly. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/output_format.md b/docs/api-reference/python/aixplain/v1/modules/agent/output_format.md new file mode 100644 index 000000000..7757ec109 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/output_format.md @@ -0,0 +1,45 @@ +--- +sidebar_label: output_format +title: aixplain.v1.modules.agent.output_format +--- + +#### \_\_author\_\_ + +Copyright 2024 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: February 21st 2024 +Description: + Asset Enum + +### OutputFormat Objects + +```python +class OutputFormat(Text, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/output_format.py#L28) + +Enum representing different output formats for AI agent responses. + +This enum defines the possible output formats that can be used by AI agents. +Each format is represented by a string constant. + +**Attributes**: + +- `MARKDOWN` _Text_ - Markdown format for formatted text output. +- `TEXT` _Text_ - Plain text output. +- `JSON` _Text_ - JSON format for structured data output. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/tool/init.md b/docs/api-reference/python/aixplain/v1/modules/agent/tool/init.md new file mode 100644 index 000000000..ad56705c2 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/tool/init.md @@ -0,0 +1,125 @@ +--- +sidebar_label: tool +title: aixplain.v1.modules.agent.tool +--- + +Agent tool module for aiXplain SDK. + +This module provides tool classes and functionality for agents to interact with +various services, models, and data sources. + +Copyright 2024 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: Lucas Pavanelli and Thiago Castro Ferreira +Date: May 16th 2024 +Description: + Agentification Class + +### Tool Objects + +```python +class Tool(ABC) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/__init__.py#L33) + +Specialized software or resource designed to assist the AI in executing specific tasks or functions based on user commands. + +**Attributes**: + +- `name` _Text_ - name of the tool +- `description` _Text_ - description of the tool +- `version` _Text_ - version of the tool + +#### \_\_init\_\_ + +```python +def __init__(name: Text, + description: Text, + version: Optional[Text] = None, + api_key: Optional[Text] = config.TEAM_API_KEY, + status: Optional[AssetStatus] = AssetStatus.DRAFT, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/__init__.py#L42) + +Initialize a new Tool instance. + +**Arguments**: + +- `name` _Text_ - The name of the tool. +- `description` _Text_ - A description of the tool's functionality. +- `version` _Optional[Text], optional_ - The version of the tool. Defaults to None. +- `api_key` _Optional[Text], optional_ - The API key for authentication. Defaults to config.TEAM_API_KEY. +- `status` _Optional[AssetStatus], optional_ - The current status of the tool. Defaults to AssetStatus.DRAFT. +- `**additional_info` - Additional keyword arguments for tool configuration. + +#### to\_dict + +```python +def to_dict() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/__init__.py#L68) + +Converts the tool instance to a dictionary representation. + +**Returns**: + +- `dict` - A dictionary containing the tool's attributes and configuration. + + +**Raises**: + +- `NotImplementedError` - This is an abstract method that must be implemented by subclasses. + +#### validate + +```python +def validate() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/__init__.py#L79) + +Validates the tool's configuration and settings. + +This method should check if all required attributes are properly set and +if the tool's configuration is valid. + +**Raises**: + +- `NotImplementedError` - This is an abstract method that must be implemented by subclasses. + +### DeployableTool Objects + +```python +class DeployableTool(Tool) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/__init__.py#L91) + +Tool that can be deployed. + +#### deploy + +```python +def deploy() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/__init__.py#L94) + +Deploy the tool. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/tool/model_tool.md b/docs/api-reference/python/aixplain/v1/modules/agent/tool/model_tool.md new file mode 100644 index 000000000..9f81d0271 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/tool/model_tool.md @@ -0,0 +1,212 @@ +--- +sidebar_label: model_tool +title: aixplain.v1.modules.agent.tool.model_tool +--- + +Model tool for aiXplain SDK agents. + +This module provides a tool that allows agents to interact with AI models +and execute model-based tasks. + +Copyright 2024 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: Lucas Pavanelli and Thiago Castro Ferreira +Date: May 16th 2024 +Description: + Agentification Class + +#### set\_tool\_name + +```python +def set_tool_name(function: Function, + supplier: Supplier = None, + model: Model = None) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/model_tool.py#L35) + +Sets the name of the tool based on the function, supplier, and model. + +**Arguments**: + +- `function` _Function_ - The function to be used in the tool. +- `supplier` _Supplier_ - The supplier to be used in the tool. +- `model` _Model_ - The model to be used in the tool. + + +**Returns**: + +- `Text` - The name of the tool. + +### ModelTool Objects + +```python +class ModelTool(Tool) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/model_tool.py#L59) + +A tool that wraps AI models to execute specific tasks or functions based on user commands. + +This class provides a standardized interface for working with various AI models, +allowing them to be used as tools in the aiXplain platform. It handles model +configuration, validation, and parameter management. + +**Attributes**: + +- `function` _Optional[Function]_ - The task that the tool performs. +- `supplier` _Optional[Supplier]_ - The preferred supplier to perform the task. +- `model` _Optional[Union[Text, Model]]_ - The model ID or Model instance. +- `model_object` _Optional[Model]_ - The actual Model instance for parameter access. +- `parameters` _Optional[Dict]_ - Configuration parameters for the model. +- `status` _AssetStatus_ - The current status of the tool. + +#### \_\_init\_\_ + +```python +def __init__(function: Optional[Union[Function, Text]] = None, + supplier: Optional[Union[Dict, Supplier]] = None, + model: Optional[Union[Text, Model]] = None, + name: Optional[Text] = None, + description: Text = "", + parameters: Optional[Dict] = None, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/model_tool.py#L75) + +Initialize a new ModelTool instance. + +**Arguments**: + +- `function` _Optional[Union[Function, Text]], optional_ - The task that the tool performs. Can be a Function enum + or a string that will be converted to a Function. Defaults to None. +- `supplier` _Optional[Union[Dict, Supplier]], optional_ - The preferred supplier to perform the task. + Can be a Supplier enum or a dictionary with supplier information. Defaults to None. +- `model` _Optional[Union[Text, Model]], optional_ - The model to use, either as a Model instance + or a model ID string. Defaults to None. +- `name` _Optional[Text], optional_ - The name of the tool. If not provided, will be generated + from function, supplier, and model. Defaults to None. +- `description` _Text, optional_ - A description of the tool's functionality. If not provided, + will be taken from model or function description. Defaults to "". +- `parameters` _Optional[Dict], optional_ - Configuration parameters for the model. Defaults to None. +- `**additional_info` - Additional keyword arguments for tool configuration. + + +**Raises**: + +- `Exception` - If the specified model doesn't exist or is inaccessible. + +#### to\_dict + +```python +def to_dict() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/model_tool.py#L130) + +Convert the tool instance to a dictionary representation. + +This method handles the conversion of complex attributes like supplier and model +into their serializable forms. + +**Returns**: + +- `Dict` - A dictionary containing the tool's configuration with keys: + - function: The function value or None + - type: Always "model" + - name: The tool's name + - description: The tool's description + - supplier: The supplier code or None + - version: The tool's version or None + - assetId: The model's ID + - parameters: The tool's parameters + - status: The tool's status + +#### validate + +```python +def validate() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/model_tool.py#L169) + +Validates the tool. + +**Notes**: + + - Checks if the tool has a function or model. + - If the function is a string, it converts it to a Function enum. + - Checks if the function is a utility function and if it has an associated model. + - Validates the supplier. + - Validates the model. + - If the description is empty, it sets the description to the function description or the model description. + +#### get\_parameters + +```python +def get_parameters() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/model_tool.py#L223) + +Get the tool's parameters, either from explicit settings or the model object. + +**Returns**: + +- `Dict` - The tool's parameters. If no explicit parameters were set and a model + object exists with model_params, returns those parameters as a list. + +#### validate\_parameters + +```python +def validate_parameters( + received_parameters: Optional[List[Dict]] = None +) -> Optional[List[Dict]] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/model_tool.py#L258) + +Validates and formats the parameters for the tool. + +**Arguments**: + +- `received_parameters` _Optional[List[Dict]]_ - List of parameter dictionaries in format [\{"name": "param_name", "value": param_value}] + + +**Returns**: + +- `Optional[List[Dict]]` - Validated parameters in the required format + + +**Raises**: + +- `ValueError` - If received parameters don't match the expected parameters from model or function + +#### \_\_repr\_\_ + +```python +def __repr__() -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/model_tool.py#L320) + +Return a string representation of the tool. + +**Returns**: + +- `Text` - A string in the format "ModelTool(name=<name>, function=<function>, + supplier=<supplier>, model=<model>)". + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/tool/pipeline_tool.md b/docs/api-reference/python/aixplain/v1/modules/agent/tool/pipeline_tool.md new file mode 100644 index 000000000..1d691da4f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/tool/pipeline_tool.md @@ -0,0 +1,130 @@ +--- +sidebar_label: pipeline_tool +title: aixplain.v1.modules.agent.tool.pipeline_tool +--- + +Pipeline tool for aiXplain SDK agents. + +This module provides a tool that allows agents to execute AI pipelines +and chain multiple AI operations together. + +Copyright 2024 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: Lucas Pavanelli and Thiago Castro Ferreira +Date: May 16th 2024 +Description: + Agentification Class + +### PipelineTool Objects + +```python +class PipelineTool(Tool) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/pipeline_tool.py#L35) + +A tool that wraps aiXplain pipelines to execute complex workflows based on user commands. + +This class provides an interface for using aiXplain pipelines as tools, allowing them +to be integrated into agent workflows. It handles pipeline validation, status management, +and execution. + +**Attributes**: + +- `description` _Text_ - A description of what the pipeline tool does. +- `pipeline` _Union[Text, Pipeline]_ - The pipeline to execute, either as a Pipeline instance + or a pipeline ID string. +- `status` _AssetStatus_ - The current status of the pipeline tool. +- `name` _Text_ - The name of the tool, defaults to pipeline name if not provided. + +#### \_\_init\_\_ + +```python +def __init__(description: Text, + pipeline: Union[Text, Pipeline], + name: Optional[Text] = None, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/pipeline_tool.py#L50) + +Initialize a new PipelineTool instance. + +**Arguments**: + +- `description` _Text_ - A description of what the pipeline tool does. +- `pipeline` _Union[Text, Pipeline]_ - The pipeline to execute, either as a Pipeline instance + or a pipeline ID string. +- `name` _Optional[Text], optional_ - The name of the tool. If not provided, will use + the pipeline's name. Defaults to None. +- `**additional_info` - Additional keyword arguments for tool configuration. + + +**Raises**: + +- `Exception` - If the specified pipeline doesn't exist or is inaccessible. + +#### to\_dict + +```python +def to_dict() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/pipeline_tool.py#L78) + +Convert the tool instance to a dictionary representation. + +**Returns**: + +- `dict` - A dictionary containing the tool's configuration with keys: + - assetId: The pipeline ID + - name: The tool's name + - description: The tool's description + - type: Always "pipeline" + - status: The tool's status + +#### \_\_repr\_\_ + +```python +def __repr__() -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/pipeline_tool.py#L97) + +Return a string representation of the tool. + +**Returns**: + +- `Text` - A string in the format "PipelineTool(name=<name>, pipeline=<pipeline>)". + +#### validate + +```python +def validate() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/pipeline_tool.py#L105) + +Validate the pipeline tool's configuration. + +This method performs several checks: +1. Verifies the pipeline exists and is accessible +2. Sets the tool name to the pipeline name if not provided +3. Updates the tool status to match the pipeline status + +**Raises**: + +- `Exception` - If the pipeline doesn't exist or is inaccessible. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/tool/python_interpreter_tool.md b/docs/api-reference/python/aixplain/v1/modules/agent/tool/python_interpreter_tool.md new file mode 100644 index 000000000..3ed6287fc --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/tool/python_interpreter_tool.md @@ -0,0 +1,110 @@ +--- +sidebar_label: python_interpreter_tool +title: aixplain.v1.modules.agent.tool.python_interpreter_tool +--- + +Python interpreter tool for aiXplain SDK agents. + +This module provides a tool that allows agents to execute Python code +using an interpreter in a controlled environment. + +Copyright 2024 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: Lucas Pavanelli and Thiago Castro Ferreira +Date: May 16th 2024 +Description: + Agentification Class + +### PythonInterpreterTool Objects + +```python +class PythonInterpreterTool(Tool) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/python_interpreter_tool.py#L34) + +A tool that provides a Python shell for executing Python commands. + +This tool allows direct execution of Python code within the aiXplain platform. +It acts as an interface to a Python interpreter, enabling dynamic code execution +and computation. + +**Attributes**: + +- `name` _Text_ - Always set to "Python Interpreter". +- `description` _Text_ - Description of the tool's functionality. +- `status` _AssetStatus_ - The current status of the tool (ONBOARDED or DRAFT). + +#### \_\_init\_\_ + +```python +def __init__(**additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/python_interpreter_tool.py#L47) + +Initialize a new PythonInterpreterTool instance. + +This initializes a Python interpreter tool with a fixed name and description. +The tool is set to ONBOARDED status by default. + +**Arguments**: + +- `**additional_info` - Additional keyword arguments for tool configuration. + +#### to\_dict + +```python +def to_dict() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/python_interpreter_tool.py#L60) + +Convert the tool instance to a dictionary representation. + +**Returns**: + +- `dict` - A dictionary containing the tool's configuration with keys: + - description: The tool's description + - type: Always "utility" + - utility: Always "custom_python_code" + +#### validate + +```python +def validate() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/python_interpreter_tool.py#L75) + +Validate the tool's configuration. + +This is a placeholder method as the Python interpreter tool has a fixed +configuration that doesn't require validation. + +#### \_\_repr\_\_ + +```python +def __repr__() -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/python_interpreter_tool.py#L83) + +Return a string representation of the tool. + +**Returns**: + +- `Text` - A string in the format "PythonInterpreterTool()". + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/tool/sql_tool.md b/docs/api-reference/python/aixplain/v1/modules/agent/tool/sql_tool.md new file mode 100644 index 000000000..a7634a1a0 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/tool/sql_tool.md @@ -0,0 +1,357 @@ +--- +sidebar_label: sql_tool +title: aixplain.v1.modules.agent.tool.sql_tool +--- + +SQL tool for aiXplain SDK agents. + +This module provides a tool that allows agents to execute SQL queries +against databases and CSV files. + +Copyright 2024 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: Lucas Pavanelli and Thiago Castro Ferreira +Date: May 16th 2024 +Description: + Agentification Class + +### SQLToolError Objects + +```python +class SQLToolError(Exception) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L39) + +Base exception for SQL Tool errors. + +### CSVError Objects + +```python +class CSVError(SQLToolError) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L45) + +Exception for CSV-related errors. + +### DatabaseError Objects + +```python +class DatabaseError(SQLToolError) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L51) + +Exception for database-related errors. + +#### clean\_column\_name + +```python +def clean_column_name(col: Text) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L57) + +Clean column names by replacing spaces and special characters with underscores. + +This function makes column names SQLite-compatible by: +1. Converting to lowercase +2. Replacing special characters with underscores +3. Removing duplicate underscores +4. Adding 'col_' prefix to names starting with numbers + +**Arguments**: + +- `col` _Text_ - The original column name. + + +**Returns**: + +- `Text` - The cleaned, SQLite-compatible column name. + +#### check\_duplicate\_columns + +```python +def check_duplicate_columns(df: pd.DataFrame) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L88) + +Check for duplicate column names in DataFrame after cleaning. + +This function checks if any column names would become duplicates after being +cleaned for SQLite compatibility. + +**Arguments**: + +- `df` _pd.DataFrame_ - The DataFrame to check for duplicate column names. + + +**Raises**: + +- `CSVError` - If any cleaned column names would be duplicates. + +#### infer\_sqlite\_type + +```python +def infer_sqlite_type(dtype) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L118) + +Infer SQLite type from pandas dtype. + +This function maps pandas data types to appropriate SQLite types: +- Integer types -> INTEGER +- Float types -> REAL +- Boolean types -> INTEGER +- Datetime types -> TIMESTAMP +- All others -> TEXT + +**Arguments**: + +- `dtype` - The pandas dtype to convert. + + +**Returns**: + +- `Text` - The corresponding SQLite type. + + +**Notes**: + + Issues a warning when falling back to TEXT type. + +#### get\_table\_schema + +```python +def get_table_schema(database_path: str) -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L150) + +Get the schema of all tables in the SQLite database. + +This function retrieves the CREATE TABLE statements for all tables in the database. + +**Arguments**: + +- `database_path` _str_ - Path to the SQLite database file. + + +**Returns**: + +- `str` - A string containing all table schemas, separated by newlines. + + +**Raises**: + +- `DatabaseError` - If the database file doesn't exist or there's an error accessing it. + + +**Notes**: + + Issues a warning if no tables are found in the database. + +#### create\_database\_from\_csv + +```python +def create_database_from_csv(csv_path: str, + database_path: str, + table_name: str = None) -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L190) + +Create SQLite database from CSV file and return the schema. + +This function creates or modifies a SQLite database by importing data from a CSV file. +It handles column name cleaning, data type inference, and data conversion. + +**Arguments**: + +- `csv_path` _str_ - Path to the CSV file to import. +- `database_path` _str_ - Path where the SQLite database should be created/modified. +- `table_name` _str, optional_ - Name for the table to create. If not provided, + uses the CSV filename (cleaned). Defaults to None. + + +**Returns**: + +- `str` - The schema of the created database. + + +**Raises**: + +- `CSVError` - If there are issues with the CSV file (doesn't exist, empty, parsing error). +- `DatabaseError` - If there are issues with database creation or modification. + + +**Notes**: + + - Issues warnings for column name changes and existing database/table modifications. + - Automatically cleans column names for SQLite compatibility. + - Handles NULL values, timestamps, and numeric data types appropriately. + +#### get\_table\_names\_from\_schema + +```python +def get_table_names_from_schema(schema: str) -> List[str] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L318) + +Extract table names from a database schema string. + +This function parses CREATE TABLE statements to extract table names. + +**Arguments**: + +- `schema` _str_ - The database schema string containing CREATE TABLE statements. + + +**Returns**: + +- `List[str]` - A list of table names found in the schema. Returns an empty list + if no tables are found or if the schema is empty. + +### SQLTool Objects + +```python +class SQLTool(DeployableTool) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L343) + +A tool for executing SQL commands in an SQLite database. + +This tool provides an interface for interacting with SQLite databases, including +executing queries, managing schema, and handling table operations. It supports +both read-only and write operations based on configuration. + +**Attributes**: + +- `description` _Text_ - A description of what the SQL tool does. +- `database` _Text_ - The database URI or path. +- `schema` _Text_ - The database schema containing table definitions. +- `tables` _Optional[Union[List[Text], Text]]_ - List of table names that can be + accessed by this tool. If None, all tables are accessible. +- `enable_commit` _bool_ - Whether write operations (INSERT, UPDATE, DELETE) are + allowed. If False, only read operations are permitted. +- `status` _AssetStatus_ - The current status of the tool (DRAFT or ONBOARDED). + +#### \_\_init\_\_ + +```python +def __init__(name: Text, + description: Text, + database: Text, + schema: Optional[Text] = None, + tables: Optional[Union[List[Text], Text]] = None, + enable_commit: bool = False, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L361) + +Initialize a new SQLTool instance. + +**Arguments**: + +- `name` _Text_ - The name of the tool. +- `description` _Text_ - A description of what the SQL tool does. +- `database` _Text_ - The database URI or path. Can be a local file path, + S3 URI, or HTTP(S) URL. +- `schema` _Optional[Text], optional_ - The database schema containing table + definitions. If not provided, will be inferred from the database. + Defaults to None. +- `tables` _Optional[Union[List[Text], Text]], optional_ - List of table names + that can be accessed by this tool. If not provided, all tables are + accessible. Defaults to None. +- `enable_commit` _bool, optional_ - Whether write operations are allowed. + If False, only read operations are permitted. Defaults to False. +- `**additional_info` - Additional keyword arguments for tool configuration. + + +**Raises**: + +- `SQLToolError` - If required parameters are missing or invalid. + +#### to\_dict + +```python +def to_dict() -> Dict[str, Text] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L400) + +Convert the tool instance to a dictionary representation. + +**Returns**: + + Dict[str, Text]: A dictionary containing the tool's configuration with keys: + - name: The tool's name + - description: The tool's description + - parameters: List of parameter dictionaries containing: + - database: The database URI or path + - schema: The database schema + - tables: Comma-separated list of table names or None + - enable_commit: Whether write operations are allowed + - type: Always "sql" + +#### validate + +```python +def validate() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L426) + +Validate the SQL tool's configuration. + +This method performs several checks: +1. Verifies required fields (description, database) are provided +2. Validates database path/URI format +3. Infers schema from database if not provided +4. Sets table list from schema if not provided +5. Uploads local database file to storage + +**Raises**: + +- `SQLToolError` - If any validation check fails or if there are issues with + database access or file operations. + +#### deploy + +```python +def deploy() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/tool/sql_tool.py#L478) + +Deploy the SQL tool by downloading and preparing the database. + +This method handles the deployment process: +1. For HTTP(S) URLs: Downloads the database file +2. Creates a unique local filename +3. Uploads the database to the aiXplain platform +4. Cleans up temporary files + +**Raises**: + +- `requests.exceptions.RequestException` - If downloading the database fails. +- `Exception` - If there are issues with file operations or uploads. + diff --git a/docs/api-reference/python/aixplain/v1/modules/agent/utils.md b/docs/api-reference/python/aixplain/v1/modules/agent/utils.md new file mode 100644 index 000000000..c736ee110 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/agent/utils.md @@ -0,0 +1,49 @@ +--- +sidebar_label: utils +title: aixplain.v1.modules.agent.utils +--- + +#### process\_variables + +```python +def process_variables(query: Union[Text, Dict], data: Union[Dict, Text], + parameters: Dict, + agent_description: Union[Text, None]) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/utils.py#L5) + +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 + +```python +def validate_history(history) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/agent/utils.py#L49) + +Validates that `history` is a list of dicts, each with 'role' and 'content' keys. +Raises a ValueError if validation fails. + diff --git a/docs/api-reference/python/aixplain/v1/modules/api_key.md b/docs/api-reference/python/aixplain/v1/modules/api_key.md new file mode 100644 index 000000000..4c3b2b363 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/api_key.md @@ -0,0 +1,441 @@ +--- +sidebar_label: api_key +title: aixplain.v1.modules.api_key +--- + +API Key management module for aiXplain services. + +This module provides classes for managing API keys and their rate limits. + +### TokenType Objects + +```python +class TokenType(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L17) + +Token type for rate limiting. + +Specifies which type of tokens to count for rate limiting purposes. + +**Attributes**: + +- `INPUT` - Count only input tokens. +- `OUTPUT` - Count only output tokens. +- `TOTAL` - Count total tokens (input + output). + +### APIKeyLimits Objects + +```python +class APIKeyLimits() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L33) + +Rate limits configuration for an API key. + +This class defines the rate limits that can be applied either globally +to an API key or specifically to a model. + +**Attributes**: + +- `token_per_minute` _int_ - Maximum number of tokens allowed per minute. +- `token_per_day` _int_ - Maximum number of tokens allowed per day. +- `request_per_minute` _int_ - Maximum number of requests allowed per minute. +- `request_per_day` _int_ - Maximum number of requests allowed per day. +- `model` _Optional[Model]_ - The model these limits apply to, if any. +- `token_type` _Optional[TokenType]_ - Type of token limit ('input', 'output', 'total'), or None for default. + +#### \_\_init\_\_ + +```python +def __init__(token_per_minute: int, + token_per_day: int, + request_per_minute: int, + request_per_day: int, + model: Optional[Union[Text, Model]] = None, + token_type: Optional[TokenType] = None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L48) + +Initialize an APIKeyLimits instance. + +**Arguments**: + +- `token_per_minute` _int_ - Maximum number of tokens per minute. +- `token_per_day` _int_ - Maximum number of tokens per day. +- `request_per_minute` _int_ - Maximum number of requests per minute. +- `request_per_day` _int_ - Maximum number of requests per day. +- `model` _Optional[Union[Text, Model]], optional_ - The model to apply + limits to. Can be a model ID or Model instance. Defaults to None. +- `token_type` _Optional[TokenType], optional_ - The type of token to apply the limit to. Defaults to None. + +### APIKeyUsageLimit Objects + +```python +class APIKeyUsageLimit() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L80) + +Usage limits and current usage for an API key. + +This class tracks the current usage counts against the configured limits +for an API key, either globally or for a specific model. + +**Attributes**: + +- `daily_request_count` _int_ - Number of requests made today. +- `daily_request_limit` _int_ - Maximum requests allowed per day. +- `daily_token_count` _int_ - Number of tokens used today. +- `daily_token_limit` _int_ - Maximum tokens allowed per day. +- `model` _Optional[Model]_ - The model these limits apply to, if any. + +#### \_\_init\_\_ + +```python +def __init__(daily_request_count: int, + daily_request_limit: int, + daily_token_count: int, + daily_token_limit: int, + model: Optional[Union[Text, Model]] = None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L94) + +Initialize an APIKeyUsageLimit instance. + +**Arguments**: + +- `daily_request_count` _int_ - number of requests made +- `daily_request_limit` _int_ - limit of requests +- `daily_token_count` _int_ - number of tokens used +- `daily_token_limit` _int_ - limit of tokens +- `model` _Optional[Union[Text, Model]], optional_ - Model which the limits apply. Defaults to None. + +### APIKey Objects + +```python +class APIKey() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L121) + +An API key for accessing aiXplain services. + +This class represents an API key with its associated limits, budget, +and access controls. It can have both global rate limits and +model-specific rate limits. + +**Attributes**: + +- `id` _int_ - The ID of this API key. +- `name` _Text_ - A descriptive name for the API key. +- `budget` _Optional[float]_ - Maximum spending limit, if any. +- `global_limits` _Optional[APIKeyLimits]_ - Rate limits applied globally. +- `asset_limits` _List[APIKeyLimits]_ - Rate limits for specific models. +- `expires_at` _Optional[datetime]_ - Expiration date and time. +- `access_key` _Optional[Text]_ - The actual API key value. +- `is_admin` _bool_ - Whether this is an admin API key. + +#### \_\_init\_\_ + +```python +def __init__(name: Text, + expires_at: Optional[Union[datetime, Text]] = None, + budget: Optional[float] = None, + asset_limits: List[APIKeyLimits] = [], + global_limits: Optional[Union[Dict, APIKeyLimits]] = None, + id: int = "", + access_key: Optional[Text] = None, + is_admin: bool = False) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L139) + +Initialize an APIKey instance. + +**Arguments**: + +- `name` _Text_ - A descriptive name for the API key. +- `expires_at` _Optional[Union[datetime, Text]], optional_ - When the key + expires. Can be a datetime or ISO format string. Defaults to None. +- `budget` _Optional[float], optional_ - Maximum spending limit. + Defaults to None. +- `asset_limits` _List[APIKeyLimits], optional_ - Rate limits for specific + models. Defaults to empty list. +- `global_limits` _Optional[Union[Dict, APIKeyLimits]], optional_ - Global + rate limits. Can be a dict with tpm/tpd/rpm/rpd keys or an + APIKeyLimits instance. Defaults to None. +- `id` _int, optional_ - Unique identifier. Defaults to empty string. +- `access_key` _Optional[Text], optional_ - The actual API key value. + Defaults to None. +- `is_admin` _bool, optional_ - Whether this is an admin key. + Defaults to False. + + +**Notes**: + + The global_limits dict format should have these keys: + - tpm: tokens per minute + - tpd: tokens per day + - rpm: requests per minute + - rpd: requests per day + +#### validate + +```python +def validate() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L208) + +Validate the APIKey configuration. + +This method checks that all rate limits are non-negative and that +referenced models exist and are valid. + +**Raises**: + +- `AssertionError` - If any of these conditions are not met: + - Budget is negative + - Global rate limits are negative + - Asset-specific rate limits are negative +- `Exception` - If a referenced model ID is not a valid aiXplain model. + + +**Notes**: + + - For asset limits, both the model reference and limits are checked + - Models can be specified by ID or Model instance + - Model IDs are resolved to Model instances during validation + +#### to\_dict + +```python +def to_dict() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L250) + +Convert the APIKey instance to a dictionary representation. + +This method serializes the APIKey and its associated limits into a +format suitable for API requests or storage. + +**Returns**: + +- `Dict` - A dictionary containing: + - id (int): The API key's ID + - name (Text): The API key's name + - budget (Optional[float]): The spending limit + - assetsLimits (List[Dict]): Model-specific limits with: + - tpm: tokens per minute + - tpd: tokens per day + - rpm: requests per minute + - rpd: requests per day + - tokenType (Optional[Text]): Type of token limit ('input', 'output', 'total') + - assetId: model ID + - expiresAt (Optional[Text]): ISO format expiration date + - globalLimits (Optional[Dict]): Global limits with tpm/tpd/rpm/rpd + + +**Notes**: + + - Datetime objects are converted to ISO format strings + - Model instances are referenced by their ID + +#### delete + +```python +def delete() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L308) + +Delete this API key from the system. + +This method permanently removes the API key from the aiXplain platform. +The operation cannot be undone. + +**Raises**: + +- `Exception` - If deletion fails, which can happen if: + - The API key doesn't exist + - The user doesn't have permission to delete it + - The API request fails + - The server returns a non-200 status code + + +**Notes**: + + - This operation is permanent and cannot be undone + - Only the API key owner can delete it + - Uses the team API key for authentication + +#### get\_usage + +```python +def get_usage(asset_id: Optional[Text] = None) -> APIKeyUsageLimit +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L338) + +Get current usage statistics for this API key. + +This method retrieves the current usage counts and limits for the API key, +either globally or for a specific model. + +**Arguments**: + +- `asset_id` _Optional[Text], optional_ - The model ID to get usage for. + If None, returns usage for all models. Defaults to None. + + +**Returns**: + +- `APIKeyUsageLimit` - A list of usage statistics objects containing: + - daily_request_count: Number of requests made today + - daily_request_limit: Maximum requests allowed per day + - daily_token_count: Number of tokens used today + - daily_token_limit: Maximum tokens allowed per day + - model: The model ID these stats apply to (None for global) + + +**Raises**: + +- `Exception` - If the request fails, which can happen if: + - The API key doesn't exist + - The user doesn't have permission to view usage + - The API request fails + - The server returns an error response + + +**Notes**: + + - Uses the team API key for authentication + - Counts reset at the start of each day + - Filtered by asset_id if provided + +#### set\_token\_per\_day + +```python +def set_token_per_day(token_per_day: int, + model: Optional[Union[Text, Model]] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L429) + +Set the daily token limit for this API key. + +**Arguments**: + +- `token_per_day` _int_ - Maximum number of tokens allowed per day. +- `model` _Optional[Union[Text, Model]], optional_ - The model to set + limit for. If None, sets global limit. Defaults to None. + + +**Raises**: + +- `Exception` - If the model isn't configured in this API key's + asset_limits. + + +**Notes**: + + - Model can be specified by ID or Model instance + - For global limits, model should be None + - The new limit takes effect immediately + +#### set\_token\_per\_minute + +```python +def set_token_per_minute(token_per_minute: int, + model: Optional[Union[Text, Model]] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L448) + +Set the per-minute token limit for this API key. + +**Arguments**: + +- `token_per_minute` _int_ - Maximum number of tokens allowed per minute. +- `model` _Optional[Union[Text, Model]], optional_ - The model to set + limit for. If None, sets global limit. Defaults to None. + + +**Raises**: + +- `Exception` - If the model isn't configured in this API key's + asset_limits. + + +**Notes**: + + - Model can be specified by ID or Model instance + - For global limits, model should be None + - The new limit takes effect immediately + +#### set\_request\_per\_day + +```python +def set_request_per_day(request_per_day: int, + model: Optional[Union[Text, Model]] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L467) + +Set the daily request limit for this API key. + +**Arguments**: + +- `request_per_day` _int_ - Maximum number of requests allowed per day. +- `model` _Optional[Union[Text, Model]], optional_ - The model to set + limit for. If None, sets global limit. Defaults to None. + + +**Raises**: + +- `Exception` - If the model isn't configured in this API key's + asset_limits. + + +**Notes**: + + - Model can be specified by ID or Model instance + - For global limits, model should be None + - The new limit takes effect immediately + +#### set\_request\_per\_minute + +```python +def set_request_per_minute(request_per_minute: int, + model: Optional[Union[Text, Model]] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/api_key.py#L486) + +Set the per-minute request limit for this API key. + +**Arguments**: + +- `request_per_minute` _int_ - Maximum number of requests allowed per minute. +- `model` _Optional[Union[Text, Model]], optional_ - The model to set + limit for. If None, sets global limit. Defaults to None. + + +**Raises**: + +- `Exception` - If the model isn't configured in this API key's + asset_limits. + + +**Notes**: + + - Model can be specified by ID or Model instance + - For global limits, model should be None + - The new limit takes effect immediately + diff --git a/docs/api-reference/python/aixplain/v1/modules/asset.md b/docs/api-reference/python/aixplain/v1/modules/asset.md new file mode 100644 index 000000000..597b5204e --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/asset.md @@ -0,0 +1,99 @@ +--- +sidebar_label: asset +title: aixplain.v1.modules.asset +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: December 27th 2022 +Description: + Asset Class + +### Asset Objects + +```python +class Asset() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/asset.py#L29) + +A class representing an aiXplain Asset. + +This class provides functionality to create and manage assets in the aiXplain platform. +Assets can be models, datasets, or other resources with associated metadata like +supplier information, version, license, privacy settings, and cost. + +**Attributes**: + +- `id` _Text_ - The unique identifier of the asset. +- `name` _Text_ - The name of the asset. +- `description` _Text_ - A detailed description of the asset. +- `supplier` _Union[Dict, Text, Supplier, int]_ - The supplier of the asset. +- `version` _Text_ - The version of the asset. +- `license` _Optional[License]_ - The license associated with the asset. +- `privacy` _Privacy_ - The privacy setting of the asset. +- `cost` _Optional[Union[Dict, float]]_ - The cost associated with the asset. + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text, + description: Text, + supplier: Union[Dict, Text, Supplier, int] = Supplier.AIXPLAIN, + version: Text = "1.0", + license: Optional[License] = None, + privacy: Privacy = Privacy.PRIVATE, + cost: Optional[Union[Dict, float]] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/asset.py#L47) + +Initialize a new Asset instance. + +**Arguments**: + +- `id` _Text_ - Unique identifier of the asset. +- `name` _Text_ - Name of the asset. +- `description` _Text_ - Detailed description of the asset. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - Supplier of the asset. + Can be a Supplier enum, dictionary, text, or integer. Defaults to Supplier.AIXPLAIN. +- `version` _Text, optional_ - Version of the asset. Defaults to "1.0". +- `license` _Optional[License], optional_ - License associated with the asset. Defaults to None. +- `privacy` _Privacy, optional_ - Privacy setting of the asset. Defaults to Privacy.PRIVATE. +- `cost` _Optional[Union[Dict, float]], optional_ - Cost of the asset. Can be a dictionary + with pricing details or a float value. Defaults to None. + +#### to\_dict + +```python +def to_dict() -> dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/asset.py#L95) + +Convert the Asset instance to a dictionary representation. + +This method serializes all attributes of the Asset instance into a dictionary +format, which can be useful for data transmission or storage. + +**Returns**: + +- `dict` - A dictionary containing all attributes of the Asset instance. + Keys are attribute names and values are their corresponding values. + diff --git a/docs/api-reference/python/aixplain/v1/modules/benchmark.md b/docs/api-reference/python/aixplain/v1/modules/benchmark.md new file mode 100644 index 000000000..b16f0519b --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/benchmark.md @@ -0,0 +1,118 @@ +--- +sidebar_label: benchmark +title: aixplain.v1.modules.benchmark +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: October 25th 2022 +Description: + Benchmark Class + +### Benchmark Objects + +```python +class Benchmark(Asset) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark.py#L32) + +Benchmark is a powerful tool for benchmarking machine learning models and evaluating their performance on specific tasks. +It represents a collection of Models, Datasets and Metrics to run associated Benchmark Jobs. + +**Attributes**: + +- `id` _str_ - ID of the Benchmark. +- `name` _str_ - Name of the Benchmark. +- `model_list` _List[Model]_ - List of Models to be used for benchmarking. +- `dataset_list` _List[Dataset]_ - List of Datasets to be used for benchmarking. +- `metric_list` _List[Metric]_ - List of Metrics to be used for benchmarking. +- `job_list` _List[BenchmarkJob]_ - List of associated Benchmark Jobs. +- `additional_info` _dict_ - Any additional information to be saved with the Benchmark. + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text, + dataset_list: List[Dataset], + model_list: List[Model], + metric_list: List[Metric], + job_list: List[BenchmarkJob], + description: Text = "", + supplier: Text = "aiXplain", + version: Text = "1.0", + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark.py#L46) + +Create a Benchmark with the necessary information. + +**Arguments**: + +- `id` _Text_ - ID of the Benchmark. +- `name` _Text_ - Name of the Benchmark. +- `dataset_list` _List[Dataset]_ - List of Datasets to be used for benchmarking. +- `model_list` _List[Model]_ - List of Models to be used for benchmarking. +- `metric_list` _List[Metric]_ - List of Metrics to be used for benchmarking. +- `job_list` _List[BenchmarkJob]_ - List of associated Benchmark Jobs. +- `description` _Text, optional_ - Description of the Benchmark. Defaults to "". +- `supplier` _Text, optional_ - Author of the Benchmark. Defaults to "aiXplain". +- `version` _Text, optional_ - Benchmark version. Defaults to "1.0". +- `**additional_info` - Any additional Benchmark info to be saved. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark.py#L83) + +Return a string representation of the Benchmark instance. + +**Returns**: + +- `str` - A string in the format "<Benchmark name>". + +#### start + +```python +def start() -> BenchmarkJob +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark.py#L91) + +Start a new benchmark job (run) for the current benchmark. + +This method initiates a new benchmark job using the configured models, +datasets, and metrics. It communicates with the backend API to create +and start the job. + +**Returns**: + +- `BenchmarkJob` - A new BenchmarkJob instance representing the started job. + Returns None if the job creation fails. + + +**Raises**: + +- `Exception` - If there's an error creating or starting the benchmark job. + The error is logged and None is returned. + diff --git a/docs/api-reference/python/aixplain/v1/modules/benchmark_job.md b/docs/api-reference/python/aixplain/v1/modules/benchmark_job.md new file mode 100644 index 000000000..59f96661c --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/benchmark_job.md @@ -0,0 +1,193 @@ +--- +sidebar_label: benchmark_job +title: aixplain.v1.modules.benchmark_job +--- + +### BenchmarkJob Objects + +```python +class BenchmarkJob() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark_job.py#L12) + +Benchmark Job Represents a single run of an already created Benchmark. + +**Attributes**: + +- `id` _str_ - ID of the Benchmark Job. +- `status` _str_ - Status of the Benchmark Job. +- `benchmark_id` _str_ - ID of the associated parent Benchmark. +- `additional_info` _dict_ - Any additional information to be saved with the Benchmark Job. + +#### \_\_init\_\_ + +```python +def __init__(id: Text, status: Text, benchmark_id: Text, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark_job.py#L23) + +Create a Benchmark Job with the necessary information. Each Job is a run of a parent Benchmark + +**Arguments**: + +- `id` _Text_ - ID of the Benchmark Job +- `status` _Text_ - Status of the Benchmark Job +- `benchmark_id` _Text_ - ID of the associated parent Benchmark +- `**additional_info` - Any additional Benchmark Job info to be saved + +#### check\_status + +```python +def check_status() -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark_job.py#L81) + +Check the current status of the benchmark job. + +Fetches the latest status from the API and updates the local state. + +**Returns**: + +- `Text` - The current status of the benchmark job. + +#### download\_results\_as\_csv + +```python +def download_results_as_csv(save_path: Optional[Text] = None, + return_dataframe: bool = False) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark_job.py#L93) + +Get the results of the benchmark job in a CSV format. +The results can either be downloaded locally or returned in the form of pandas.DataFrame. + + +**Arguments**: + +- `save_path` _Text, optional_ - Path to save the CSV if return_dataframe is False. If None, a ranmdom path is generated. defaults to None. +- `return_dataframe` _bool_ - If True, the result is returned as pandas.DataFrame else saved as a CSV file. defaults to False. + + +**Returns**: + +- `str/pandas.DataFrame` - results as path of locally saved file if return_dataframe is False else as a pandas dataframe + +#### get\_scores + +```python +def get_scores( + return_simplified: bool = True, + return_as_dataframe: bool = True) -> Union[Dict, pd.DataFrame, list] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark_job.py#L149) + +Get the benchmark scores for all models. + +**Arguments**: + +- `return_simplified` _bool, optional_ - If True, returns a simplified version of scores. + Defaults to True. +- `return_as_dataframe` _bool, optional_ - If True and return_simplified is True, + returns results as a pandas DataFrame. Defaults to True. + + +**Returns**: + + Union[Dict, pd.DataFrame, list]: The benchmark scores in the requested format. + - If return_simplified=False: Returns a dictionary with detailed model scores + - If return_simplified=True and return_as_dataframe=True: Returns a pandas DataFrame + - If return_simplified=True and return_as_dataframe=False: Returns a list of dictionaries + + +**Raises**: + +- `Exception` - If there's an error fetching or processing the scores. + +#### get\_failuire\_rate + +```python +def get_failuire_rate( + return_as_dataframe: bool = True) -> Union[Dict, pd.DataFrame] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark_job.py#L199) + +Calculate the failure rate for each model in the benchmark. + +**Arguments**: + +- `return_as_dataframe` _bool, optional_ - If True, returns results as a pandas DataFrame. + Defaults to True. + + +**Returns**: + + Union[Dict, pd.DataFrame]: The failure rates for each model. + - If return_as_dataframe=True: Returns a DataFrame with 'Model' and 'Failure Rate' columns + - If return_as_dataframe=False: Returns a dictionary with model IDs as keys and failure rates as values + + +**Raises**: + +- `Exception` - If there's an error calculating the failure rates. + +#### get\_all\_explanations + +```python +def get_all_explanations() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark_job.py#L238) + +Get all explanations for the benchmark results. + +**Returns**: + +- `Dict` - A dictionary containing both metric-dependent and metric-independent explanations. + The dictionary has two keys: + - 'metricInDependent': List of metric-independent explanations + - 'metricDependent': List of metric-dependent explanations + + +**Raises**: + +- `Exception` - If there's an error fetching the explanations. + +#### get\_localized\_explanations + +```python +def get_localized_explanations(metric_dependant: bool, + group_by_task: bool = False) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/benchmark_job.py#L263) + +Get localized explanations for the benchmark results. + +**Arguments**: + +- `metric_dependant` _bool_ - If True, returns metric-dependent explanations. + If False, returns metric-independent explanations. +- `group_by_task` _bool, optional_ - If True and metric_dependant is True, + groups explanations by task. Defaults to False. + + +**Returns**: + +- `Dict` - A dictionary containing the localized explanations. + The structure depends on the input parameters: + - If metric_dependant=False: Returns metric-independent explanations + - If metric_dependant=True and group_by_task=False: Returns explanations grouped by score ID + - If metric_dependant=True and group_by_task=True: Returns explanations grouped by task + + +**Raises**: + +- `Exception` - If there's an error fetching or processing the explanations. + diff --git a/docs/api-reference/python/aixplain/v1/modules/content_interval.md b/docs/api-reference/python/aixplain/v1/modules/content_interval.md new file mode 100644 index 000000000..78d033351 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/content_interval.md @@ -0,0 +1,151 @@ +--- +sidebar_label: content_interval +title: aixplain.v1.modules.content_interval +--- + +#### \_\_author\_\_ + +Copyright 2023 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: aiXplain team +Date: June 6th 2023 +Description: + Content Interval + +### ContentInterval Objects + +```python +@dataclass +class ContentInterval() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/content_interval.py#L29) + +Base class for representing intervals or segments within content. + +This class serves as the base for more specific content interval types +like text, audio, image, and video intervals. + +**Attributes**: + +- `content` _Text_ - The actual content within the interval. +- `content_id` _int_ - ID of the content interval. + +### TextContentInterval Objects + +```python +@dataclass +class TextContentInterval(ContentInterval) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/content_interval.py#L45) + +Class representing an interval or segment within text content. + +This class extends ContentInterval to handle text-specific intervals, +supporting both character-based and line-column-based positions. + +**Attributes**: + +- `content` _Text_ - The text content within the interval. +- `content_id` _int_ - ID of the content interval. +- `start` _Union[int, Tuple[int, int]]_ - Starting position of the interval. + Can be either a character offset (int) or a line-column tuple (int, int). +- `end` _Union[int, Tuple[int, int]]_ - Ending position of the interval. + Can be either a character offset (int) or a line-column tuple (int, int). + +### AudioContentInterval Objects + +```python +@dataclass +class AudioContentInterval(ContentInterval) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/content_interval.py#L65) + +Class representing an interval or segment within audio content. + +This class extends ContentInterval to handle audio-specific intervals +using timestamps. + +**Attributes**: + +- `content` _Text_ - The audio content within the interval. +- `content_id` _int_ - ID of the content interval. +- `start_time` _float_ - Starting timestamp of the interval in seconds. +- `end_time` _float_ - Ending timestamp of the interval in seconds. + +### ImageContentInterval Objects + +```python +@dataclass +class ImageContentInterval(ContentInterval) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/content_interval.py#L83) + +Class representing an interval or region within image content. + +This class extends ContentInterval to handle image-specific regions, +supporting both single points and polygons through coordinates. + +**Attributes**: + +- `content` _Text_ - The image content within the interval. +- `content_id` _int_ - ID of the content interval. +- `x` _Union[float, List[float]]_ - X-coordinate(s) of the region. + Single float for rectangular regions, list for polygon vertices. +- `y` _Union[float, List[float]]_ - Y-coordinate(s) of the region. + Single float for rectangular regions, list for polygon vertices. +- `width` _Optional[float]_ - Width of the region in pixels. Only used for + rectangular regions. Defaults to None. +- `height` _Optional[float]_ - Height of the region in pixels. Only used for + rectangular regions. Defaults to None. +- `rotation` _Optional[float]_ - Rotation angle of the region in degrees. + Defaults to None. + +### VideoContentInterval Objects + +```python +@dataclass +class VideoContentInterval(ContentInterval) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/content_interval.py#L112) + +Class representing an interval or region within video content. + +This class extends ContentInterval to handle video-specific intervals, +combining temporal information with optional spatial regions. + +**Attributes**: + +- `content` _Text_ - The video content within the interval. +- `content_id` _int_ - ID of the content interval. +- `start_time` _float_ - Starting timestamp of the interval in seconds. +- `end_time` _float_ - Ending timestamp of the interval in seconds. +- `x` _Optional[Union[float, List[float]]], optional_ - X-coordinate(s) of the region. + Single float for rectangular regions, list for polygon vertices. + Defaults to None. +- `y` _Optional[Union[float, List[float]]], optional_ - Y-coordinate(s) of the region. + Single float for rectangular regions, list for polygon vertices. + Defaults to None. +- `width` _Optional[float], optional_ - Width of the region in pixels. + Only used for rectangular regions. Defaults to None. +- `height` _Optional[float], optional_ - Height of the region in pixels. + Only used for rectangular regions. Defaults to None. +- `rotation` _Optional[float], optional_ - Rotation angle of the region in degrees. + Defaults to None. + diff --git a/docs/api-reference/python/aixplain/v1/modules/corpus.md b/docs/api-reference/python/aixplain/v1/modules/corpus.md new file mode 100644 index 000000000..63a1fb81b --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/corpus.md @@ -0,0 +1,135 @@ +--- +sidebar_label: corpus +title: aixplain.v1.modules.corpus +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: February 1st 2023 +Description: + Corpus Class + +### Corpus Objects + +```python +class Corpus(Asset) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/corpus.py#L37) + +A class representing a general-purpose collection of data in the aiXplain platform. + +This class extends Asset to provide functionality for managing corpora, which are +collections of data that can be processed and used to create task-specific datasets. +A corpus can contain various types of data and is used as a foundation for creating +specialized datasets. + +**Attributes**: + +- `id` _Text_ - ID of the corpus. +- `name` _Text_ - Name of the corpus. +- `description` _Text_ - Detailed description of the corpus. +- `data` _List[Data]_ - List of data objects that make up the corpus. +- `onboard_status` _OnboardStatus_ - Current onboarding status of the corpus. +- `functions` _List[Function]_ - AI functions the corpus is suitable for. +- `tags` _List[Text]_ - Descriptive tags for the corpus. +- `license` _Optional[License]_ - License associated with the corpus. +- `privacy` _Privacy_ - Privacy settings for the corpus. +- `supplier` _Text_ - The supplier/author of the corpus. +- `name`0 _Text_ - Version of the corpus. +- `name`1 _Optional[int]_ - Number of rows/items in the corpus. + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text, + description: Text, + data: List[Data], + onboard_status: OnboardStatus, + functions: List[Function] = [], + tags: List[Text] = [], + license: Optional[License] = None, + privacy: Privacy = Privacy.PRIVATE, + supplier: Text = "aiXplain", + version: Text = "1.0", + length: Optional[int] = None, + **kwargs) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/corpus.py#L60) + +Corpus Class. + +Description: +Corpus is general-purpose collection of data that can be processed and used to create task-specific datasets. + +**Arguments**: + +- `id` _Text_ - Corpus ID +- `name` _Text_ - Corpus Name +- `description` _Text_ - description of the corpus +- `data` _List[Data]_ - List of data which the corpus consists of +- `onboard_status` _OnboardStatus_ - onboard status +- `functions` _List[Function], optional_ - AI functions in which the corpus is suggested to be used to. Defaults to []. +- `tags` _List[Text], optional_ - description tags. Defaults to []. +- `license` _Optional[License], optional_ - Corpus license. Defaults to None. +- `privacy` _Privacy, optional_ - Corpus privacy info. Defaults to Privacy.PRIVATE. +- `supplier` _Text, optional_ - Corpus supplier. Defaults to "aiXplain". +- `name`0 _Text, optional_ - Corpus version. Defaults to "1.0". +- `name`1 _Optional[int], optional_ - Number of rows in the Corpus. Defaults to None. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/corpus.py#L113) + +Return a string representation of the Corpus instance. + +**Returns**: + +- `str` - A string in the format "<Corpus: name>". + +#### delete + +```python +def delete() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/corpus.py#L121) + +Delete this corpus from the aiXplain platform. + +This method permanently removes the corpus from the platform. The operation +can only be performed by the corpus owner. + +**Returns**: + + None + + +**Raises**: + +- `Exception` - If the deletion fails, either because: + - The corpus doesn't exist + - The user is not the owner + - There's a network/server error + diff --git a/docs/api-reference/python/aixplain/v1/modules/data.md b/docs/api-reference/python/aixplain/v1/modules/data.md new file mode 100644 index 000000000..83ed02f31 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/data.md @@ -0,0 +1,101 @@ +--- +sidebar_label: data +title: aixplain.v1.modules.data +--- + +#### \_\_author\_\_ + +Copyright 2022 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: aiXplain team +Date: March 20th 2023 +Description: + Data Class + +### Data Objects + +```python +class Data() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/data.py#L33) + +A class representing a collection of data samples of the same type and genre. + +This class provides functionality for managing data in the aiXplain platform, +supporting various data types, languages, and storage formats. It can handle +both structured (e.g., CSV) and unstructured data files. + +**Attributes**: + +- `id` _Text_ - ID of the data collection. +- `name` _Text_ - Name of the data collection. +- `dtype` _DataType_ - Type of data (e.g., text, audio, image). +- `privacy` _Privacy_ - Privacy settings for the data. +- `onboard_status` _OnboardStatus_ - Current onboarding status. +- `data_column` _Optional[Any]_ - Column identifier where data is stored in structured files. +- `start_column` _Optional[Any]_ - Column identifier for start indexes in structured files. +- `end_column` _Optional[Any]_ - Column identifier for end indexes in structured files. +- `files` _List[File]_ - List of files containing the data instances. +- `languages` _List[Language]_ - List of languages present in the data. +- `name`0 _DataSubtype_ - Subtype categorization of the data. +- `name`1 _Optional[int]_ - Number of samples/rows in the data collection. +- `name`2 _dict_ - Additional keyword arguments for extensibility. + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text, + dtype: DataType, + privacy: Privacy, + onboard_status: OnboardStatus, + data_column: Optional[Any] = None, + start_column: Optional[Any] = None, + end_column: Optional[Any] = None, + files: List[File] = [], + languages: List[Language] = [], + dsubtype: DataSubtype = DataSubtype.OTHER, + length: Optional[int] = None, + **kwargs) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/data.py#L56) + +Initialize a new Data instance. + +**Arguments**: + +- `id` _Text_ - ID of the data collection. +- `name` _Text_ - Name of the data collection. +- `dtype` _DataType_ - Type of data (e.g., text, audio, image). +- `privacy` _Privacy_ - Privacy settings for the data. +- `onboard_status` _OnboardStatus_ - Current onboarding status of the data. +- `data_column` _Optional[Any], optional_ - Column identifier where data is stored in + structured files (e.g., CSV). If None, defaults to the value of name. +- `start_column` _Optional[Any], optional_ - Column identifier where start indexes are + stored in structured files. Defaults to None. +- `end_column` _Optional[Any], optional_ - Column identifier where end indexes are + stored in structured files. Defaults to None. +- `files` _List[File], optional_ - List of files containing the data instances. + Defaults to empty list. +- `languages` _List[Language], optional_ - List of languages present in the data. + Can be provided as Language enums or language codes. Defaults to empty list. +- `name`0 _DataSubtype, optional_ - Subtype categorization of the data + (e.g., age, topic, race, split). Defaults to DataSubtype.OTHER. +- `name`1 _Optional[int], optional_ - Number of samples/rows in the data collection. + Defaults to None. +- `name`2 - Additional keyword arguments for extensibility. + diff --git a/docs/api-reference/python/aixplain/v1/modules/dataset.md b/docs/api-reference/python/aixplain/v1/modules/dataset.md new file mode 100644 index 000000000..1c3198e8a --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/dataset.md @@ -0,0 +1,144 @@ +--- +sidebar_label: dataset +title: aixplain.v1.modules.dataset +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: October 28th 2022 +Description: + Datasets Class + +### Dataset Objects + +```python +class Dataset(Asset) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/dataset.py#L38) + +Dataset is a collection of data intended to be used for a specific function. +Different from corpus, a dataset is a representative sample of a specific phenomenon to a specific AI task. +aiXplain also counts with an extensive collection of datasets for training, infer and benchmark various tasks like +Translation, Speech Recognition, Diacritization, Sentiment Analysis, and much more. + +**Attributes**: + +- `id` _Text_ - Dataset ID +- `name` _Text_ - Dataset Name +- `description` _Text_ - Dataset description +- `function` _Function_ - Function for which the dataset is intented to +- `source_data` _Dict[Any, Data]_ - List of input Data to the function +- `target_data` _Dict[Any, List[Data]]_ - List of Multi-reference Data which is expected to be outputted by the function +- `onboard_status` _OnboardStatus_ - onboard status +- `hypotheses` _Dict[Any, Data], optional_ - dataset's hypotheses, i.e. model outputs based on the source data. Defaults to \{}. +- `metadata` _Dict[Any, Data], optional_ - dataset's metadata. Defaults to \{}. +- `tags` _List[Text], optional_ - tags that describe the dataset. Defaults to []. +- `name`0 _Optional[License], optional_ - Dataset License. Defaults to None. +- `name`1 _Privacy, optional_ - Dataset Privacy. Defaults to Privacy.PRIVATE. +- `name`2 _Text, optional_ - Dataset Supplier. Defaults to "aiXplain". +- `name`3 _Text, optional_ - Dataset Version. Defaults to "1.0". + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text, + description: Text, + function: Function, + source_data: Dict[Any, Data], + target_data: Dict[Any, List[Data]], + onboard_status: OnboardStatus, + hypotheses: Dict[Any, Data] = {}, + metadata: Dict[Any, Data] = {}, + tags: List[Text] = [], + license: Optional[License] = None, + privacy: Privacy = Privacy.PRIVATE, + supplier: Text = "aiXplain", + version: Text = "1.0", + length: Optional[int] = None, + **kwargs) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/dataset.py#L61) + +Dataset Class. + +Description: +Dataset is a collection of data intended to be used for a specific function. +Different from corpus, a dataset is a representative sample of a specific phenomenon to a specific AI task. +aiXplain also counts with an extensive collection of datasets for training, infer and benchmark various tasks like +Translation, Speech Recognition, Diacritization, Sentiment Analysis, and much more. + +**Arguments**: + +- `id` _Text_ - Dataset ID +- `name` _Text_ - Dataset Name +- `description` _Text_ - Dataset description +- `function` _Function_ - Function for which the dataset is intented to +- `source_data` _Dict[Any, Data]_ - List of input Data to the function +- `target_data` _Dict[Any, List[Data]]_ - List of Multi-reference Data which is expected to be outputted by the function +- `onboard_status` _OnboardStatus_ - onboard status +- `hypotheses` _Dict[Any, Data], optional_ - dataset's hypotheses, i.e. model outputs based on the source data. Defaults to \{}. +- `metadata` _Dict[Any, Data], optional_ - dataset's metadata. Defaults to \{}. +- `tags` _List[Text], optional_ - tags that describe the dataset. Defaults to []. +- `name`0 _Optional[License], optional_ - Dataset License. Defaults to None. +- `name`1 _Privacy, optional_ - Dataset Privacy. Defaults to Privacy.PRIVATE. +- `name`2 _Text, optional_ - Dataset Supplier. Defaults to "aiXplain". +- `name`3 _Text, optional_ - Dataset Version. Defaults to "1.0". +- `name`4 _Optional[int], optional_ - Number of rows in the Dataset. Defaults to None. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/dataset.py#L126) + +Return a string representation of the Dataset instance. + +**Returns**: + +- `str` - A string in the format "<Dataset: name>". + +#### delete + +```python +def delete() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/dataset.py#L134) + +Delete this dataset from the aiXplain platform. + +This method permanently removes the dataset from the platform. The operation +can only be performed by the dataset owner. + +**Returns**: + + None + + +**Raises**: + +- `Exception` - If the deletion fails, either because: + - The dataset doesn't exist + - The user is not the owner + - There's a network/server error + diff --git a/docs/api-reference/python/aixplain/v1/modules/file.md b/docs/api-reference/python/aixplain/v1/modules/file.md new file mode 100644 index 000000000..7a6d0482f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/file.md @@ -0,0 +1,67 @@ +--- +sidebar_label: file +title: aixplain.v1.modules.file +--- + +#### \_\_author\_\_ + +Copyright 2022 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: aiXplain team +Date: March 20th 2023 +Description: + File Class + +### File Objects + +```python +class File() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/file.py#L31) + +A class representing a file in the aiXplain platform. + +This class provides functionality for managing files, which are used to store +data samples in the platform. It supports various file types, compression formats, +and data splits. + +**Attributes**: + +- `path` _Union[Text, pathlib.Path]_ - File path +- `extension` _Union[Text, FileType]_ - File extension (e.g. CSV, TXT, etc.) +- `data_split` _Optional[DataSplit]_ - Data split of the file. +- `compression` _Optional[Text]_ - Compression extension (e.g., .gz). + +#### \_\_init\_\_ + +```python +def __init__(path: Union[Text, pathlib.Path], + extension: Union[Text, FileType], + data_split: Optional[DataSplit] = None, + compression: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/file.py#L45) + +Initialize a new File instance. + +**Arguments**: + +- `path` _Union[Text, pathlib.Path]_ - File path +- `extension` _Union[Text, FileType]_ - File extension (e.g. CSV, TXT, etc.) +- `data_split` _Optional[DataSplit], optional_ - Data split of the file. Defaults to None. +- `compression` _Optional[Text], optional_ - Compression extension (e.g., .gz). Defaults to None. + diff --git a/docs/api-reference/python/aixplain/v1/modules/finetune/cost.md b/docs/api-reference/python/aixplain/v1/modules/finetune/cost.md new file mode 100644 index 000000000..917b8c806 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/finetune/cost.md @@ -0,0 +1,76 @@ +--- +sidebar_label: cost +title: aixplain.v1.modules.finetune.cost +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: June 14th 2023 +Description: + FinetuneCost Class + +### FinetuneCost Objects + +```python +class FinetuneCost() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/cost.py#L27) + +A class representing the cost structure for a fine-tuning job. + +This class encapsulates the cost information for training, inference, and hosting +components of a fine-tuning job. It provides methods to convert the cost data +into a dictionary format for serialization. + +**Attributes**: + +- `training` _Dict_ - Dictionary containing training cost information. +- `inference` _Dict_ - Dictionary containing inference cost information. +- `hosting` _Dict_ - Dictionary containing hosting cost information. + +#### \_\_init\_\_ + +```python +def __init__(training: Dict, inference: Dict, hosting: Dict) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/cost.py#L40) + +Create a FinetuneCost object with training, inference, and hosting cost information. + +**Arguments**: + +- `training` _Dict_ - Dictionary containing training cost information. +- `inference` _Dict_ - Dictionary containing inference cost information. +- `hosting` _Dict_ - Dictionary containing hosting cost information. + +#### to\_dict + +```python +def to_dict() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/cost.py#L57) + +Convert the FinetuneCost object to a dictionary. + +**Returns**: + +- `Dict` - A dictionary representation of the FinetuneCost object. + diff --git a/docs/api-reference/python/aixplain/v1/modules/finetune/hyperparameters.md b/docs/api-reference/python/aixplain/v1/modules/finetune/hyperparameters.md new file mode 100644 index 000000000..5babc3e90 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/finetune/hyperparameters.md @@ -0,0 +1,76 @@ +--- +sidebar_label: hyperparameters +title: aixplain.v1.modules.finetune.hyperparameters +--- + +### SchedulerType Objects + +```python +class SchedulerType(Text, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/hyperparameters.py#L7) + +Enum representing different learning rate schedulers. + +This enum defines the possible learning rate schedulers that can be used +in the fine-tuning process. Each scheduler is represented by a string constant. + +**Attributes**: + +- `LINEAR` _Text_ - Linear learning rate scheduler. +- `COSINE` _Text_ - Cosine learning rate scheduler. +- `COSINE_WITH_RESTARTS` _Text_ - Cosine with restarts learning rate scheduler. +- `POLYNOMIAL` _Text_ - Polynomial learning rate scheduler. +- `CONSTANT` _Text_ - Constant learning rate scheduler. +- `CONSTANT_WITH_WARMUP` _Text_ - Constant with warmup learning rate scheduler. +- `INVERSE_SQRT` _Text_ - Inverse square root learning rate scheduler. +- `REDUCE_ON_PLATEAU` _Text_ - Reduce learning rate on plateau learning rate scheduler. + +### Hyperparameters Objects + +```python +@dataclass_json + +@dataclass +class Hyperparameters(object) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/hyperparameters.py#L41) + +Configuration for the fine-tuning process. + +This class encapsulates the hyperparameters for training a model using a +fine-tuning approach. It includes settings for epochs, batch sizes, learning +rates, sequence lengths, and learning rate schedulers. + +**Attributes**: + +- `epochs` _int_ - Number of training epochs. +- `train_batch_size` _int_ - Batch size for training. +- `eval_batch_size` _int_ - Batch size for evaluation. +- `learning_rate` _float_ - Learning rate for training. +- `max_seq_length` _int_ - Maximum sequence length for model inputs. +- `warmup_ratio` _float_ - Warmup ratio for learning rate scheduler. +- `warmup_steps` _int_ - Number of warmup steps for learning rate scheduler. +- `lr_scheduler_type` _SchedulerType_ - Type of learning rate scheduler. + +#### \_\_post\_init\_\_ + +```python +def __post_init__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/hyperparameters.py#L68) + +Post-initialization validation for the hyperparameters. + +This method performs validation checks on the hyperparameters after +initialization. It ensures that the provided values are of the correct +types and within the allowed ranges. + +**Raises**: + +- `TypeError` - If the provided values are not of the correct types. +- `ValueError` - If the provided values are outside the allowed ranges. + diff --git a/docs/api-reference/python/aixplain/v1/modules/finetune/init.md b/docs/api-reference/python/aixplain/v1/modules/finetune/init.md new file mode 100644 index 000000000..5ef426c3f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/finetune/init.md @@ -0,0 +1,129 @@ +--- +sidebar_label: finetune +title: aixplain.v1.modules.finetune +--- + +#### \_\_author\_\_ + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: June 14th 2023 +Description: + FineTune Class + +### Finetune Objects + +```python +class Finetune(Asset) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/__init__.py#L37) + +A tool for fine-tuning machine learning models using custom datasets. + +This class provides functionality to customize pre-trained models for specific tasks +by fine-tuning them on user-provided datasets. It handles the configuration of +training parameters, data splitting, and job execution. + +**Attributes**: + +- `name` _Text_ - Name of the fine-tuning job. +- `dataset_list` _List[Dataset]_ - List of datasets to use for fine-tuning. +- `model` _Model_ - The base model to be fine-tuned. +- `cost` _FinetuneCost_ - Cost information for the fine-tuning job. +- `id` _Text_ - ID of the fine-tuning job. +- `description` _Text_ - Detailed description of the fine-tuning purpose. +- `supplier` _Text_ - Provider/creator of the fine-tuned model. +- `version` _Text_ - Version identifier of the fine-tuning job. +- `train_percentage` _float_ - Percentage of data to use for training. +- `dev_percentage` _float_ - Percentage of data to use for validation. +- `dataset_list`0 _Text_ - Template for formatting training examples, using + <<COLUMN_NAME>> to reference dataset columns. +- `dataset_list`1 _Hyperparameters_ - Configuration for the fine-tuning process. +- `dataset_list`2 _dict_ - Extra metadata for the fine-tuning job. +- `dataset_list`3 _str_ - URL endpoint for the backend API. +- `dataset_list`4 _str_ - Authentication key for API access. +- `dataset_list`5 _str_ - aiXplain-specific API key. + +#### \_\_init\_\_ + +```python +def __init__(name: Text, + dataset_list: List[Dataset], + model: Model, + cost: FinetuneCost, + id: Optional[Text] = "", + description: Optional[Text] = "", + supplier: Optional[Text] = "aiXplain", + version: Optional[Text] = "1.0", + train_percentage: Optional[float] = 100, + dev_percentage: Optional[float] = 0, + prompt_template: Optional[Text] = None, + hyperparameters: Optional[Hyperparameters] = None, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/__init__.py#L64) + +Initialize a new Finetune instance. + +**Arguments**: + +- `name` _Text_ - Name of the fine-tuning job. +- `dataset_list` _List[Dataset]_ - List of datasets to use for fine-tuning. +- `model` _Model_ - The base model to be fine-tuned. +- `cost` _FinetuneCost_ - Cost information for the fine-tuning job. +- `id` _Text, optional_ - ID of the job. Defaults to "". +- `description` _Text, optional_ - Detailed description of the fine-tuning + purpose. Defaults to "". +- `supplier` _Text, optional_ - Provider/creator of the fine-tuned model. + Defaults to "aiXplain". +- `version` _Text, optional_ - Version identifier. Defaults to "1.0". +- `train_percentage` _float, optional_ - Percentage of data to use for + training. Defaults to 100. +- `dev_percentage` _float, optional_ - Percentage of data to use for + validation. Defaults to 0. +- `dataset_list`0 _Text, optional_ - Template for formatting training + examples. Use <<COLUMN_NAME>> to reference dataset columns. + Defaults to None. +- `dataset_list`1 _Hyperparameters, optional_ - Configuration for the + fine-tuning process. Defaults to None. +- `dataset_list`2 - Extra metadata for the fine-tuning job. + +#### start + +```python +def start() -> Model +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/__init__.py#L117) + +Start the fine-tuning job on the backend. + +This method submits the fine-tuning configuration to the backend and initiates +the training process. It handles the creation of the training payload, +including dataset splits and hyperparameters. + +**Returns**: + +- `Model` - The model object representing the fine-tuning job. Returns None + if the job submission fails. + + +**Raises**: + +- `Exception` - If there are errors in the API request or response handling. + diff --git a/docs/api-reference/python/aixplain/v1/modules/finetune/status.md b/docs/api-reference/python/aixplain/v1/modules/finetune/status.md new file mode 100644 index 000000000..133b24618 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/finetune/status.md @@ -0,0 +1,50 @@ +--- +sidebar_label: status +title: aixplain.v1.modules.finetune.status +--- + +#### \_\_author\_\_ + +Copyright 2024 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: February 21st 2024 +Description: + FinetuneCost Class + +### FinetuneStatus Objects + +```python +@dataclass_json + +@dataclass +class FinetuneStatus(object) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/finetune/status.py#L32) + +Status information for a fine-tuning job. + +This class encapsulates the status of a fine-tuning job, including the overall +status of the job, the status of the model, and various training metrics. + +**Attributes**: + +- `status` _AssetStatus_ - Overall status of the fine-tuning job. +- `model_status` _AssetStatus_ - Status of the fine-tuned model. +- `epoch` _Optional[float]_ - Current training epoch. +- `training_loss` _Optional[float]_ - Training loss at the current epoch. +- `validation_loss` _Optional[float]_ - Validation loss at the current epoch. + diff --git a/docs/api-reference/python/aixplain/v1/modules/init.md b/docs/api-reference/python/aixplain/v1/modules/init.md new file mode 100644 index 000000000..d44f26ab5 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/init.md @@ -0,0 +1,25 @@ +--- +sidebar_label: modules +title: aixplain.v1.modules +--- + +aiXplain SDK Library. +--- + +aiXplain SDK enables python programmers to add AI functions +to their software. + +Copyright 2022 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. + diff --git a/docs/api-reference/python/aixplain/v1/modules/metadata.md b/docs/api-reference/python/aixplain/v1/modules/metadata.md new file mode 100644 index 000000000..a67757cd0 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/metadata.md @@ -0,0 +1,90 @@ +--- +sidebar_label: metadata +title: aixplain.v1.modules.metadata +--- + +#### \_\_author\_\_ + +Copyright 2022 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: aiXplain team +Date: March 20th 2023 +Description: + Meta-data Class + +### MetaData Objects + +```python +class MetaData() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/metadata.py#L33) + +A class representing metadata for data in the aiXplain platform. + +This class provides functionality for managing metadata, which is used to store +information about data in the platform. It supports various data types, languages, +and storage formats. + +**Attributes**: + +- `name` _Text_ - Name of the data. +- `dtype` _DataType_ - Type of data. +- `storage_type` _StorageType_ - Storage type of the data. +- `data_column` _Optional[Text]_ - Column index/name where the data is on a structured file. +- `start_column` _Optional[Text]_ - Column index/name where the start indexes is on a structured file. +- `end_column` _Optional[Text]_ - Column index/name where the end indexes is on a structured file. +- `privacy` _Optional[Privacy]_ - Privacy of data. +- `file_extension` _Optional[FileType]_ - File extension (e.g. CSV, TXT, etc.). +- `languages` _List[Language]_ - List of languages which the data consists of. +- `dsubtype` _DataSubtype_ - Data subtype (e.g., age, topic, race, split, etc.), used in datasets metadata. +- `dtype`0 _Optional[Text]_ - Data ID. +- `dtype`1 _dict_ - Additional keyword arguments for extensibility. + +#### \_\_init\_\_ + +```python +def __init__(name: Text, + dtype: DataType, + storage_type: StorageType, + data_column: Optional[Text] = None, + start_column: Optional[Text] = None, + end_column: Optional[Text] = None, + privacy: Optional[Privacy] = None, + file_extension: Optional[FileType] = None, + languages: List[Language] = [], + dsubtype: DataSubtype = DataSubtype.OTHER, + id: Optional[Text] = None, + **kwargs) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/metadata.py#L55) + +Initialize a new MetaData instance. + +**Arguments**: + +- `name` _Text_ - Data Name +- `dtype` _DataType_ - Data Type +- `storage_type` _StorageType_ - Data Storage (e.g. text, local file, web link) +- `data_column` _Optional[Text], optional_ - Column index/name where the data is on a structured file (e.g. CSV). Defaults to None. +- `start_column` _Optional[Text], optional_ - Column index/name where the start indexes is on a structured file (e.g. CSV). Defaults to None. +- `end_column` _Optional[Text], optional_ - Column index/name where the end indexes is on a structured file (e.g. CSV). Defaults to None. +- `privacy` _Optional[Privacy], optional_ - Privacy of data. Defaults to None. +- `file_extension` _Optional[FileType], optional_ - File extension (e.g. CSV, TXT, etc.). Defaults to None. +- `languages` _List[Language], optional_ - List of languages which the data consists of. Defaults to []. +- `dsubtype` _DataSubtype, optional_ - Data subtype (e.g., age, topic, race, split, etc.), used in datasets metadata. Defaults to Other. +- `dtype`0 _Optional[Text], optional_ - Data ID. Defaults to None. + diff --git a/docs/api-reference/python/aixplain/v1/modules/metric.md b/docs/api-reference/python/aixplain/v1/modules/metric.md new file mode 100644 index 000000000..ea69c3f40 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/metric.md @@ -0,0 +1,154 @@ +--- +sidebar_label: metric +title: aixplain.v1.modules.metric +--- + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: October 25th 2022 +Description: + Metric Class + +### Metric Objects + +```python +class Metric(Asset) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/metric.py#L26) + +A class representing a metric for evaluating machine learning model outputs. + +This class extends Asset to provide functionality for computing evaluation metrics +on one or more pieces of data. Each metric is typically associated with a specific +machine learning task and can require different inputs (e.g., reference text for +translation metrics). + +**Attributes**: + +- `id` _Text_ - ID of the metric. +- `name` _Text_ - Name of the metric. +- `supplier` _Text_ - Author/provider of the metric. +- `is_reference_required` _bool_ - Whether the metric requires reference data. +- `is_source_required` _bool_ - Whether the metric requires source data. +- `cost` _float_ - Cost per metric computation. +- `function` _Text_ - The function identifier for this metric. +- `normalization_options` _list_ - List of available normalization options. +- `description` _Text_ - Description of the metric. +- `version` _Text_ - Version of the metric implementation. +- `name`0 _dict_ - Additional metric-specific information. + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text, + supplier: Text, + is_reference_required: bool, + is_source_required: bool, + cost: float, + function: Text, + normalization_options: list = [], + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/metric.py#L48) + +Initialize a new Metric instance. + +**Arguments**: + +- `id` _Text_ - ID of the metric. +- `name` _Text_ - Name of the metric. +- `supplier` _Text_ - Author/provider of the metric. +- `is_reference_required` _bool_ - Whether the metric requires reference data for computation. +- `is_source_required` _bool_ - Whether the metric requires source data for computation. +- `cost` _float_ - Cost per metric computation. +- `function` _Text_ - The function identifier for this metric. +- `normalization_options` _list, optional_ - List of available normalization options. + Defaults to empty list. +- `**additional_info` - Additional metric-specific information to be stored. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/metric.py#L81) + +Return a string representation of the Metric instance. + +**Returns**: + +- `str` - A string in the format "<Metric name>". + +#### add\_normalization\_options + +```python +def add_normalization_options(normalization_options: List[str]) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/metric.py#L89) + +Add normalization options to be used during metric computation. + +This method appends new normalization options to the existing list of options. +These options can be used to normalize inputs or outputs during benchmarking. + +**Arguments**: + +- `normalization_options` _List[str]_ - List of normalization options to add. + Each option should be a valid normalization identifier. + +#### run + +```python +def run(hypothesis: Optional[Union[str, List[str]]] = None, + source: Optional[Union[str, List[str]]] = None, + reference: Optional[Union[str, List[str]]] = None) -> dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/metric.py#L101) + +Run the metric to calculate scores for the provided inputs. + +This method computes metric scores based on the provided hypothesis, and optionally +source and reference data. The inputs can be either single strings or lists of strings. + +**Arguments**: + +- `hypothesis` _Optional[Union[str, List[str]]], optional_ - The hypothesis/output to evaluate. + Can be a single string or a list of strings. Defaults to None. +- `source` _Optional[Union[str, List[str]]], optional_ - The source data for evaluation. + Only used if is_source_required is True. Can be a single string or a list + of strings. Defaults to None. +- `reference` _Optional[Union[str, List[str]]], optional_ - The reference data for evaluation. + Only used if is_reference_required is True. Can be a single string or a list + of strings. Defaults to None. + + +**Returns**: + +- `dict` - A dictionary containing the computed metric scores and any additional + computation metadata. + + +**Notes**: + + The method automatically handles conversion of single strings to lists and + proper formatting of references for multi-reference scenarios. + diff --git a/docs/api-reference/python/aixplain/v1/modules/mixins.md b/docs/api-reference/python/aixplain/v1/modules/mixins.md new file mode 100644 index 000000000..51872f60c --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/mixins.md @@ -0,0 +1,63 @@ +--- +sidebar_label: mixins +title: aixplain.v1.modules.mixins +--- + +Mixins for common functionality across different asset types. + +Copyright 2024 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: Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: November 25th 2024 +Description: + Mixins for common functionality across different asset types + +### DeployableMixin Objects + +```python +class DeployableMixin(ABC, Generic[T]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/mixins.py#L31) + +A mixin that provides common deployment-related functionality for assets. + +This mixin provides methods for: +1. Filtering items that are not onboarded +2. Validating if an asset is ready to be deployed +3. Deploying an asset + +Classes that inherit from this mixin should: +1. Implement _validate_deployment_readiness to call the parent implementation with their specific asset type +2. Optionally override deploy() if they need special deployment handling + +#### deploy + +```python +def deploy() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/mixins.py#L62) + +Deploy the asset. + +This method validates that the asset is ready to be deployed and updates its status to ONBOARDED. +Classes that need special deployment handling should override this method. + +**Raises**: + +- `AlreadyDeployedError` - If the asset is already deployed +- `ValueError` - If the asset is not ready to be deployed + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/connection.md b/docs/api-reference/python/aixplain/v1/modules/model/connection.md new file mode 100644 index 000000000..4b4645916 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/connection.md @@ -0,0 +1,206 @@ +--- +sidebar_label: connection +title: aixplain.v1.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 + +```python +class ConnectAction() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/connection.py#L28) + +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\_\_ + +```python +def __init__(name: Text, + description: Text, + code: Optional[Text] = None, + inputs: Optional[Dict] = None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/connection.py#L46) + +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\_\_ + +```python +def __repr__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/connection.py#L66) + +Return a string representation of the ConnectAction instance. + +**Returns**: + +- `str` - A string in the format "Action(code=<code>, name=<name>)". + +### ConnectionTool Objects + +```python +class ConnectionTool(Model) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/connection.py#L75) + +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\_\_ + +```python +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]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/connection.py#L88) + +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. +- `name`0 - Any additional Connection info to be saved + +#### get\_action\_inputs + +```python +def get_action_inputs(action: Union[ConnectAction, Text]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/connection.py#L161) + +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 + +```python +def run(action: Union[ConnectAction, Text], inputs: Dict) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/connection.py#L197) + +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 + +```python +def get_parameters() -> List[Dict] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/connection.py#L212) + +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. Returns an empty list if action_scope + is not set or is empty. + +#### \_\_repr\_\_ + +```python +def __repr__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/connection.py#L237) + +Return a string representation of the ConnectionTool instance. + +**Returns**: + +- `str` - A string in the format "ConnectionTool(id=<id>, name=<name>)". + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/index_model.md b/docs/api-reference/python/aixplain/v1/modules/model/index_model.md new file mode 100644 index 000000000..be0577dda --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/index_model.md @@ -0,0 +1,460 @@ +--- +sidebar_label: index_model +title: aixplain.v1.modules.model.index_model +--- + +Index model module for document indexing and search operations. + +### IndexFilterOperator Objects + +```python +class IndexFilterOperator(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L20) + +Enumeration of operators available for filtering index records. + +This enum defines the comparison operators that can be used when creating +filters for searching and retrieving records from an index. + +**Attributes**: + +- `EQUALS` _str_ - Equality operator ("==") +- `NOT_EQUALS` _str_ - Inequality operator ("!=") +- `CONTAINS` _str_ - Membership test operator ("in") +- `NOT_CONTAINS` _str_ - Negative membership test operator ("not in") +- `GREATER_THAN` _str_ - Greater than operator (">") +- `LESS_THAN` _str_ - Less than operator ("<") +- `GREATER_THAN_OR_EQUALS` _str_ - Greater than or equal to operator (">=") +- `LESS_THAN_OR_EQUALS` _str_ - Less than or equal to operator ("<=") + +### IndexFilter Objects + +```python +class IndexFilter() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L47) + +A class representing a filter for querying index records. + +This class defines a filter that can be used to search or retrieve records from an index +based on specific field values and comparison operators. + +**Attributes**: + +- `field` _str_ - The name of the field to filter on. +- `value` _str_ - The value to compare against. +- `operator` _Union[IndexFilterOperator, str]_ - The comparison operator to use. + +#### \_\_init\_\_ + +```python +def __init__(field: str, value: str, operator: Union[IndexFilterOperator, + str]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L63) + +Initialize a new IndexFilter instance. + +**Arguments**: + +- `field` _str_ - The name of the field to filter on. +- `value` _str_ - The value to compare against. +- `operator` _Union[IndexFilterOperator, str]_ - The comparison operator to use. + +#### to\_dict + +```python +def to_dict() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L75) + +Convert the filter to a dictionary representation. + +**Returns**: + +- `dict` - A dictionary containing the filter's field, value, and operator. + The operator is converted to its string value if it's an IndexFilterOperator. + +### Splitter Objects + +```python +class Splitter() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L89) + +A class for configuring how documents should be split during indexing. + +This class provides options for splitting documents into smaller chunks before +they are indexed, which can be useful for large documents or for specific +search requirements. + +**Attributes**: + +- `split` _bool_ - Whether to split the documents or not. +- `split_by` _SplittingOptions_ - The method to use for splitting (e.g., by word, sentence). +- `split_length` _int_ - The length of each split chunk. +- `split_overlap` _int_ - The number of overlapping units between consecutive chunks. + +#### \_\_init\_\_ + +```python +def __init__(split: bool = False, + split_by: SplittingOptions = SplittingOptions.WORD, + split_length: int = 1, + split_overlap: int = 0) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L103) + +Initialize a new Splitter instance. + +**Arguments**: + +- `split` _bool, optional_ - Whether to split the documents. Defaults to False. +- `split_by` _SplittingOptions, optional_ - The method to use for splitting. + Defaults to SplittingOptions.WORD. +- `split_length` _int, optional_ - The length of each split chunk. Defaults to 1. +- `split_overlap` _int, optional_ - The number of overlapping units between + consecutive chunks. Defaults to 0. + +### IndexModel Objects + +```python +class IndexModel(Model) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L126) + +A model for indexing and searching documents using vector embeddings. + +#### \_\_init\_\_ + +```python +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, + embedding_model: Union[EmbeddingModel, str] = None, + function_type: Optional[FunctionType] = FunctionType.SEARCH, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L129) + +Initialize a new IndexModel instance. + +**Arguments**: + +- `id` _Text_ - ID of the Index Model. +- `name` _Text_ - Name of the Index Model. +- `description` _Text, optional_ - Description of the Index Model. Defaults to "". +- `api_key` _Text, optional_ - API key of the Index Model. Defaults to None. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - Supplier of the Index Model. Defaults to "aiXplain". +- `version` _Text, optional_ - Version of the Index Model. Defaults to "1.0". +- `function` _Function, optional_ - Function of the Index Model. Must be Function.SEARCH. +- `is_subscribed` _bool, optional_ - Whether the user is subscribed. Defaults to False. +- `cost` _Dict, optional_ - Cost of the Index Model. Defaults to None. +- `embedding_model` _Union[EmbeddingModel, str], optional_ - Model used for embedding documents. Defaults to None. +- `name`0 _FunctionType, optional_ - Type of the function. Defaults to FunctionType.SEARCH. +- `name`1 - Any additional Index Model info to be saved. + + +**Raises**: + +- `name`2 - If function is not Function.SEARCH. + +#### to\_dict + +```python +def to_dict() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L190) + +Convert the IndexModel instance to a dictionary representation. + +**Returns**: + +- `Dict` - A dictionary containing the model's attributes, including: + - All attributes from the parent Model class + - embedding_model: The model used for embedding documents + - embedding_size: The size of the embeddings produced + - collection_type: The type of collection derived from the version + +#### search + +```python +def search(query: str, + top_k: int = 10, + filters: List[IndexFilter] = [], + score_threshold: float = 0.0) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L206) + +Search for documents in the index. + +**Arguments**: + +- `query` _str_ - Query to be searched +- `top_k` _int, optional_ - Number of results to be returned. Defaults to 10. +- `filters` _List[IndexFilter], optional_ - Filters to be applied. Defaults to []. +- `score_threshold` _float, optional_ - Minimum score threshold for results. Results with + scores below this threshold will be filtered out. Defaults to 0.0. + + +**Returns**: + +- `ModelResponse` - Response from the indexing service + + +**Example**: + + - index_model.search("Hello") + - index_model.search("Hello", score_threshold=0.5) + - index_model.search("", filters=[IndexFilter(field="category", value="animate", operator=IndexFilterOperator.EQUALS)]) + +#### upsert + +```python +def upsert(documents: Union[List[Record], str], + splitter: Optional[Splitter] = None) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L244) + +Upsert documents into the index. + +**Arguments**: + +- `documents` _Union[List[Record], str]_ - List of documents to be upserted or a file path +- `splitter` _Splitter, optional_ - Splitter to be applied. Defaults to None. + + +**Returns**: + +- `ModelResponse` - Response from the indexing service + + +**Examples**: + + index_model.upsert([Record(value="Hello, world!", value_type="text", uri="", id="1", attributes=\{})]) + index_model.upsert([Record(value="Hello, world!", value_type="text", uri="", id="1", attributes=\{})], splitter=Splitter(split=True, split_by=SplittingOptions.WORD, split_length=1, split_overlap=0)) + index_model.upsert("my_file.pdf") + index_model.upsert("my_file.pdf", splitter=Splitter(split=True, split_by=SplittingOptions.WORD, split_length=400, split_overlap=50)) + Splitter in the above example is optional and can be used to split the documents into smaller chunks. + +#### count + +```python +def count() -> int +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L289) + +Get the total number of documents in the index. + +**Returns**: + +- `float` - The number of documents in the index. + + +**Raises**: + +- `Exception` - If the count operation fails. + + +**Example**: + + >>> index_model.count() + 42 + +#### get\_record + +```python +def get_record(record_id: Text) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L308) + +Get a document from the index. + +**Arguments**: + +- `record_id` _Text_ - ID of the document to retrieve. + + +**Returns**: + +- `ModelResponse` - Response containing the retrieved document data. + + +**Raises**: + +- `Exception` - If document retrieval fails. + + +**Example**: + + >>> index_model.get_record("123") + +#### delete\_record + +```python +def delete_record(record_id: Text) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L329) + +Delete a document from the index. + +**Arguments**: + +- `record_id` _Text_ - ID of the document to delete. + + +**Returns**: + +- `ModelResponse` - Response containing the deleted document data. + + +**Raises**: + +- `Exception` - If document deletion fails. + + +**Example**: + + >>> index_model.delete_record("123") + +#### prepare\_record\_from\_file + +```python +def prepare_record_from_file(file_path: str, file_id: str = None) -> Record +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L350) + +Prepare a record from a file. + +**Arguments**: + +- `file_path` _str_ - The path to the file to be processed. +- `file_id` _str, optional_ - The ID to assign to the record. If not provided, a unique ID is generated. + + +**Returns**: + +- `Record` - A Record object containing the file's content and metadata. + + +**Raises**: + +- `Exception` - If the file cannot be parsed. + + +**Example**: + + >>> record = index_model.prepare_record_from_file("/path/to/file.txt") + +#### parse\_file + +```python +@staticmethod +def parse_file(file_path: str) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L373) + +Parse a file using the Docling model. + +**Arguments**: + +- `file_path` _str_ - The path to the file to be parsed. + + +**Returns**: + +- `ModelResponse` - The response containing the parsed file content. + + +**Raises**: + +- `Exception` - If the file does not exist or cannot be parsed. + + +**Example**: + + >>> response = IndexModel.parse_file("/path/to/file.pdf") + +#### retrieve\_records\_with\_filter + +```python +def retrieve_records_with_filter(filter: IndexFilter) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L407) + +Retrieve records from the index that match the given filter. + +**Arguments**: + +- `filter` _IndexFilter_ - The filter criteria to apply when retrieving records. + + +**Returns**: + +- `ModelResponse` - Response containing the retrieved records. + + +**Raises**: + +- `Exception` - If retrieval fails. + + +**Example**: + + >>> from aixplain.modules.model.index_model import IndexFilter, IndexFilterOperator + >>> my_filter = IndexFilter(field="category", value="world", operator=IndexFilterOperator.EQUALS) + >>> index_model.retrieve_records_with_filter(my_filter) + +#### delete\_records\_by\_date + +```python +def delete_records_by_date(date: float) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/index_model.py#L430) + +Delete records from the index that match the given date. + +**Arguments**: + +- `date` _float_ - The date (as a timestamp) to match records for deletion. + + +**Returns**: + +- `ModelResponse` - Response containing the result of the deletion operation. + + +**Raises**: + +- `Exception` - If deletion fails. + + +**Example**: + + >>> index_model.delete_records_by_date(1717708800) + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/init.md b/docs/api-reference/python/aixplain/v1/modules/model/init.md new file mode 100644 index 000000000..d8ce3a864 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/init.md @@ -0,0 +1,440 @@ +--- +sidebar_label: model +title: aixplain.v1.modules.model +--- + +Model module for aiXplain SDK. + +This module provides the Model class and related functionality for working with +AI models in the aiXplain platform, including model execution, parameter management, +and status tracking. + +Copyright 2022 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: Duraikrishna Selvaraju, Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: September 1st 2022 + +### Model Objects + +```python +class Model(Asset) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L44) + +A ready-to-use AI model that can be executed synchronously or asynchronously. + +This class represents a deployable AI model in the aiXplain platform. It provides +functionality for model execution, parameter management, and status tracking. +Models can be run with both synchronous and asynchronous APIs, and some models +support streaming responses. + +**Attributes**: + +- `id` _Text_ - ID of the model. +- `name` _Text_ - Name of the model. +- `description` _Text_ - Detailed description of the model's functionality. +- `api_key` _Text_ - Authentication key for API access. +- `url` _Text_ - Endpoint URL for model execution. +- `supplier` _Union[Dict, Text, Supplier, int]_ - Provider/creator of the model. +- `version` _Text_ - Version identifier of the model. +- `function` _Function_ - The AI function this model performs. +- `backend_url` _str_ - Base URL for the backend API. +- `cost` _Dict_ - Pricing information for model usage. +- `name`0 _ModelParameters_ - Parameters accepted by the model. +- `name`1 _Dict_ - Description of model outputs. +- `name`2 _ModelParameters_ - Configuration parameters for model behavior. +- `name`3 _bool_ - Whether the model supports streaming responses. +- `name`4 _FunctionType_ - Category of function (AI, UTILITY, etc.). +- `name`5 _bool_ - Whether the user has an active subscription. +- `name`6 _datetime_ - When the model was created. +- `name`7 _AssetStatus_ - Current status of the model. +- `name`8 _dict_ - Additional model metadata. + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text = "", + description: Text = "", + api_key: Text = config.TEAM_API_KEY, + supplier: Union[Dict, Text, Supplier, int] = "aiXplain", + version: Optional[Text] = None, + function: Optional[Function] = None, + is_subscribed: bool = False, + cost: Optional[Dict] = None, + created_at: Optional[datetime] = None, + input_params: Optional[Dict] = None, + output_params: Optional[Dict] = None, + model_params: Optional[Dict] = None, + supports_streaming: bool = False, + status: Optional[AssetStatus] = AssetStatus.ONBOARDED, + function_type: Optional[FunctionType] = FunctionType.AI, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L74) + +Initialize a new Model instance. + +**Arguments**: + +- `id` _Text_ - ID of the Model. +- `name` _Text, optional_ - Name of the Model. Defaults to "". +- `description` _Text, optional_ - Description of the Model. Defaults to "". +- `api_key` _Text, optional_ - Authentication key for API access. + Defaults to config.TEAM_API_KEY. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - Provider/creator + of the model. Defaults to "aiXplain". +- `version` _Text, optional_ - Version identifier of the model. Defaults to None. +- `function` _Function, optional_ - The AI function this model performs. + Defaults to None. +- `is_subscribed` _bool, optional_ - Whether the user has an active + subscription. Defaults to False. +- `cost` _Dict, optional_ - Pricing information for model usage. + Defaults to None. +- `created_at` _Optional[datetime], optional_ - When the model was created. + Defaults to None. +- `name`0 _Dict, optional_ - Parameters accepted by the model. + Defaults to None. +- `name`1 _Dict, optional_ - Description of model outputs. + Defaults to None. +- `name`2 _Dict, optional_ - Configuration parameters for model + behavior. Defaults to None. +- `name`3 _bool, optional_ - Whether the model supports streaming + responses. Defaults to False. +- `name`4 _AssetStatus, optional_ - Current status of the model. + Defaults to AssetStatus.ONBOARDED. +- `name`5 _FunctionType, optional_ - Category of function. + Defaults to FunctionType.AI. +- `name`6 - Additional model metadata. + +#### to\_dict + +```python +def to_dict() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L147) + +Convert the model instance to a dictionary representation. + +**Returns**: + +- `Dict` - A dictionary containing the model's configuration with keys: + - id: Unique identifier + - name: Model name + - description: Model description + - supplier: Model provider + - additional_info: Extra metadata (excluding None/empty values) + - input_params: Input parameter configuration + - output_params: Output parameter configuration + - model_params: Model behavior parameters + - function: AI function type + - status: Current model status + +#### get\_parameters + +```python +def get_parameters() -> Optional[ModelParameters] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L177) + +Get the model's configuration parameters. + +**Returns**: + +- `Optional[ModelParameters]` - The model's parameter configuration if set, + None otherwise. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L188) + +Return a string representation of the model. + +**Returns**: + +- `str` - A string in the format "Model: <name> by <supplier> (id=<id>)". + +#### sync\_poll + +```python +def sync_poll(poll_url: Text, + name: Text = "model_process", + wait_time: float = 0.5, + timeout: float = 300) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L199) + +Poll the platform until an asynchronous operation completes or times out. + +This method repeatedly checks the status of an asynchronous operation, +implementing exponential backoff for the polling interval. + +**Arguments**: + +- `poll_url` _Text_ - URL to poll for operation status. +- `name` _Text, optional_ - Identifier for the operation for logging. + Defaults to "model_process". +- `wait_time` _float, optional_ - Initial wait time in seconds between polls. + Will increase exponentially up to 60 seconds. Defaults to 0.5. +- `timeout` _float, optional_ - Maximum total time to poll in seconds. + Defaults to 300. + + +**Returns**: + +- `ModelResponse` - The final response from the operation. If polling times + out or fails, returns a failed response with appropriate error message. + + +**Notes**: + + The minimum wait time between polls is 0.2 seconds. The wait time + increases by 10% after each poll up to a maximum of 60 seconds. + +#### poll + +```python +def poll(poll_url: Text, name: Text = "model_process") -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L265) + +Make a single poll request to check operation status. + +**Arguments**: + +- `poll_url` _Text_ - URL to poll for operation status. +- `name` _Text, optional_ - Identifier for the operation for logging. + Defaults to "model_process". + + +**Returns**: + +- `ModelResponse` - The current status of the operation. Contains completion + status, any results or errors, and usage statistics. + + +**Notes**: + + This is a low-level method used by sync_poll. Most users should use + sync_poll instead for complete operation handling. + +#### run\_stream + +```python +def run_stream(data: Union[Text, Dict], + parameters: Optional[Dict] = None) -> ModelResponseStreamer +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L324) + +Execute the model with streaming response. + +**Arguments**: + +- `data` _Union[Text, Dict]_ - The input data for the model. +- `parameters` _Optional[Dict], optional_ - Additional parameters for model + execution. Defaults to None. + + +**Returns**: + +- `ModelResponseStreamer` - A streamer object that yields response chunks. + + +**Raises**: + +- `AssertionError` - If the model doesn't support streaming. + +#### run + +```python +def run(data: Union[Text, Dict], + name: Text = "model_process", + timeout: float = 300, + parameters: Optional[Dict] = None, + wait_time: float = 0.5, + stream: bool = False) -> Union[ModelResponse, ModelResponseStreamer] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L350) + +Execute the model and wait for results. + +This method handles both synchronous and streaming execution modes. For +asynchronous operations, it polls until completion or timeout. + +**Arguments**: + +- `data` _Union[Text, Dict]_ - The input data for the model. +- `name` _Text, optional_ - Identifier for the operation for logging. + Defaults to "model_process". +- `timeout` _float, optional_ - Maximum time to wait for completion in seconds. + Defaults to 300. +- `parameters` _Dict, optional_ - Additional parameters for model execution. + Defaults to None. +- `wait_time` _float, optional_ - Initial wait time between polls in seconds. + Defaults to 0.5. +- `stream` _bool, optional_ - Whether to use streaming mode. Requires model + support. Defaults to False. + + +**Returns**: + + Union[ModelResponse, ModelResponseStreamer]: The model's response. For + streaming mode, returns a streamer object. For regular mode, + returns a response object with results or error information. + + +**Notes**: + + If the model execution becomes asynchronous, this method will poll + for completion using sync_poll with the specified timeout and wait_time. + +#### run\_async + +```python +def run_async(data: Union[Text, Dict], + name: Text = "model_process", + parameters: Optional[Dict] = None) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L428) + +Start asynchronous model execution. + +This method initiates model execution but doesn't wait for completion. +Use sync_poll to check the operation status later. + +**Arguments**: + +- `data` _Union[Text, Dict]_ - The input data for the model. +- `name` _Text, optional_ - Identifier for the operation for logging. + Defaults to "model_process". +- `parameters` _Dict, optional_ - Additional parameters for model execution. + Defaults to None. + + +**Returns**: + +- `ModelResponse` - Initial response containing: + - status: Current operation status + - url: URL for polling operation status + - error_message: Any immediate errors + - other response metadata + +#### check\_finetune\_status + +```python +def check_finetune_status(after_epoch: Optional[int] = None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L475) + +Check the status of the FineTune model. + +**Arguments**: + +- `after_epoch` _Optional[int], optional_ - status after a given epoch. Defaults to None. + + +**Raises**: + +- `Exception` - If the 'TEAM_API_KEY' is not provided. + + +**Returns**: + +- `FinetuneStatus` - The status of the FineTune model. + +#### delete + +```python +def delete() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L546) + +Delete this model from the aiXplain platform. + +This method attempts to delete the model from the platform. It will fail +if the user doesn't have appropriate permissions. + +**Raises**: + +- `Exception` - If deletion fails or if the user doesn't have permission. + +#### add\_additional\_info\_for\_benchmark + +```python +def add_additional_info_for_benchmark(display_name: str, + configuration: Dict) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L570) + +Add benchmark-specific information to the model. + +This method updates the model's additional_info with benchmark-related +metadata. + +**Arguments**: + +- `display_name` _str_ - Name for display in benchmarks. +- `configuration` _Dict_ - Model configuration settings for benchmarking. + +#### from\_dict + +```python +@classmethod +def from_dict(cls, data: Dict) -> "Model" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/__init__.py#L584) + +Create a Model instance from a dictionary representation. + +**Arguments**: + +- `data` _Dict_ - Dictionary containing model configuration with keys: + - id: Model identifier + - name: Model name + - description: Model description + - api_key: API key for authentication + - supplier: Model provider information + - version: Model version + - function: AI function type + - is_subscribed: Subscription status + - cost: Pricing information + - created_at: Creation timestamp (ISO format) + - input_params: Input parameter configuration + - output_params: Output parameter configuration + - model_params: Model behavior parameters + - additional_info: Extra metadata + + +**Returns**: + +- `Model` - A new Model instance populated with the dictionary data. + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/integration.md b/docs/api-reference/python/aixplain/v1/modules/model/integration.md new file mode 100644 index 000000000..3cc38d78f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/integration.md @@ -0,0 +1,227 @@ +--- +sidebar_label: integration +title: aixplain.v1.modules.model.integration +--- + +Integration module for aiXplain SDK. + +This module provides classes and utilities for working with external service +integrations, including authentication schemes and connection management. + +### AuthenticationSchema Objects + +```python +class AuthenticationSchema(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/integration.py#L17) + +Enumeration of supported authentication schemes for integrations. + +This enum defines the various authentication methods that can be used +when connecting to external services through integrations. + +**Attributes**: + +- `BEARER_TOKEN` _str_ - Bearer token authentication scheme. +- `OAUTH1` _str_ - OAuth 1.0 authentication scheme. +- `OAUTH2` _str_ - OAuth 2.0 authentication scheme. +- `API_KEY` _str_ - API key authentication scheme. +- `BASIC` _str_ - Basic authentication scheme (username/password). +- `NO_AUTH` _str_ - No authentication required. + +### BaseAuthenticationParams Objects + +```python +class BaseAuthenticationParams(BaseModel) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/integration.py#L40) + +Base model for authentication parameters used in integrations. + +This class defines the common parameters that are used across different +authentication schemes when connecting to external services. + +**Attributes**: + +- `name` _Optional[Text]_ - Optional name for the connection. Defaults to None. +- `connector_id` _Optional[Text]_ - Optional ID of the connector. Defaults to None. + +#### build\_connector\_params + +```python +def build_connector_params(**kwargs) -> BaseAuthenticationParams +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/integration.py#L56) + +Build authentication parameters for a connector from keyword arguments. + +This function creates a BaseAuthenticationParams instance from the provided +keyword arguments, extracting the name and connector_id if present. + +**Arguments**: + +- `**kwargs` - Arbitrary keyword arguments. Supported keys: + - name (Optional[Text]): Name for the connection + - description (Optional[Text]): Description for the connection + - connector_id (Optional[Text]): ID of the connector + + +**Returns**: + +- `BaseAuthenticationParams` - An instance containing the extracted parameters. + + +**Example**: + + >>> params = build_connector_params(name="My Connection", description="My Connection Description", connector_id="123") + >>> print(params.name) + 'My Connection' + +### Integration Objects + +```python +class Integration(Model) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/integration.py#L82) + +Integration class for managing external service integrations. + +This class extends the Model class to provide functionality for connecting +to and interacting with external services through integrations. + +#### \_\_init\_\_ + +```python +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.INTEGRATION, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/integration.py#L89) + +Initialize a new Integration instance. + +**Arguments**: + +- `id` _Text_ - ID of the Integration. +- `name` _Text_ - Name of the Integration. +- `description` _Text, optional_ - Description of the Integration. Defaults to "". +- `api_key` _Text, optional_ - API key for the Integration. Defaults to None. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - Supplier of the Integration. Defaults to "aiXplain". +- `version` _Text, optional_ - Version of the Integration. Defaults to "1.0". +- `function` _Function, optional_ - Function of the Integration. Defaults to None. +- `is_subscribed` _bool, optional_ - Whether the user is subscribed. Defaults to False. +- `cost` _Dict, optional_ - Cost of the Integration. Defaults to None. +- `function_type` _FunctionType, optional_ - Type of the function. Must be FunctionType.INTEGRATION. + Defaults to FunctionType.INTEGRATION. +- `name`0 - Any additional Integration info to be saved. + + +**Raises**: + +- `name`1 - If function_type is not FunctionType.INTEGRATION. + +#### connect + +```python +def connect(authentication_schema: Optional[AuthenticationSchema] = None, + args: Optional[BaseAuthenticationParams] = None, + data: Optional[Union[Dict, Text]] = None, + **kwargs) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/integration.py#L142) + +Connect to the integration using the specified authentication scheme. + +This method establishes a connection to the integration service using the provided +authentication method and credentials. The required parameters vary depending on +the authentication scheme being used. + +**Arguments**: + +- `authentication_schema` _Optional[AuthenticationSchema]_ - The authentication scheme to use + (e.g., BEARER_TOKEN, OAUTH1, OAUTH2, API_KEY, BASIC, NO_AUTH). Optional for MCP connections. +- `args` _Optional[BaseAuthenticationParams], optional_ - Common connection parameters. + If not provided, will be built from kwargs. Defaults to None. +- `data` _Optional[Union[Dict, Text]], optional_ - Authentication-specific parameters required by + the chosen authentication scheme. For MCP connections, can be a URL string. + Defaults to None. +- `**kwargs` - Additional keyword arguments used to build BaseAuthenticationParams + if args is not provided. Supported keys: + - name (str): Name for the connection + - connector_id (str): ID of the connector + + +**Returns**: + +- `ModelResponse` - A response object containing: + - data (Dict): Contains connection details including: + - id (str): Connection ID (can be used with ModelFactory.get(id)) + - redirectURL (str, optional): URL to complete OAuth authentication + (only for OAuth1/OAuth2) + + +**Raises**: + +- `ValueError` - If the authentication schema is not supported by this integration + or if required parameters are missing from the data dictionary. + + +**Examples**: + + Using Bearer Token authentication: + >>> integration.connect( + ... AuthenticationSchema.BEARER_TOKEN, + ... data=\{"token": "1234567890"}, + ... name="My Connection", + ... description="My Connection Description" + ... ) + + Using OAuth2 authentication: + >>> response = integration.connect( + ... AuthenticationSchema.OAUTH2, + ... name="My Connection", + ... description="My Connection Description" + ... ) + >>> # For OAuth2, you'll need to visit the redirectURL to complete auth + >>> print(response.data.get("redirectURL")) + + Using API Key authentication: + >>> integration.connect( + ... AuthenticationSchema.API_KEY, + ... data=\{"api_key": "your-api-key"}, + ... name="My Connection", + ... description="My Connection Description" + ... ) + + Using MCP connection (no authentication schema required): + >>> response = integration.connect(data="https://mcp.example.com/api/...") + +#### \_\_repr\_\_ + +```python +def __repr__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/integration.py#L273) + +Return a string representation of the Integration instance. + +**Returns**: + +- `str` - A string in the format "Integration: <name> by <supplier> (id=<id>)". + If supplier is a dictionary, uses supplier['name'], otherwise uses supplier directly. + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/llm_model.md b/docs/api-reference/python/aixplain/v1/modules/model/llm_model.md new file mode 100644 index 000000000..5b80aca3e --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/llm_model.md @@ -0,0 +1,212 @@ +--- +sidebar_label: llm_model +title: aixplain.v1.modules.model.llm_model +--- + +Copyright 2024 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: Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: June 4th 2024 +Description: + Large Language Model Class + +### LLM Objects + +```python +class LLM(Model) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/llm_model.py#L35) + +Ready-to-use LLM model. This model can be run in both synchronous and asynchronous manner. + +**Attributes**: + +- `id` _Text_ - ID of the Model +- `name` _Text_ - Name of the Model +- `description` _Text, optional_ - description of the model. Defaults to "". +- `api_key` _Text, optional_ - API key of the Model. Defaults to None. +- `url` _Text, optional_ - endpoint of the model. Defaults to config.MODELS_RUN_URL. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - supplier of the asset. Defaults to "aiXplain". +- `version` _Text, optional_ - version of the model. Defaults to "1.0". +- `function` _Text, optional_ - model AI function. Defaults to None. +- `backend_url` _str_ - URL of the backend. +- `pricing` _Dict, optional_ - model price. Defaults to None. +- `name`0 _FunctionType, optional_ - type of the function. Defaults to FunctionType.AI. +- `name`1 - Any additional Model info to be saved + +#### \_\_init\_\_ + +```python +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, + temperature: Optional[float] = None, + function_type: Optional[FunctionType] = FunctionType.AI, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/llm_model.py#L53) + +Initialize a new LLM instance. + +**Arguments**: + +- `id` _Text_ - ID of the LLM model. +- `name` _Text_ - Name of the LLM model. +- `description` _Text, optional_ - Description of the model. Defaults to "". +- `api_key` _Text, optional_ - API key for the model. Defaults to None. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - Supplier of the model. Defaults to "aiXplain". +- `version` _Text, optional_ - Version of the model. Defaults to "1.0". +- `function` _Function, optional_ - Model's AI function. Must be Function.TEXT_GENERATION. +- `is_subscribed` _bool, optional_ - Whether the user is subscribed. Defaults to False. +- `cost` _Dict, optional_ - Cost of the model. Defaults to None. +- `temperature` _Optional[float], optional_ - Default temperature for text generation. Defaults to None. +- `name`0 _FunctionType, optional_ - Type of the function. Defaults to FunctionType.AI. +- `name`1 - Any additional model info to be saved. + + +**Raises**: + +- `name`2 - If function is not Function.TEXT_GENERATION. + +#### run + +```python +def run( + data: Text, + context: Optional[Text] = None, + prompt: Optional[Text] = None, + history: Optional[List[Dict]] = None, + temperature: Optional[float] = None, + max_tokens: int = 128, + top_p: Optional[float] = None, + name: Text = "model_process", + timeout: float = 300, + parameters: Optional[Dict] = None, + wait_time: float = 0.5, + stream: bool = False, + response_format: Optional[Text] = None +) -> Union[ModelResponse, ModelResponseStreamer] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/llm_model.py#L107) + +Run the LLM model synchronously to generate text. + +This method runs the LLM model to generate text based on the provided input. +It supports both single-turn and conversational interactions, with options +for streaming responses. + +**Arguments**: + +- `data` _Text_ - The input text or last user utterance for text generation. +- `context` _Optional[Text], optional_ - System message or context for the model. + Defaults to None. +- `prompt` _Optional[Text], optional_ - Prompt template or prefix to prepend to + the input. Defaults to None. +- `history` _Optional[List[Dict]], optional_ - Conversation history in OpenAI format + (e.g., [\{"role": "assistant", "content": "Hello!"}, ...]). Defaults to None. +- `temperature` _Optional[float], optional_ - Sampling temperature for text generation. + Higher values make output more random. If None, uses the model's default. + Defaults to None. +- `max_tokens` _int, optional_ - Maximum number of tokens to generate. + Defaults to 128. +- `top_p` _Optional[float], optional_ - Nucleus sampling parameter. Only tokens with cumulative + probability < top_p are considered. Defaults to None. +- `name` _Text, optional_ - Identifier for this model run. Useful for logging. + Defaults to "model_process". +- `timeout` _float, optional_ - Maximum time in seconds to wait for completion. + Defaults to 300. +- `parameters` _Optional[Dict], optional_ - Additional model-specific parameters. + Defaults to None. +- `context`0 _float, optional_ - Time in seconds between polling attempts. + Defaults to 0.5. +- `context`1 _bool, optional_ - Whether to stream the model's output tokens. + Defaults to False. + response_format (Optional[Union[str, dict, BaseModel]], optional): + Specifies the desired output structure or format of the model’s response. + + +**Returns**: + + Union[ModelResponse, ModelResponseStreamer]: If stream=False, returns a ModelResponse + containing the complete generated text and metadata. If stream=True, returns + a ModelResponseStreamer that yields tokens as they're generated. + +#### run\_async + +```python +def run_async(data: Text, + context: Optional[Text] = None, + prompt: Optional[Text] = None, + history: Optional[List[Dict]] = None, + temperature: Optional[float] = None, + max_tokens: int = 128, + top_p: Optional[float] = None, + name: Text = "model_process", + parameters: Optional[Dict] = None, + response_format: Optional[Text] = None) -> ModelResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/llm_model.py#L212) + +Run the LLM model asynchronously to generate text. + +This method starts an asynchronous text generation task and returns immediately +with a response containing a polling URL. The actual result can be retrieved +later using the polling URL. + +**Arguments**: + +- `data` _Text_ - The input text or last user utterance for text generation. +- `context` _Optional[Text], optional_ - System message or context for the model. + Defaults to None. +- `prompt` _Optional[Text], optional_ - Prompt template or prefix to prepend to + the input. Defaults to None. +- `history` _Optional[List[Dict]], optional_ - Conversation history in OpenAI format + (e.g., [\{"role": "assistant", "content": "Hello!"}, ...]). Defaults to None. +- `temperature` _Optional[float], optional_ - Sampling temperature for text generation. + Higher values make output more random. If None, uses the model's default. + Defaults to None. +- `max_tokens` _int, optional_ - Maximum number of tokens to generate. + Defaults to 128. +- `top_p` _Optional[float], optional_ - Nucleus sampling parameter. Only tokens with cumulative + probability < top_p are considered. Defaults to None. +- `name` _Text, optional_ - Identifier for this model run. Useful for logging. + Defaults to "model_process". +- `parameters` _Optional[Dict], optional_ - Additional model-specific parameters. + Defaults to None. +- `response_format` _Optional[Text], optional_ - Desired output format specification. + Defaults to None. + + +**Returns**: + +- `context`0 - A response object containing: + - status (ResponseStatus): Status of the request (e.g., IN_PROGRESS) + - url (str): URL to poll for the final result + - data (str): Empty string (result not available yet) + - details (Dict): Additional response details + - completed (bool): False (task not completed yet) + - error_message (str): Error message if request failed + Other fields may be present depending on the response. + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/mcp_connection.md b/docs/api-reference/python/aixplain/v1/modules/model/mcp_connection.md new file mode 100644 index 000000000..c3847d7de --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/mcp_connection.md @@ -0,0 +1,140 @@ +--- +sidebar_label: mcp_connection +title: aixplain.v1.modules.model.mcp_connection +--- + +### ConnectAction Objects + +```python +class ConnectAction() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/mcp_connection.py#L7) + +A class representing an action that can be performed by an MCP 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. Defaults to None. +- `inputs` _Optional[Dict]_ - The input parameters required by the action. Defaults to None. + +#### \_\_init\_\_ + +```python +def __init__(name: Text, + description: Text, + code: Optional[Text] = None, + inputs: Optional[Dict] = None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/mcp_connection.py#L25) + +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\_\_ + +```python +def __repr__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/mcp_connection.py#L47) + +Return a string representation of the ConnectAction instance. + +**Returns**: + +- `str` - A string in the format "Action(code=<code>, name=<name>)". + +### MCPConnection Objects + +```python +class MCPConnection(ConnectionTool) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/mcp_connection.py#L56) + +#### \_\_init\_\_ + +```python +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]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/mcp_connection.py#L60) + +Initialize a new MCPConnection instance. + +**Arguments**: + +- `id` _Text_ - ID of the MCP Connection. +- `name` _Text_ - Name of the MCP Connection. +- `description` _Text, optional_ - Description of the Connection. Defaults to "". +- `api_key` _Text, optional_ - API key for 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_ - Whether the user is subscribed. Defaults to False. +- `cost` _Dict, optional_ - Cost of the Connection. Defaults to None. +- `function_type` _FunctionType, optional_ - Type of the function. Must be + FunctionType.MCP_CONNECTION. Defaults to FunctionType.CONNECTION. +- `name`0 - Any additional Connection info to be saved. + + +**Raises**: + +- `name`1 - If function_type is not FunctionType.MCP_CONNECTION. + +#### get\_action\_inputs + +```python +def get_action_inputs(action: Union[ConnectAction, Text]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/mcp_connection.py#L136) + +Retrieve the input parameters required for a specific tool. + +This method fetches the input parameters that are required to use a specific +tool. If the action object already has its inputs cached, returns those +instead of making a server request. + +**Arguments**: + +- `action` _Union[ConnectAction, Text]_ - The tool to get inputs for, either as + a ConnectAction object or as a string code. + + +**Returns**: + +- `Dict` - A dictionary mapping input parameter codes to their specifications. + + +**Raises**: + +- `Exception` - If the inputs cannot be retrieved from the server or if the + response cannot be parsed. + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/model_parameters.md b/docs/api-reference/python/aixplain/v1/modules/model/model_parameters.md new file mode 100644 index 000000000..65b84054f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/model_parameters.md @@ -0,0 +1,27 @@ +--- +sidebar_label: model_parameters +title: aixplain.v1.modules.model.model_parameters +--- + +### ModelParameters Objects + +```python +class ModelParameters(BaseParameters) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/model_parameters.py#L5) + +#### \_\_init\_\_ + +```python +def __init__(input_params: Dict[str, Dict[str, Any]]) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/model_parameters.py#L6) + +Initialize ModelParameters with input parameters dictionary. + +**Arguments**: + +- `input_params` _Dict[str, Dict[str, Any]]_ - Dictionary containing parameter configurations + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/model_response_streamer.md b/docs/api-reference/python/aixplain/v1/modules/model/model_response_streamer.md new file mode 100644 index 000000000..f537a2f7c --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/model_response_streamer.md @@ -0,0 +1,63 @@ +--- +sidebar_label: model_response_streamer +title: aixplain.v1.modules.model.model_response_streamer +--- + +Streaming response handler for model execution. + +### ModelResponseStreamer Objects + +```python +class ModelResponseStreamer() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/model_response_streamer.py#L9) + +A class representing a streamer for model responses. + +This class provides an iterator interface for streaming model responses. +It handles the conversion of JSON-like strings into ModelResponse objects +and manages the response status. + +#### \_\_init\_\_ + +```python +def __init__(iterator: Iterator) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/model_response_streamer.py#L17) + +Initialize a new ModelResponseStreamer instance. + +**Arguments**: + +- `iterator` _Iterator_ - An iterator that yields JSON-like strings. + +#### \_\_next\_\_ + +```python +def __next__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/model_response_streamer.py#L26) + +Return the next chunk of the response. + +**Returns**: + +- `ModelResponse` - A ModelResponse object containing the next chunk of the response. + +#### \_\_iter\_\_ + +```python +def __iter__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/model_response_streamer.py#L45) + +Return the iterator for the ModelResponseStreamer. + +**Returns**: + +- `Iterator` - The iterator for the ModelResponseStreamer. + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/record.md b/docs/api-reference/python/aixplain/v1/modules/model/record.md new file mode 100644 index 000000000..4bec8e42c --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/record.md @@ -0,0 +1,70 @@ +--- +sidebar_label: record +title: aixplain.v1.modules.model.record +--- + +Record module for index operations. + +### Record Objects + +```python +class Record() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/record.py#L8) + +A class representing a record in an index. + +This class defines the structure of a record with its value, type, ID, URI, +and attributes. + +#### \_\_init\_\_ + +```python +def __init__(value: str = "", + value_type: DataType = DataType.TEXT, + id: Optional[str] = None, + uri: str = "", + attributes: dict = {}) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/record.py#L15) + +Initialize a new Record instance. + +**Arguments**: + +- `value` _str_ - The value of the record. +- `value_type` _DataType_ - The type of the value. +- `id` _Optional[str]_ - The ID of the record. Defaults to a random UUID. +- `uri` _str_ - The URI of the record. +- `attributes` _dict_ - The attributes of the record. + +#### to\_dict + +```python +def to_dict() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/record.py#L38) + +Convert the record to a dictionary. + +**Returns**: + +- `dict` - A dictionary containing the record's value, type, ID, URI, and attributes. + +#### validate + +```python +def validate() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/record.py#L52) + +Validate the record. + +**Raises**: + +- `AssertionError` - If the value type is invalid or if the URI is required for image records. + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/response.md b/docs/api-reference/python/aixplain/v1/modules/model/response.md new file mode 100644 index 000000000..e0878bc60 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/response.md @@ -0,0 +1,164 @@ +--- +sidebar_label: response +title: aixplain.v1.modules.model.response +--- + +### ModelResponse Objects + +```python +class ModelResponse() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/response.py#L6) + +ModelResponse class to store the response of the model run. + +This class provides a structured way to store and manage the response from model runs. +It includes fields for status, data, details, completion status, error messages, +usage information, and additional metadata. + +#### \_\_init\_\_ + +```python +def __init__(status: ResponseStatus, + data: Text = "", + details: Optional[Union[Dict, List]] = {}, + completed: bool = False, + error_message: Text = "", + used_credits: float = 0.0, + run_time: float = 0.0, + usage: Optional[Dict] = None, + url: Optional[Text] = None, + error_code: Optional[ErrorCode] = None, + **kwargs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/response.py#L14) + +Initialize a new ModelResponse instance. + +**Arguments**: + +- `status` _ResponseStatus_ - The status of the response. +- `data` _Text_ - The data returned by the model. +- `details` _Optional[Union[Dict, List]]_ - Additional details about the response. +- `completed` _bool_ - Whether the response is complete. +- `error_message` _Text_ - The error message if the response is not successful. +- `used_credits` _float_ - The amount of credits used for the response. +- `run_time` _float_ - The time taken to generate the response. +- `usage` _Optional[Dict]_ - Usage information about the response. +- `url` _Optional[Text]_ - The URL of the response. +- `error_code` _Optional[ErrorCode]_ - The error code if the response is not successful. +- `data`0 - Additional keyword arguments. + +#### \_\_getitem\_\_ + +```python +def __getitem__(key: Text) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/response.py#L59) + +Get an item from the ModelResponse. + +**Arguments**: + +- `key` _Text_ - The key to get the value for. + + +**Returns**: + +- `Any` - The value associated with the key. + + +**Raises**: + +- `KeyError` - If the key is not found in the ModelResponse. + +#### get + +```python +def get(key: Text, default: Optional[Any] = None) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/response.py#L81) + +Get an item from the ModelResponse with a default value. + +**Arguments**: + +- `key` _Text_ - The key to get the value for. +- `default` _Optional[Any]_ - The default value to return if the key is not found. + + +**Returns**: + +- `Any` - The value associated with the key or the default value if the key is not found. + +#### \_\_setitem\_\_ + +```python +def __setitem__(key: Text, value: Any) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/response.py#L96) + +Set an item in the ModelResponse. + +**Arguments**: + +- `key` _Text_ - The key to set the value for. +- `value` _Any_ - The value to set. + + +**Raises**: + +- `KeyError` - If the key is not found in the ModelResponse. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/response.py#L117) + +Return a string representation of the ModelResponse. + +**Returns**: + +- `str` - A string representation of the ModelResponse. + +#### \_\_contains\_\_ + +```python +def __contains__(key: Text) -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/response.py#L148) + +Check if a key is in the ModelResponse. + +**Arguments**: + +- `key` _Text_ - The key to check for. + + +**Returns**: + +- `bool` - True if the key is in the ModelResponse, False otherwise. + +#### to\_dict + +```python +def to_dict() -> Dict[Text, Any] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/response.py#L163) + +Convert the ModelResponse to a dictionary. + +**Returns**: + + Dict[Text, Any]: A dictionary representation of the ModelResponse. + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/utility_model.md b/docs/api-reference/python/aixplain/v1/modules/model/utility_model.md new file mode 100644 index 000000000..2f06d667b --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/utility_model.md @@ -0,0 +1,313 @@ +--- +sidebar_label: utility_model +title: aixplain.v1.modules.model.utility_model +--- + +Copyright 2024 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: Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: November 25th 2024 +Description: + Utility Model Class + +### BaseUtilityModelParams Objects + +```python +class BaseUtilityModelParams(BaseModel) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L36) + +Base model for utility model parameters. + +This class defines the basic parameters required to create or update a utility model. + +**Attributes**: + +- `name` _Text_ - The name of the utility model. +- `code` _Union[Text, Callable]_ - The implementation code, either as a string or + a callable function. +- `description` _Optional[Text]_ - A description of what the utility model does. + Defaults to None. + +### UtilityModelInput Objects + +```python +@dataclass +class UtilityModelInput() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L55) + +A class representing an input parameter for a utility model. + +This class defines the structure and validation rules for input parameters +that can be used with utility models. + +**Attributes**: + +- `name` _Text_ - The name of the input parameter. +- `description` _Text_ - A description of what this input parameter represents. +- `type` _DataType_ - The data type of the input parameter. Must be one of: + TEXT, BOOLEAN, or NUMBER. Defaults to DataType.TEXT. + +#### validate + +```python +def validate() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L72) + +Validate that the input parameter has a supported data type. + +**Raises**: + +- `ValueError` - If the type is not one of: TEXT, BOOLEAN, or NUMBER. + +#### to\_dict + +```python +def to_dict() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L81) + +Convert the input parameter to a dictionary representation. + +**Returns**: + +- `dict` - A dictionary containing the input parameter's name, description, + and type (as a string value). + +#### utility\_tool + +```python +def utility_tool(name: Text, + description: Text, + inputs: List[UtilityModelInput] = None, + output_examples: Text = "", + status=AssetStatus.DRAFT) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L92) + +Decorator for utility tool functions + +**Arguments**: + +- `name` - Name of the utility tool +- `description` - Description of what the utility tool does +- `inputs` - List of input parameters, must be UtilityModelInput objects +- `output_examples` - Examples of expected outputs +- `status` - Asset status + + +**Raises**: + +- `ValueError` - If name or description is empty +- `TypeError` - If inputs contains non-UtilityModelInput objects + +### UtilityModel Objects + +```python +class UtilityModel(Model, DeployableMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L138) + +Ready-to-use Utility Model. + +Note: Non-deployed utility models (status=DRAFT) will expire after 24 hours after creation. +Use the .deploy() method to make the model permanent. + +**Attributes**: + +- `id` _Text_ - ID of the Model +- `name` _Text_ - Name of the Model +- `code` _Union[Text, Callable]_ - code of the model. +- `description` _Text_ - description of the model. Defaults to "". +- `inputs` _List[UtilityModelInput]_ - inputs of the model. Defaults to []. +- `output_examples` _Text_ - output examples. Defaults to "". +- `api_key` _Text, optional_ - API key of the Model. Defaults to None. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - supplier of the asset. Defaults to "aiXplain". +- `version` _Text, optional_ - version of the model. Defaults to "1.0". +- `function` _Function, optional_ - model AI function. Defaults to None. +- `name`0 _bool, optional_ - Is the user subscribed. Defaults to False. +- `name`1 _Dict, optional_ - model price. Defaults to None. +- `name`2 _AssetStatus, optional_ - status of the model. Defaults to AssetStatus.DRAFT. +- `name`3 - Any additional Model info to be saved + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Optional[Text] = None, + code: Union[Text, Callable] = None, + description: Optional[Text] = None, + inputs: List[UtilityModelInput] = [], + output_examples: 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, + status: AssetStatus = AssetStatus.DRAFT, + function_type: Optional[FunctionType] = FunctionType.UTILITY, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L161) + +Initialize a new UtilityModel instance. + +**Arguments**: + +- `id` _Text_ - ID of the utility model. +- `name` _Optional[Text], optional_ - Name of the utility model. If not provided, + will be extracted from the code if decorated. Defaults to None. +- `code` _Union[Text, Callable], optional_ - Implementation code, either as a string + or a callable function. Defaults to None. +- `description` _Optional[Text], optional_ - Description of what the model does. + If not provided, will be extracted from the code if decorated. + Defaults to None. +- `inputs` _List[UtilityModelInput], optional_ - List of input parameters the + model accepts. If not provided, will be extracted from the code if + decorated. Defaults to []. +- `output_examples` _Text, optional_ - Examples of the model's expected outputs. + Defaults to "". +- `api_key` _Optional[Text], optional_ - API key for accessing the model. + Defaults to None. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - Supplier of the model. + Defaults to "aiXplain". +- `version` _Optional[Text], optional_ - Version of the model. Defaults to None. +- `function` _Optional[Function], optional_ - Function type. Must be + Function.UTILITIES. Defaults to None. +- `name`0 _bool, optional_ - Whether the user is subscribed. + Defaults to False. +- `name`1 _Optional[Dict], optional_ - Cost information for the model. + Defaults to None. +- `name`2 _AssetStatus, optional_ - Current status of the model. + Defaults to AssetStatus.DRAFT. +- `name`3 _Optional[FunctionType], optional_ - Type of the function. + Defaults to FunctionType.UTILITY. +- `name`4 - Any additional model info to be saved. + + +**Raises**: + +- `name`5 - If function is not Function.UTILITIES. + + +**Notes**: + + Non-deployed utility models (status=DRAFT) will expire after 24 hours. + Use the .deploy() method to make the model permanent. + +#### validate + +```python +def validate() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L253) + +Validate the Utility Model. + +This method checks if the utility model exists in the backend and if the code is a string with s3://. +If not, it parses the code and updates the description and inputs and does the validation. +If yes, it just does the validation on the description and inputs. + +#### to\_dict + +```python +def to_dict() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L306) + +Convert the utility model to a dictionary representation. + +This method creates a dictionary containing all the essential information +about the utility model, suitable for API requests or serialization. + +**Returns**: + +- `dict` - A dictionary containing: + - name (str): The model's name + - description (str): The model's description + - inputs (List[dict]): List of input parameters as dictionaries + - code (Union[str, Callable]): The model's implementation code + - function (str): The function type as a string value + - outputDescription (str): Examples of expected outputs + - status (str): Current status as a string value + +#### update + +```python +def update() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L332) + +Update the Utility Model. + +This method validates the utility model and updates it in the backend. + +**Raises**: + +- `Exception` - If the update fails. + +#### save + +```python +def save() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L369) + +Save the Utility Model. + +This method updates the utility model in the backend. + +#### delete + +```python +def delete() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L376) + +Delete the Utility Model. + +This method deletes the utility model from the backend. + +#### \_\_repr\_\_ + +```python +def __repr__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utility_model.py#L397) + +Return a string representation of the UtilityModel instance. + +**Returns**: + +- `str` - A string in the format "UtilityModel: <name> by <supplier> (id=<id>)". + If supplier is a dictionary, uses supplier['name'], otherwise uses + supplier directly. + diff --git a/docs/api-reference/python/aixplain/v1/modules/model/utils.md b/docs/api-reference/python/aixplain/v1/modules/model/utils.md new file mode 100644 index 000000000..59dd79869 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/model/utils.md @@ -0,0 +1,224 @@ +--- +sidebar_label: utils +title: aixplain.v1.modules.model.utils +--- + +Utility functions for model operations including payload building and code parsing. + +This module provides helper functions for building API payloads, parsing code for utility models, +and handling model execution endpoints. + +#### build\_payload + +```python +def build_payload(data: Union[Text, Dict], + parameters: Optional[Dict] = None, + stream: Optional[bool] = None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utils.py#L87) + +Build a JSON payload for API requests. + +This function constructs a JSON payload by combining input data with optional +parameters and streaming configuration. It handles various input formats and +ensures proper JSON serialization. + +**Arguments**: + +- `data` _Union[Text, Dict]_ - The primary data to include in the payload. + Can be a string (which may be JSON) or a dictionary. +- `parameters` _Optional[Dict], optional_ - Additional parameters to include + in the payload. Defaults to None. +- `stream` _Optional[bool], optional_ - Whether to enable streaming for this + request. If provided, adds streaming configuration to parameters. + Defaults to None. + + +**Returns**: + +- `str` - A JSON string containing the complete payload with all parameters + and data properly formatted. + + +**Notes**: + + - If data is a string that can be parsed as JSON, it will be. + - If data is a number (after JSON parsing), it will be converted to string. + - The function ensures the result is a valid JSON string. + +#### call\_run\_endpoint + +```python +def call_run_endpoint(url: Text, api_key: Text, payload: Dict) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utils.py#L170) + +Call a model execution endpoint and handle the response. + +This function makes a POST request to a model execution endpoint, handles +various response scenarios, and provides appropriate error handling. + +**Arguments**: + +- `url` _Text_ - The endpoint URL to call. +- `api_key` _Text_ - API key for authentication. +- `payload` _Dict_ - The request payload to send. + + +**Returns**: + +- `Dict` - A response dictionary containing: + - status (str): "IN_PROGRESS", "SUCCESS", or "FAILED" + - completed (bool): Whether the request is complete + - url (str, optional): Polling URL for async requests + - data (Any, optional): Response data if available + - error_message (str, optional): Error message if failed + + +**Notes**: + + - For async operations, returns a polling URL in the 'url' field + - For failures, includes an error message and sets status to "FAILED" + - Handles both API errors and request exceptions + +#### parse\_code + +```python +def parse_code( + code: Union[Text, Callable], + api_key: Optional[Text] = None) -> Tuple[Text, List, Text, Text] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utils.py#L238) + +Parse and process code for utility model creation. + +This function takes code input in various forms (callable, file path, URL, or +string) and processes it for use in a utility model. It extracts metadata, +validates the code structure, and prepares it for execution. + +**Arguments**: + +- `code` _Union[Text, Callable]_ - The code to parse. Can be: + - A callable function + - A file path (string) + - A URL (string) + - Raw code (string) +- `api_key` _Optional[Text], optional_ - API key for authentication when uploading code. + Defaults to None. + + +**Returns**: + + Tuple[Text, List, Text, Text]: A tuple containing: + - code (Text): The processed code, uploaded to storage + - inputs (List[UtilityModelInput]): List of extracted input parameters + - description (Text): Function description from docstring + - name (Text): Function name + + +**Raises**: + +- `Exception` - If the code doesn't have a main function +- `AssertionError` - If input types are not properly specified +- `Exception` - If an input type is not supported (must be int, float, bool, or str) + + +**Notes**: + + - The function requires a 'main' function in the code + - Input parameters must have type annotations + - Supported input types are: int, float, bool, str + - The code is uploaded to temporary storage for later use + +#### parse\_code\_decorated + +```python +def parse_code_decorated( + code: Union[Text, Callable], + api_key: Optional[Text] = None) -> Tuple[Text, List, Text, Text] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utils.py#L369) + +Parse and process code that may be decorated with @utility_tool. + +This function handles code that may be decorated with the @utility_tool +decorator, extracting metadata from either the decorator or the code itself. +It supports various input formats and provides robust parameter extraction. + +**Arguments**: + +- `code` _Union[Text, Callable]_ - The code to parse. Can be: + - A decorated callable function + - A non-decorated callable function + - A file path (string) + - A URL (string) + - Raw code (string) +- `api_key` _Optional[Text], optional_ - API key for authentication when uploading code. + Defaults to None. + + +**Returns**: + + Tuple[Text, List, Text, Text]: A tuple containing: + - code (Text): The processed code, uploaded to storage + - inputs (List[UtilityModelInput]): List of extracted input parameters + - description (Text): Function description from decorator or docstring + - name (Text): Function name from decorator or code + + +**Raises**: + +- `TypeError` - If code is a class or class instance +- `AssertionError` - If input types are not properly specified +- `Exception` - In various cases: + - If code doesn't have a function definition + - If code has invalid @utility_tool decorator + - If input type is not supported + - If code parsing fails + + +**Notes**: + + - Handles both decorated and non-decorated code + - For decorated code, extracts metadata from decorator + - For non-decorated code, falls back to code parsing + - Renames the function to 'main' for backend compatibility + - Supports TEXT, BOOLEAN, and NUMBER input types + - Uploads processed code to temporary storage + +#### is\_supported\_image\_type + +```python +def is_supported_image_type(value: str) -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/model/utils.py#L613) + +Check if a file path or URL points to a supported image format. + +This function checks if the provided string ends with a supported image +file extension. The check is case-insensitive. + +**Arguments**: + +- `value` _str_ - The file path or URL to check. + + +**Returns**: + +- `bool` - True if the file has a supported image extension, False otherwise. + + +**Notes**: + + Supported image formats are: + - JPEG (.jpg, .jpeg) + - PNG (.png) + - GIF (.gif) + - BMP (.bmp) + - WebP (.webp) + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/asset.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/asset.md new file mode 100644 index 000000000..fe0d8bb01 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/asset.md @@ -0,0 +1,295 @@ +--- +sidebar_label: asset +title: aixplain.v1.modules.pipeline.asset +--- + +#### \_\_author\_\_ + +Copyright 2024 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: Thiago Castro Ferreira, Shreyas Sharma and Lucas Pavanelli +Date: November 25th 2024 +Description: + Pipeline Asset Class + +### Pipeline Objects + +```python +class Pipeline(Asset, DeployableMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L39) + +Representing a custom pipeline that was created on the aiXplain Platform + +**Attributes**: + +- `id` _Text_ - ID of the Pipeline +- `name` _Text_ - Name of the Pipeline +- `api_key` _Text_ - Team API Key to run the Pipeline. +- `url` _Text, optional_ - running URL of platform. Defaults to config.BACKEND_URL. +- `supplier` _Text, optional_ - Pipeline supplier. Defaults to "aiXplain". +- `version` _Text, optional_ - version of the pipeline. Defaults to "1.0". +- `status` _AssetStatus, optional_ - Pipeline status. Defaults to AssetStatus.DRAFT. +- `**additional_info` - Any additional Pipeline info to be saved + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text, + api_key: Text, + url: Text = config.BACKEND_URL, + supplier: Text = "aiXplain", + version: Text = "1.0", + status: AssetStatus = AssetStatus.DRAFT, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L56) + +Create a Pipeline with the necessary information + +**Arguments**: + +- `id` _Text_ - ID of the Pipeline +- `name` _Text_ - Name of the Pipeline +- `api_key` _Text_ - Team API Key to run the Pipeline. +- `url` _Text, optional_ - running URL of platform. Defaults to config.BACKEND_URL. +- `supplier` _Text, optional_ - Pipeline supplier. Defaults to "aiXplain". +- `version` _Text, optional_ - version of the pipeline. Defaults to "1.0". +- `status` _AssetStatus, optional_ - Pipeline status. Defaults to AssetStatus.DRAFT. +- `**additional_info` - Any additional Pipeline info to be saved + +#### poll + +```python +def poll(poll_url: Text, + name: Text = "pipeline_process", + response_version: Text = "v2") -> Union[Dict, PipelineResponse] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L143) + +Poll the platform to check whether an asynchronous call is done. + +**Arguments**: + +- `poll_url` _Text_ - polling URL +- `name` _Text, optional_ - ID given to a call. Defaults to "pipeline_process". + + +**Returns**: + +- `Dict` - response obtained by polling call + +#### run + +```python +def run(data: Union[Text, Dict], + data_asset: Optional[Union[Text, Dict]] = None, + name: Text = "pipeline_process", + timeout: float = 20000.0, + wait_time: float = 1.0, + version: Optional[Text] = None, + response_version: Text = "v2", + **kwargs) -> Union[Dict, PipelineResponse] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L187) + +Run the pipeline synchronously and wait for results. + +This method executes the pipeline with the provided input data and waits +for completion. It handles both direct data input and data assets, with +support for polling and timeout. + +**Arguments**: + +- `data` _Union[Text, Dict]_ - The input data for the pipeline. Can be: + - A string (file path, URL, or raw data) + - A dictionary mapping node labels to input data +- `data_asset` _Optional[Union[Text, Dict]], optional_ - Data asset(s) to + process. Can be a single asset ID or a dict mapping node labels + to asset IDs. Defaults to None. +- `name` _Text, optional_ - Identifier for this pipeline run. Used for + logging. Defaults to "pipeline_process". +- `timeout` _float, optional_ - Maximum time in seconds to wait for + completion. Defaults to 20000.0. +- `wait_time` _float, optional_ - Initial time in seconds between polling + attempts. May increase over time. Defaults to 1.0. +- `version` _Optional[Text], optional_ - Specific pipeline version to run. + Defaults to None. +- `response_version` _Text, optional_ - Response format version ("v1" or + "v2"). Defaults to "v2". +- `**kwargs` - Additional keyword arguments passed to the pipeline. + + +**Returns**: + + Union[Dict, PipelineResponse]: If response_version is: + - "v1": Dictionary with status, error (if any), and elapsed time + - "v2": PipelineResponse object with structured response data + + +**Raises**: + +- `Exception` - If the pipeline execution fails, times out, or encounters + errors during polling. + + +**Notes**: + + - The method starts with run_async and then polls for completion + - wait_time may increase up to 60 seconds between polling attempts + - For v2 responses, use PipelineResponse methods to access results + +#### run\_async + +```python +def run_async(data: Union[Text, Dict], + data_asset: Optional[Union[Text, Dict]] = None, + name: Text = "pipeline_process", + batch_mode: bool = True, + version: Optional[Text] = None, + response_version: Text = "v2", + **kwargs) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L424) + +Runs asynchronously a pipeline call. + +**Arguments**: + +- `data` _Union[Text, Dict]_ - link to the input data +- `data_asset` _Optional[Union[Text, Dict]], optional_ - Data asset to be processed by the pipeline. Defaults to None. +- `name` _Text, optional_ - ID given to a call. Defaults to "pipeline_process". +- `batch_mode` _bool, optional_ - Whether to run the pipeline in batch mode or online. Defaults to True. +- `version` _Optional[Text], optional_ - Version of the pipeline. Defaults to None. +- `response_version` _Text, optional_ - Version of the response. Defaults to "v2". +- `kwargs` - A dictionary of keyword arguments. The keys are the argument names + + +**Returns**: + +- `Dict` - polling URL in response + +#### update + +```python +def update(pipeline: Union[Text, Dict], + save_as_asset: bool = False, + api_key: Optional[Text] = None, + name: Optional[Text] = None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L509) + +Update Pipeline + +**Arguments**: + +- `pipeline` _Union[Text, Dict]_ - Pipeline as a Python dictionary or in a JSON file +- `save_as_asset` _bool, optional_ - Save as asset (True) or draft (False). Defaults to False. +- `api_key` _Optional[Text], optional_ - Team API Key to create the Pipeline. Defaults to None. + + +**Raises**: + +- `Exception` - Make sure the pipeline to be save is in a JSON file. + +#### delete + +```python +def delete() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L573) + +Delete this pipeline from the platform. + +This method permanently removes the pipeline from the aiXplain platform. +The operation cannot be undone. + +**Raises**: + +- `Exception` - If deletion fails, which can happen if: + - The pipeline doesn't exist + - The user doesn't have permission to delete it + - The API request fails + - The server returns a non-200 status code + + +**Notes**: + + - This operation is permanent and cannot be undone + - Only the pipeline owner can delete it + - Uses the team API key for authentication + +#### save + +```python +def save(pipeline: Optional[Union[Text, Dict]] = None, + save_as_asset: bool = False, + api_key: Optional[Text] = None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L606) + +Update and Save Pipeline + +**Arguments**: + +- `pipeline` _Optional[Union[Text, Dict]]_ - Pipeline as a Python dictionary or in a JSON file +- `save_as_asset` _bool, optional_ - Save as asset (True) or draft (False). Defaults to False. +- `api_key` _Optional[Text], optional_ - Team API Key to create the Pipeline. Defaults to None. + + +**Raises**: + +- `Exception` - Make sure the pipeline to be save is in a JSON file. + +#### deploy + +```python +def deploy(api_key: Optional[Text] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L662) + +Deploy the Pipeline. + +This method overrides the deploy method in DeployableMixin to handle +Pipeline-specific deployment functionality. + +**Arguments**: + +- `api_key` _Optional[Text], optional_ - Team API Key to deploy the Pipeline. Defaults to None. + +#### \_\_repr\_\_ + +```python +def __repr__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/asset.py#L681) + +Return a string representation of the Pipeline instance. + +**Returns**: + +- `str` - A string in the format "Pipeline: <name> (id=<id>)". + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/default.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/default.md new file mode 100644 index 000000000..60c8d0c40 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/default.md @@ -0,0 +1,45 @@ +--- +sidebar_label: default +title: aixplain.v1.modules.pipeline.default +--- + +### DefaultPipeline Objects + +```python +class DefaultPipeline(PipelineAsset, DesignerPipeline) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/default.py#L6) + +DefaultPipeline is a subclass of PipelineAsset and DesignerPipeline. + +#### \_\_init\_\_ + +```python +def __init__(*args, **kwargs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/default.py#L9) + +Initialize the DefaultPipeline. + +#### save + +```python +def save(*args, **kwargs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/default.py#L14) + +Save the DefaultPipeline. + +#### to\_dict + +```python +def to_dict() -> dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/default.py#L20) + +Convert the DefaultPipeline to a dictionary. + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/base.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/base.md new file mode 100644 index 000000000..51d5832e9 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/base.md @@ -0,0 +1,138 @@ +--- +sidebar_label: base +title: aixplain.v1.modules.pipeline.designer.base +--- + +### Param Objects + +```python +class Param(Serializable) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L28) + +Param class, this class will be used to create the parameters of the node. + +#### attach\_to + +```python +def attach_to(node: "Node") -> "Param" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L56) + +Attach the param to the node. + +**Arguments**: + +- `node`: the node + +**Returns**: + +the param + +#### link + +```python +def link(to_param: "Param") -> "Param" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L72) + +Link the output of the param to the input of another param. + +**Arguments**: + +- `to_param`: the input param + +**Returns**: + +the param + +#### back\_link + +```python +def back_link(from_param: "Param") -> "Param" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L82) + +Link the input of the param to the output of another param. + +**Arguments**: + +- `from_param`: the output param + +**Returns**: + +the param + +### Link Objects + +```python +class Link(Serializable) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L114) + +Link class, this class will be used to link the output of the node to the +input of another node. + +#### attach\_to + +```python +def attach_to(pipeline: "DesignerPipeline") +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L197) + +Attach the link to the pipeline. + +**Arguments**: + +- `pipeline`: the pipeline + +### ParamProxy Objects + +```python +class ParamProxy(Serializable) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L228) + +#### special\_prompt\_handling + +```python +def special_prompt_handling(code: str, value: str) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L276) + +This method will handle the special prompt handling for asset nodes +having `text-generation` function type. + +### Node Objects + +```python +class Node(Generic[TI, TO], Serializable) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L347) + +Node class is the base class for all the nodes in the pipeline. This class +will be used to create the nodes and link them together. + +#### attach\_to + +```python +def attach_to(pipeline: "DesignerPipeline") +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/base.py#L379) + +Attach the node to the pipeline. + +**Arguments**: + +- `pipeline`: the pipeline + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/enums.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/enums.md new file mode 100644 index 000000000..7b192e522 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/enums.md @@ -0,0 +1,5 @@ +--- +sidebar_label: enums +title: aixplain.v1.modules.pipeline.designer.enums +--- + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/init.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/init.md new file mode 100644 index 000000000..24183ea04 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/init.md @@ -0,0 +1,6 @@ +--- +draft: true +sidebar_label: designer +title: aixplain.v1.modules.pipeline.designer +--- + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/mixins.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/mixins.md new file mode 100644 index 000000000..d6e32761c --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/mixins.md @@ -0,0 +1,107 @@ +--- +sidebar_label: mixins +title: aixplain.v1.modules.pipeline.designer.mixins +--- + +### LinkableMixin Objects + +```python +class LinkableMixin() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/mixins.py#L5) + +Linkable mixin class, this class will be used to link the output of the +node to the input of another node. + +This class will be used to link the output of the node to the input of +another node. + +#### link + +```python +def link(to_node: Node, from_param: Union[str, Param], + to_param: Union[str, Param]) -> Link +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/mixins.py#L13) + +Link the output of the node to the input of another node. This method + +will link the output of the node to the input of another node. + +**Arguments**: + +- `to_node`: the node to link to the output +- `from_param`: the output parameter or the code of the output +parameter +- `to_param`: the input parameter or the code of the input parameter + +**Returns**: + +the link + +### RoutableMixin Objects + +```python +class RoutableMixin() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/mixins.py#L37) + +Routable mixin class, this class will be used to route the input data to +different nodes based on the input data type. + +#### route + +```python +def route(*params: Param) -> Node +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/mixins.py#L42) + +Route the input data to different nodes based on the input data type. + +This method will automatically link the input data to the output data +of the node. + +**Arguments**: + +- `params`: the output parameters + +**Returns**: + +the router node + +### OutputableMixin Objects + +```python +class OutputableMixin() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/mixins.py#L59) + +Outputable mixin class, this class will be used to link the output of the +node to the output node of the pipeline. + +#### use\_output + +```python +def use_output(param: Union[str, Param]) -> Node +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/mixins.py#L64) + +Use the output of the node as the output of the pipeline. + +This method will automatically link the output of the node to the +output node of the pipeline. + +**Arguments**: + +- `param`: the output parameter or the code of the output parameter + +**Returns**: + +the output node + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/nodes.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/nodes.md new file mode 100644 index 000000000..e9bc76f04 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/nodes.md @@ -0,0 +1,155 @@ +--- +sidebar_label: nodes +title: aixplain.v1.modules.pipeline.designer.nodes +--- + +### AssetNode Objects + +```python +class AssetNode(Node[TI, TO], LinkableMixin, OutputableMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L26) + +Asset node class, this node will be used to fetch the asset from the +aixplain platform and use it in the pipeline. + +`assetId` is required and will be used to fetch the asset from the +aixplain platform. + +Input and output parameters will be automatically added based on the +asset function spec. + +### Input Objects + +```python +class Input(Node[InputInputs, InputOutputs], LinkableMixin, RoutableMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L182) + +Input node class, this node will be used to input the data to the +pipeline. + +Input nodes has only one output parameter called `input`. + +`data` is a special convenient parameter that will be uploaded to the +aixplain platform and the link will be passed as the input to the node. + +### Output Objects + +```python +class Output(Node[OutputInputs, OutputOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L233) + +Output node class, this node will be used to output the result of the +pipeline. + +Output nodes has only one input parameter called `output`. + +### Script Objects + +```python +class Script(Node[TI, TO], LinkableMixin, OutputableMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L255) + +Script node class, this node will be used to run a script on the input +data. + +`script_path` is a special convenient parameter that will be uploaded to +the aixplain platform and the link will be passed as the input to the node. + +### Route Objects + +```python +class Route(Serializable) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L294) + +Route class, this class will be used to route the input data to different +nodes based on the input data type. + +#### \_\_init\_\_ + +```python +def __init__(value: DataType, path: List[Union[Node, int]], + operation: Operation, type: RouteType, **kwargs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L304) + +Post init method to convert the nodes to node numbers if they are +nodes. + +### Router Objects + +```python +class Router(Node[RouterInputs, RouterOutputs], LinkableMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L345) + +Router node class, this node will be used to route the input data to +different nodes based on the input data type. + +### Decision Objects + +```python +class Decision(Node[DecisionInputs, DecisionOutputs], LinkableMixin) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L383) + +Decision node class, this node will be used to make decisions based on +the input data. + +### BaseSegmentor Objects + +```python +class BaseSegmentor(AssetNode[TI, TO]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L432) + +Segmentor node class, this node will be used to segment the input data +into smaller fragments for much easier and efficient processing. + +### BareSegmentor Objects + +```python +class BareSegmentor(BaseSegmentor[SegmentorInputs, SegmentorOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L453) + +Segmentor node class, this node will be used to segment the input data +into smaller fragments for much easier and efficient processing. + +### BaseReconstructor Objects + +```python +class BaseReconstructor(AssetNode[TI, TO]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L464) + +Reconstructor node class, this node will be used to reconstruct the +output of the segmented lines of execution. + +### BareReconstructor Objects + +```python +class BareReconstructor(BaseReconstructor[ReconstructorInputs, + ReconstructorOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/nodes.py#L481) + +Reconstructor node class, this node will be used to reconstruct the +output of the segmented lines of execution. + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/pipeline.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/pipeline.md new file mode 100644 index 000000000..8c374cde4 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/pipeline.md @@ -0,0 +1,474 @@ +--- +sidebar_label: pipeline +title: aixplain.v1.modules.pipeline.designer.pipeline +--- + +### DesignerPipeline Objects + +```python +class DesignerPipeline(Serializable) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L26) + +#### add\_node + +```python +def add_node(node: Node) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L35) + +Add a node to the current pipeline. + +This method will take care of setting the pipeline instance to the +node and setting the node number if it's not set. + +**Arguments**: + +- `node`: the node + +**Returns**: + +the node + +#### add\_nodes + +```python +def add_nodes(*nodes: Node) -> List[Node] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L46) + +Add multiple nodes to the current pipeline. + +**Arguments**: + +- `nodes`: the nodes + +**Returns**: + +the nodes + +#### add\_link + +```python +def add_link(link: Link) -> Link +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L54) + +Add a link to the current pipeline. + +**Arguments**: + +- `link`: the link + +**Returns**: + +the link + +#### serialize + +```python +def serialize() -> dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L61) + +Serialize the pipeline to a dictionary. This method will serialize the + +pipeline to a dictionary. + +**Returns**: + +the pipeline as a dictionary + +#### validate\_nodes + +```python +def validate_nodes() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L85) + +Validate the linkage of the pipeline. This method will validate the + +linkage of the pipeline by applying the following checks: +- All input nodes are linked out +- All output nodes are linked in +- All other nodes are linked in and out + +**Raises**: + +- `ValueError`: if the pipeline is not valid + +#### is\_param\_linked + +```python +def is_param_linked(node, param) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L124) + +Check if the param is linked to another node. This method will check + +if the param is linked to another node. + +**Arguments**: + +- `node`: the node +- `param`: the param + +**Returns**: + +True if the param is linked, False otherwise + +#### is\_param\_set + +```python +def is_param_set(node, param) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L137) + +Check if the param is set. This method will check if the param is set + +or linked to another node. + +**Arguments**: + +- `node`: the node +- `param`: the param + +**Returns**: + +True if the param is set, False otherwise + +#### special\_prompt\_validation + +```python +def special_prompt_validation(node: Node) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L146) + +This method will handle the special rule for asset nodes having + +`text-generation` function type where if any prompt variable exists +then the `text` param is not required but the prompt param are. + +**Arguments**: + +- `node`: the node + +**Raises**: + +- `ValueError`: if the pipeline is not valid + +#### validate\_params + +```python +def validate_params() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L163) + +This method will check if all required params are either set or linked + +**Raises**: + +- `ValueError`: if the pipeline is not valid + +#### validate + +```python +def validate() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L174) + +Validate the pipeline. This method will validate the pipeline by + +series of checks: +- Validate all nodes are linked correctly +- Validate all required params are set or linked + +Any other validation checks can be added here. + +**Raises**: + +- `ValueError`: if the pipeline is not valid + +#### get\_link + +```python +def get_link(from_node: int, to_node: int) -> Link +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L187) + +Get the link between two nodes. This method will return the link + +between two nodes. + +**Arguments**: + +- `from_node`: the from node number +- `to_node`: the to node number + +**Returns**: + +the link + +#### get\_node + +```python +def get_node(node_number: int) -> Node +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L200) + +Get the node by its number. This method will return the node with the + +given number. + +**Arguments**: + +- `node_number`: the node number + +**Returns**: + +the node + +#### auto\_infer + +```python +def auto_infer() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L209) + +Automatically infer the data types of the nodes in the pipeline. +This method will automatically infer the data types of the nodes in the +pipeline by traversing the pipeline and setting the data types of the +nodes based on the data types of the connected nodes. + +#### asset + +```python +def asset(asset_id: str, + *args, + asset_class: Type[T] = AssetNode, + **kwargs) -> T +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L218) + +Shortcut to create an asset node for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. + +**Arguments**: + +- `kwargs`: keyword arguments + +**Returns**: + +the node + +#### utility + +```python +def utility(asset_id: str, + *args, + asset_class: Type[T] = Utility, + **kwargs) -> T +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L228) + +Shortcut to create an utility nodes for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. + +**Arguments**: + +- `kwargs`: keyword arguments + +**Returns**: + +the node + +#### decision + +```python +def decision(*args, **kwargs) -> Decision +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L241) + +Shortcut to create an decision node for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. + +**Arguments**: + +- `kwargs`: keyword arguments + +**Returns**: + +the node + +#### script + +```python +def script(*args, **kwargs) -> Script +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L251) + +Shortcut to create an script node for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. + +**Arguments**: + +- `kwargs`: keyword arguments + +**Returns**: + +the node + +#### input + +```python +def input(*args, **kwargs) -> Input +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L261) + +Shortcut to create an input node for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. + +**Arguments**: + +- `kwargs`: keyword arguments + +**Returns**: + +the node + +#### output + +```python +def output(*args, **kwargs) -> Output +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L271) + +Shortcut to create an output node for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. + +**Arguments**: + +- `kwargs`: keyword arguments + +**Returns**: + +the node + +#### router + +```python +def router(routes: Tuple[DataType, Node], *args, **kwargs) -> Router +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L281) + +Shortcut to create an decision node for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. The routes will be handled specially and will be +converted to Route instances in a convenient way. + +**Arguments**: + +- `routes`: the routes +- `kwargs`: keyword arguments + +**Returns**: + +the node + +#### bare\_reconstructor + +```python +def bare_reconstructor(*args, **kwargs) -> BareReconstructor +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L302) + +Shortcut to create an reconstructor node for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. + +**Arguments**: + +- `kwargs`: keyword arguments + +**Returns**: + +the node + +#### bare\_segmentor + +```python +def bare_segmentor(*args, **kwargs) -> BareSegmentor +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L312) + +Shortcut to create an segmentor node for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. + +**Arguments**: + +- `kwargs`: keyword arguments + +**Returns**: + +the node + +#### metric + +```python +def metric(*args, **kwargs) -> BareMetric +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/pipeline.py#L322) + +Shortcut to create an metric node for the current pipeline. + +All params will be passed as keyword arguments to the node +constructor. + +**Arguments**: + +- `kwargs`: keyword arguments + +**Returns**: + +the node + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/utils.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/utils.md new file mode 100644 index 000000000..78b65bcad --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/designer/utils.md @@ -0,0 +1,23 @@ +--- +sidebar_label: utils +title: aixplain.v1.modules.pipeline.designer.utils +--- + +#### find\_prompt\_params + +```python +def find_prompt_params(prompt: str) -> List[str] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/designer/utils.py#L5) + +This method will find the prompt parameters in the prompt string. + +**Arguments**: + +- `prompt`: the prompt string + +**Returns**: + +list of prompt parameters + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/init.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/init.md new file mode 100644 index 000000000..10cd5525f --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/init.md @@ -0,0 +1,6 @@ +--- +draft: true +sidebar_label: pipeline +title: aixplain.v1.modules.pipeline +--- + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/pipeline.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/pipeline.md new file mode 100644 index 000000000..cafea6c5d --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/pipeline.md @@ -0,0 +1,9111 @@ +--- +sidebar_label: pipeline +title: aixplain.v1.modules.pipeline.pipeline +--- + +Auto-generated pipeline module containing node classes and Pipeline factory methods. + +### TextNormalizationInputs Objects + +```python +class TextNormalizationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L24) + +Input parameters for TextNormalization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L31) + +Initialize TextNormalizationInputs. + +### TextNormalizationOutputs Objects + +```python +class TextNormalizationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L39) + +Output parameters for TextNormalization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L44) + +Initialize TextNormalizationOutputs. + +### TextNormalization Objects + +```python +class TextNormalization(AssetNode[TextNormalizationInputs, + TextNormalizationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L50) + +TextNormalization node. + +Converts unstructured or non-standard textual data into a more readable and +uniform format, dealing with abbreviations, numerals, and other non-standard +words. + +InputType: text +OutputType: label + +### ParaphrasingInputs Objects + +```python +class ParaphrasingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L69) + +Input parameters for Paraphrasing. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L75) + +Initialize ParaphrasingInputs. + +### ParaphrasingOutputs Objects + +```python +class ParaphrasingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L82) + +Output parameters for Paraphrasing. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L87) + +Initialize ParaphrasingOutputs. + +### Paraphrasing Objects + +```python +class Paraphrasing(AssetNode[ParaphrasingInputs, ParaphrasingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L93) + +Paraphrasing node. + +Express the meaning of the writer or speaker or something written or spoken +using different words. + +InputType: text +OutputType: text + +### LanguageIdentificationInputs Objects + +```python +class LanguageIdentificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L111) + +Input parameters for LanguageIdentification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L116) + +Initialize LanguageIdentificationInputs. + +### LanguageIdentificationOutputs Objects + +```python +class LanguageIdentificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L122) + +Output parameters for LanguageIdentification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L127) + +Initialize LanguageIdentificationOutputs. + +### LanguageIdentification Objects + +```python +class LanguageIdentification(AssetNode[LanguageIdentificationInputs, + LanguageIdentificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L133) + +LanguageIdentification node. + +Detects the language in which a given text is written, aiding in multilingual +platforms or content localization. + +InputType: text +OutputType: text + +### BenchmarkScoringAsrInputs Objects + +```python +class BenchmarkScoringAsrInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L151) + +Input parameters for BenchmarkScoringAsr. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L158) + +Initialize BenchmarkScoringAsrInputs. + +### BenchmarkScoringAsrOutputs Objects + +```python +class BenchmarkScoringAsrOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L166) + +Output parameters for BenchmarkScoringAsr. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L171) + +Initialize BenchmarkScoringAsrOutputs. + +### BenchmarkScoringAsr Objects + +```python +class BenchmarkScoringAsr(AssetNode[BenchmarkScoringAsrInputs, + BenchmarkScoringAsrOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L177) + +BenchmarkScoringAsr node. + +Benchmark Scoring ASR is a function that evaluates and compares the performance +of automatic speech recognition systems by analyzing their accuracy, speed, and +other relevant metrics against a standardized set of benchmarks. + +InputType: audio +OutputType: label + +### MultiClassTextClassificationInputs Objects + +```python +class MultiClassTextClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L196) + +Input parameters for MultiClassTextClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L202) + +Initialize MultiClassTextClassificationInputs. + +### MultiClassTextClassificationOutputs Objects + +```python +class MultiClassTextClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L209) + +Output parameters for MultiClassTextClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L214) + +Initialize MultiClassTextClassificationOutputs. + +### MultiClassTextClassification Objects + +```python +class MultiClassTextClassification( + AssetNode[MultiClassTextClassificationInputs, + MultiClassTextClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L220) + +MultiClassTextClassification node. + +Multi Class Text Classification is a natural language processing task that +involves categorizing a given text into one of several predefined classes or +categories based on its content. + +InputType: text +OutputType: label + +### SpeechEmbeddingInputs Objects + +```python +class SpeechEmbeddingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L239) + +Input parameters for SpeechEmbedding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L247) + +Initialize SpeechEmbeddingInputs. + +### SpeechEmbeddingOutputs Objects + +```python +class SpeechEmbeddingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L256) + +Output parameters for SpeechEmbedding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L261) + +Initialize SpeechEmbeddingOutputs. + +### SpeechEmbedding Objects + +```python +class SpeechEmbedding(AssetNode[SpeechEmbeddingInputs, + SpeechEmbeddingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L267) + +SpeechEmbedding node. + +Transforms spoken content into a fixed-size vector in a high-dimensional space +that captures the content's essence. Facilitates tasks like speech recognition +and speaker verification. + +InputType: audio +OutputType: text + +### DocumentImageParsingInputs Objects + +```python +class DocumentImageParsingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L286) + +Input parameters for DocumentImageParsing. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L291) + +Initialize DocumentImageParsingInputs. + +### DocumentImageParsingOutputs Objects + +```python +class DocumentImageParsingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L297) + +Output parameters for DocumentImageParsing. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L302) + +Initialize DocumentImageParsingOutputs. + +### DocumentImageParsing Objects + +```python +class DocumentImageParsing(AssetNode[DocumentImageParsingInputs, + DocumentImageParsingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L308) + +DocumentImageParsing node. + +Document Image Parsing is the process of analyzing and converting scanned or +photographed images of documents into structured, machine-readable formats by +identifying and extracting text, layout, and other relevant information. + +InputType: image +OutputType: text + +### TranslationInputs Objects + +```python +class TranslationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L327) + +Input parameters for Translation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L339) + +Initialize TranslationInputs. + +### TranslationOutputs Objects + +```python +class TranslationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L352) + +Output parameters for Translation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L357) + +Initialize TranslationOutputs. + +### Translation Objects + +```python +class Translation(AssetNode[TranslationInputs, TranslationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L363) + +Translation node. + +Converts text from one language to another while maintaining the original +message's essence and context. Crucial for global communication. + +InputType: text +OutputType: text + +### AudioSourceSeparationInputs Objects + +```python +class AudioSourceSeparationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L381) + +Input parameters for AudioSourceSeparation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L386) + +Initialize AudioSourceSeparationInputs. + +### AudioSourceSeparationOutputs Objects + +```python +class AudioSourceSeparationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L392) + +Output parameters for AudioSourceSeparation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L397) + +Initialize AudioSourceSeparationOutputs. + +### AudioSourceSeparation Objects + +```python +class AudioSourceSeparation(AssetNode[AudioSourceSeparationInputs, + AudioSourceSeparationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L403) + +AudioSourceSeparation node. + +Audio Source Separation is the process of separating a mixture (e.g. a pop band +recording) into isolated sounds from individual sources (e.g. just the lead +vocals). + +InputType: audio +OutputType: audio + +### SpeechRecognitionInputs Objects + +```python +class SpeechRecognitionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L422) + +Input parameters for SpeechRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L431) + +Initialize SpeechRecognitionInputs. + +### SpeechRecognitionOutputs Objects + +```python +class SpeechRecognitionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L441) + +Output parameters for SpeechRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L446) + +Initialize SpeechRecognitionOutputs. + +### SpeechRecognition Objects + +```python +class SpeechRecognition(AssetNode[SpeechRecognitionInputs, + SpeechRecognitionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L452) + +SpeechRecognition node. + +Converts spoken language into written text. Useful for transcription services, +voice assistants, and applications requiring voice-to-text capabilities. + +InputType: audio +OutputType: text + +### KeywordSpottingInputs Objects + +```python +class KeywordSpottingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L470) + +Input parameters for KeywordSpotting. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L475) + +Initialize KeywordSpottingInputs. + +### KeywordSpottingOutputs Objects + +```python +class KeywordSpottingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L481) + +Output parameters for KeywordSpotting. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L486) + +Initialize KeywordSpottingOutputs. + +### KeywordSpotting Objects + +```python +class KeywordSpotting(AssetNode[KeywordSpottingInputs, + KeywordSpottingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L492) + +KeywordSpotting node. + +Keyword Spotting is a function that enables the detection and identification of +specific words or phrases within a stream of audio, often used in voice- +activated systems to trigger actions or commands based on recognized keywords. + +InputType: audio +OutputType: label + +### PartOfSpeechTaggingInputs Objects + +```python +class PartOfSpeechTaggingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L511) + +Input parameters for PartOfSpeechTagging. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L517) + +Initialize PartOfSpeechTaggingInputs. + +### PartOfSpeechTaggingOutputs Objects + +```python +class PartOfSpeechTaggingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L524) + +Output parameters for PartOfSpeechTagging. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L529) + +Initialize PartOfSpeechTaggingOutputs. + +### PartOfSpeechTagging Objects + +```python +class PartOfSpeechTagging(AssetNode[PartOfSpeechTaggingInputs, + PartOfSpeechTaggingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L535) + +PartOfSpeechTagging node. + +Part of Speech Tagging is a natural language processing task that involves +assigning each word in a sentence its corresponding part of speech, such as +noun, verb, adjective, or adverb, based on its role and context within the +sentence. + +InputType: text +OutputType: label + +### ReferencelessAudioGenerationMetricInputs Objects + +```python +class ReferencelessAudioGenerationMetricInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L555) + +Input parameters for ReferencelessAudioGenerationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L562) + +Initialize ReferencelessAudioGenerationMetricInputs. + +### ReferencelessAudioGenerationMetricOutputs Objects + +```python +class ReferencelessAudioGenerationMetricOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L570) + +Output parameters for ReferencelessAudioGenerationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L575) + +Initialize ReferencelessAudioGenerationMetricOutputs. + +### ReferencelessAudioGenerationMetric Objects + +```python +class ReferencelessAudioGenerationMetric( + BaseMetric[ReferencelessAudioGenerationMetricInputs, + ReferencelessAudioGenerationMetricOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L581) + +ReferencelessAudioGenerationMetric node. + +The Referenceless Audio Generation Metric is a tool designed to evaluate the +quality of generated audio content without the need for a reference or original +audio sample for comparison. + +InputType: text +OutputType: text + +### VoiceActivityDetectionInputs Objects + +```python +class VoiceActivityDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L602) + +Input parameters for VoiceActivityDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L611) + +Initialize VoiceActivityDetectionInputs. + +### VoiceActivityDetectionOutputs Objects + +```python +class VoiceActivityDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L621) + +Output parameters for VoiceActivityDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L627) + +Initialize VoiceActivityDetectionOutputs. + +### VoiceActivityDetection Objects + +```python +class VoiceActivityDetection(BaseSegmentor[VoiceActivityDetectionInputs, + VoiceActivityDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L634) + +VoiceActivityDetection node. + +Determines when a person is speaking in an audio clip. It's an essential +preprocessing step for other audio-related tasks. + +InputType: audio +OutputType: audio + +### SentimentAnalysisInputs Objects + +```python +class SentimentAnalysisInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L652) + +Input parameters for SentimentAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L660) + +Initialize SentimentAnalysisInputs. + +### SentimentAnalysisOutputs Objects + +```python +class SentimentAnalysisOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L669) + +Output parameters for SentimentAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L674) + +Initialize SentimentAnalysisOutputs. + +### SentimentAnalysis Objects + +```python +class SentimentAnalysis(AssetNode[SentimentAnalysisInputs, + SentimentAnalysisOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L680) + +SentimentAnalysis node. + +Determines the sentiment or emotion (e.g., positive, negative, neutral) of a +piece of text, aiding in understanding user feedback or market sentiment. + +InputType: text +OutputType: label + +### SubtitlingInputs Objects + +```python +class SubtitlingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L698) + +Input parameters for Subtitling. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L708) + +Initialize SubtitlingInputs. + +### SubtitlingOutputs Objects + +```python +class SubtitlingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L719) + +Output parameters for Subtitling. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L724) + +Initialize SubtitlingOutputs. + +### Subtitling Objects + +```python +class Subtitling(AssetNode[SubtitlingInputs, SubtitlingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L730) + +Subtitling node. + +Generates accurate subtitles for videos, enhancing accessibility for diverse +audiences. + +InputType: audio +OutputType: text + +### MultiLabelTextClassificationInputs Objects + +```python +class MultiLabelTextClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L748) + +Input parameters for MultiLabelTextClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L754) + +Initialize MultiLabelTextClassificationInputs. + +### MultiLabelTextClassificationOutputs Objects + +```python +class MultiLabelTextClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L761) + +Output parameters for MultiLabelTextClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L766) + +Initialize MultiLabelTextClassificationOutputs. + +### MultiLabelTextClassification Objects + +```python +class MultiLabelTextClassification( + AssetNode[MultiLabelTextClassificationInputs, + MultiLabelTextClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L772) + +MultiLabelTextClassification node. + +Multi Label Text Classification is a natural language processing task where a +given text is analyzed and assigned multiple relevant labels or categories from +a predefined set, allowing for the text to belong to more than one category +simultaneously. + +InputType: text +OutputType: label + +### VisemeGenerationInputs Objects + +```python +class VisemeGenerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L792) + +Input parameters for VisemeGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L800) + +Initialize VisemeGenerationInputs. + +### VisemeGenerationOutputs Objects + +```python +class VisemeGenerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L809) + +Output parameters for VisemeGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L814) + +Initialize VisemeGenerationOutputs. + +### VisemeGeneration Objects + +```python +class VisemeGeneration(AssetNode[VisemeGenerationInputs, + VisemeGenerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L820) + +VisemeGeneration node. + +Viseme Generation is the process of creating visual representations of +phonemes, which are the distinct units of sound in speech, to synchronize lip +movements with spoken words in animations or virtual avatars. + +InputType: text +OutputType: label + +### TextSegmenationInputs Objects + +```python +class TextSegmenationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L839) + +Input parameters for TextSegmenation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L845) + +Initialize TextSegmenationInputs. + +### TextSegmenationOutputs Objects + +```python +class TextSegmenationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L852) + +Output parameters for TextSegmenation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L857) + +Initialize TextSegmenationOutputs. + +### TextSegmenation Objects + +```python +class TextSegmenation(AssetNode[TextSegmenationInputs, + TextSegmenationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L863) + +TextSegmenation node. + +Text Segmentation is the process of dividing a continuous text into meaningful +units, such as words, sentences, or topics, to facilitate easier analysis and +understanding. + +InputType: text +OutputType: text + +### ZeroShotClassificationInputs Objects + +```python +class ZeroShotClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L882) + +Input parameters for ZeroShotClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L889) + +Initialize ZeroShotClassificationInputs. + +### ZeroShotClassificationOutputs Objects + +```python +class ZeroShotClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L897) + +Output parameters for ZeroShotClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L902) + +Initialize ZeroShotClassificationOutputs. + +### ZeroShotClassification Objects + +```python +class ZeroShotClassification(AssetNode[ZeroShotClassificationInputs, + ZeroShotClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L908) + +ZeroShotClassification node. + +InputType: text +OutputType: text + +### TextGenerationInputs Objects + +```python +class TextGenerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L923) + +Input parameters for TextGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L933) + +Initialize TextGenerationInputs. + +### TextGenerationOutputs Objects + +```python +class TextGenerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L944) + +Output parameters for TextGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L949) + +Initialize TextGenerationOutputs. + +### TextGeneration Objects + +```python +class TextGeneration(AssetNode[TextGenerationInputs, TextGenerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L955) + +TextGeneration node. + +Creates coherent and contextually relevant textual content based on prompts or +certain parameters. Useful for chatbots, content creation, and data +augmentation. + +InputType: text +OutputType: text + +### AudioIntentDetectionInputs Objects + +```python +class AudioIntentDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L974) + +Input parameters for AudioIntentDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L979) + +Initialize AudioIntentDetectionInputs. + +### AudioIntentDetectionOutputs Objects + +```python +class AudioIntentDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L985) + +Output parameters for AudioIntentDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L990) + +Initialize AudioIntentDetectionOutputs. + +### AudioIntentDetection Objects + +```python +class AudioIntentDetection(AssetNode[AudioIntentDetectionInputs, + AudioIntentDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L996) + +AudioIntentDetection node. + +Audio Intent Detection is a process that involves analyzing audio signals to +identify and interpret the underlying intentions or purposes behind spoken +words, enabling systems to understand and respond appropriately to human +speech. + +InputType: audio +OutputType: label + +### EntityLinkingInputs Objects + +```python +class EntityLinkingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1016) + +Input parameters for EntityLinking. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1023) + +Initialize EntityLinkingInputs. + +### EntityLinkingOutputs Objects + +```python +class EntityLinkingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1031) + +Output parameters for EntityLinking. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1036) + +Initialize EntityLinkingOutputs. + +### EntityLinking Objects + +```python +class EntityLinking(AssetNode[EntityLinkingInputs, EntityLinkingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1042) + +EntityLinking node. + +Associates identified entities in the text with specific entries in a knowledge +base or database. + +InputType: text +OutputType: label + +### ConnectionInputs Objects + +```python +class ConnectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1060) + +Input parameters for Connection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1065) + +Initialize ConnectionInputs. + +### ConnectionOutputs Objects + +```python +class ConnectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1071) + +Output parameters for Connection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1076) + +Initialize ConnectionOutputs. + +### Connection Objects + +```python +class Connection(AssetNode[ConnectionInputs, ConnectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1082) + +Connection node. + +Connections are integration that allow you to connect your AI agents to +external tools + +InputType: text +OutputType: text + +### VisualQuestionAnsweringInputs Objects + +```python +class VisualQuestionAnsweringInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1100) + +Input parameters for VisualQuestionAnswering. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1107) + +Initialize VisualQuestionAnsweringInputs. + +### VisualQuestionAnsweringOutputs Objects + +```python +class VisualQuestionAnsweringOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1115) + +Output parameters for VisualQuestionAnswering. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1120) + +Initialize VisualQuestionAnsweringOutputs. + +### VisualQuestionAnswering Objects + +```python +class VisualQuestionAnswering(AssetNode[VisualQuestionAnsweringInputs, + VisualQuestionAnsweringOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1126) + +VisualQuestionAnswering node. + +Visual Question Answering (VQA) is a task in artificial intelligence that +involves analyzing an image and providing accurate, contextually relevant +answers to questions posed about the visual content of that image. + +InputType: image +OutputType: video + +### LoglikelihoodInputs Objects + +```python +class LoglikelihoodInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1145) + +Input parameters for Loglikelihood. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1150) + +Initialize LoglikelihoodInputs. + +### LoglikelihoodOutputs Objects + +```python +class LoglikelihoodOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1156) + +Output parameters for Loglikelihood. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1161) + +Initialize LoglikelihoodOutputs. + +### Loglikelihood Objects + +```python +class Loglikelihood(AssetNode[LoglikelihoodInputs, LoglikelihoodOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1167) + +Loglikelihood node. + +The Log Likelihood function measures the probability of observing the given +data under a specific statistical model by taking the natural logarithm of the +likelihood function, thereby transforming the product of probabilities into a +sum, which simplifies the process of optimization and parameter estimation. + +InputType: text +OutputType: number + +### LanguageIdentificationAudioInputs Objects + +```python +class LanguageIdentificationAudioInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1187) + +Input parameters for LanguageIdentificationAudio. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1192) + +Initialize LanguageIdentificationAudioInputs. + +### LanguageIdentificationAudioOutputs Objects + +```python +class LanguageIdentificationAudioOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1198) + +Output parameters for LanguageIdentificationAudio. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1203) + +Initialize LanguageIdentificationAudioOutputs. + +### LanguageIdentificationAudio Objects + +```python +class LanguageIdentificationAudio(AssetNode[LanguageIdentificationAudioInputs, + LanguageIdentificationAudioOutputs] + ) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1209) + +LanguageIdentificationAudio node. + +The Language Identification Audio function analyzes audio input to determine +and identify the language being spoken. + +InputType: audio +OutputType: label + +### FactCheckingInputs Objects + +```python +class FactCheckingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1227) + +Input parameters for FactChecking. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1233) + +Initialize FactCheckingInputs. + +### FactCheckingOutputs Objects + +```python +class FactCheckingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1240) + +Output parameters for FactChecking. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1245) + +Initialize FactCheckingOutputs. + +### FactChecking Objects + +```python +class FactChecking(AssetNode[FactCheckingInputs, FactCheckingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1251) + +FactChecking node. + +Fact Checking is the process of verifying the accuracy and truthfulness of +information, statements, or claims by cross-referencing with reliable sources +and evidence. + +InputType: text +OutputType: label + +### TableQuestionAnsweringInputs Objects + +```python +class TableQuestionAnsweringInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1270) + +Input parameters for TableQuestionAnswering. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1276) + +Initialize TableQuestionAnsweringInputs. + +### TableQuestionAnsweringOutputs Objects + +```python +class TableQuestionAnsweringOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1283) + +Output parameters for TableQuestionAnswering. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1288) + +Initialize TableQuestionAnsweringOutputs. + +### TableQuestionAnswering Objects + +```python +class TableQuestionAnswering(AssetNode[TableQuestionAnsweringInputs, + TableQuestionAnsweringOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1294) + +TableQuestionAnswering node. + +The task of question answering over tables is given an input table (or a set of +tables) T and a natural language question Q (a user query), output the correct +answer A + +InputType: text +OutputType: text + +### SpeechClassificationInputs Objects + +```python +class SpeechClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1313) + +Input parameters for SpeechClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1321) + +Initialize SpeechClassificationInputs. + +### SpeechClassificationOutputs Objects + +```python +class SpeechClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1330) + +Output parameters for SpeechClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1335) + +Initialize SpeechClassificationOutputs. + +### SpeechClassification Objects + +```python +class SpeechClassification(AssetNode[SpeechClassificationInputs, + SpeechClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1341) + +SpeechClassification node. + +Categorizes audio clips based on their content, aiding in content organization +and targeted actions. + +InputType: audio +OutputType: label + +### InverseTextNormalizationInputs Objects + +```python +class InverseTextNormalizationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1359) + +Input parameters for InverseTextNormalization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1364) + +Initialize InverseTextNormalizationInputs. + +### InverseTextNormalizationOutputs Objects + +```python +class InverseTextNormalizationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1370) + +Output parameters for InverseTextNormalization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1375) + +Initialize InverseTextNormalizationOutputs. + +### InverseTextNormalization Objects + +```python +class InverseTextNormalization(AssetNode[InverseTextNormalizationInputs, + InverseTextNormalizationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1381) + +InverseTextNormalization node. + +Inverse Text Normalization is the process of converting spoken or written +language in its normalized form, such as numbers, dates, and abbreviations, +back into their original, more complex or detailed textual representations. + +InputType: text +OutputType: label + +### MultiClassImageClassificationInputs Objects + +```python +class MultiClassImageClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1400) + +Input parameters for MultiClassImageClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1405) + +Initialize MultiClassImageClassificationInputs. + +### MultiClassImageClassificationOutputs Objects + +```python +class MultiClassImageClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1411) + +Output parameters for MultiClassImageClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1416) + +Initialize MultiClassImageClassificationOutputs. + +### MultiClassImageClassification Objects + +```python +class MultiClassImageClassification( + AssetNode[MultiClassImageClassificationInputs, + MultiClassImageClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1422) + +MultiClassImageClassification node. + +Multi Class Image Classification is a machine learning task where an algorithm +is trained to categorize images into one of several predefined classes or +categories based on their visual content. + +InputType: image +OutputType: label + +### AsrGenderClassificationInputs Objects + +```python +class AsrGenderClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1443) + +Input parameters for AsrGenderClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1448) + +Initialize AsrGenderClassificationInputs. + +### AsrGenderClassificationOutputs Objects + +```python +class AsrGenderClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1454) + +Output parameters for AsrGenderClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1459) + +Initialize AsrGenderClassificationOutputs. + +### AsrGenderClassification Objects + +```python +class AsrGenderClassification(AssetNode[AsrGenderClassificationInputs, + AsrGenderClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1465) + +AsrGenderClassification node. + +The ASR Gender Classification function analyzes audio recordings to determine +and classify the speaker's gender based on their voice characteristics. + +InputType: audio +OutputType: label + +### SummarizationInputs Objects + +```python +class SummarizationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1483) + +Input parameters for Summarization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1491) + +Initialize SummarizationInputs. + +### SummarizationOutputs Objects + +```python +class SummarizationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1500) + +Output parameters for Summarization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1505) + +Initialize SummarizationOutputs. + +### Summarization Objects + +```python +class Summarization(AssetNode[SummarizationInputs, SummarizationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1511) + +Summarization node. + +Text summarization is the process of distilling the most important information +from a source (or sources) to produce an abridged version for a particular user +(or users) and task (or tasks) + +InputType: text +OutputType: text + +### TopicModelingInputs Objects + +```python +class TopicModelingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1530) + +Input parameters for TopicModeling. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1537) + +Initialize TopicModelingInputs. + +### TopicModelingOutputs Objects + +```python +class TopicModelingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1545) + +Output parameters for TopicModeling. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1550) + +Initialize TopicModelingOutputs. + +### TopicModeling Objects + +```python +class TopicModeling(AssetNode[TopicModelingInputs, TopicModelingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1556) + +TopicModeling node. + +Topic modeling is a type of statistical modeling for discovering the abstract +“topics” that occur in a collection of documents. + +InputType: text +OutputType: label + +### AudioReconstructionInputs Objects + +```python +class AudioReconstructionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1574) + +Input parameters for AudioReconstruction. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1579) + +Initialize AudioReconstructionInputs. + +### AudioReconstructionOutputs Objects + +```python +class AudioReconstructionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1585) + +Output parameters for AudioReconstruction. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1590) + +Initialize AudioReconstructionOutputs. + +### AudioReconstruction Objects + +```python +class AudioReconstruction(BaseReconstructor[AudioReconstructionInputs, + AudioReconstructionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1596) + +AudioReconstruction node. + +Audio Reconstruction is the process of restoring or recreating audio signals +from incomplete, damaged, or degraded recordings to achieve a high-quality, +accurate representation of the original sound. + +InputType: audio +OutputType: audio + +### TextEmbeddingInputs Objects + +```python +class TextEmbeddingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1615) + +Input parameters for TextEmbedding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1623) + +Initialize TextEmbeddingInputs. + +### TextEmbeddingOutputs Objects + +```python +class TextEmbeddingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1632) + +Output parameters for TextEmbedding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1637) + +Initialize TextEmbeddingOutputs. + +### TextEmbedding Objects + +```python +class TextEmbedding(AssetNode[TextEmbeddingInputs, TextEmbeddingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1643) + +TextEmbedding node. + +Text embedding is a process that converts text into numerical vectors, +capturing the semantic meaning and contextual relationships of words or +phrases, enabling machines to understand and analyze natural language more +effectively. + +InputType: text +OutputType: text + +### DetectLanguageFromTextInputs Objects + +```python +class DetectLanguageFromTextInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1663) + +Input parameters for DetectLanguageFromText. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1668) + +Initialize DetectLanguageFromTextInputs. + +### DetectLanguageFromTextOutputs Objects + +```python +class DetectLanguageFromTextOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1674) + +Output parameters for DetectLanguageFromText. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1679) + +Initialize DetectLanguageFromTextOutputs. + +### DetectLanguageFromText Objects + +```python +class DetectLanguageFromText(AssetNode[DetectLanguageFromTextInputs, + DetectLanguageFromTextOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1685) + +DetectLanguageFromText node. + +Detect Language From Text + +InputType: text +OutputType: label + +### ExtractAudioFromVideoInputs Objects + +```python +class ExtractAudioFromVideoInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1702) + +Input parameters for ExtractAudioFromVideo. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1707) + +Initialize ExtractAudioFromVideoInputs. + +### ExtractAudioFromVideoOutputs Objects + +```python +class ExtractAudioFromVideoOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1713) + +Output parameters for ExtractAudioFromVideo. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1718) + +Initialize ExtractAudioFromVideoOutputs. + +### ExtractAudioFromVideo Objects + +```python +class ExtractAudioFromVideo(AssetNode[ExtractAudioFromVideoInputs, + ExtractAudioFromVideoOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1724) + +ExtractAudioFromVideo node. + +Isolates and extracts audio tracks from video files, aiding in audio analysis +or transcription tasks. + +InputType: video +OutputType: audio + +### SceneDetectionInputs Objects + +```python +class SceneDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1742) + +Input parameters for SceneDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1747) + +Initialize SceneDetectionInputs. + +### SceneDetectionOutputs Objects + +```python +class SceneDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1753) + +Output parameters for SceneDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1758) + +Initialize SceneDetectionOutputs. + +### SceneDetection Objects + +```python +class SceneDetection(AssetNode[SceneDetectionInputs, SceneDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1764) + +SceneDetection node. + +Scene detection is used for detecting transitions between shots in a video to +split it into basic temporal segments. + +InputType: image +OutputType: text + +### TextToImageGenerationInputs Objects + +```python +class TextToImageGenerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1782) + +Input parameters for TextToImageGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1787) + +Initialize TextToImageGenerationInputs. + +### TextToImageGenerationOutputs Objects + +```python +class TextToImageGenerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1793) + +Output parameters for TextToImageGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1798) + +Initialize TextToImageGenerationOutputs. + +### TextToImageGeneration Objects + +```python +class TextToImageGeneration(AssetNode[TextToImageGenerationInputs, + TextToImageGenerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1804) + +TextToImageGeneration node. + +Creates a visual representation based on textual input, turning descriptions +into pictorial forms. Used in creative processes and content generation. + +InputType: text +OutputType: image + +### AutoMaskGenerationInputs Objects + +```python +class AutoMaskGenerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1822) + +Input parameters for AutoMaskGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1827) + +Initialize AutoMaskGenerationInputs. + +### AutoMaskGenerationOutputs Objects + +```python +class AutoMaskGenerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1833) + +Output parameters for AutoMaskGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1838) + +Initialize AutoMaskGenerationOutputs. + +### AutoMaskGeneration Objects + +```python +class AutoMaskGeneration(AssetNode[AutoMaskGenerationInputs, + AutoMaskGenerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1844) + +AutoMaskGeneration node. + +Auto-mask generation refers to the automated process of creating masks in image +processing or computer vision, typically for segmentation tasks. A mask is a +binary or multi-class image that labels different parts of an image, usually +separating the foreground (objects of interest) from the background, or +identifying specific object classes in an image. + +InputType: image +OutputType: label + +### AudioLanguageIdentificationInputs Objects + +```python +class AudioLanguageIdentificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1865) + +Input parameters for AudioLanguageIdentification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1870) + +Initialize AudioLanguageIdentificationInputs. + +### AudioLanguageIdentificationOutputs Objects + +```python +class AudioLanguageIdentificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1876) + +Output parameters for AudioLanguageIdentification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1881) + +Initialize AudioLanguageIdentificationOutputs. + +### AudioLanguageIdentification Objects + +```python +class AudioLanguageIdentification(AssetNode[AudioLanguageIdentificationInputs, + AudioLanguageIdentificationOutputs] + ) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1887) + +AudioLanguageIdentification node. + +Audio Language Identification is a process that involves analyzing an audio +recording to determine the language being spoken. + +InputType: audio +OutputType: label + +### FacialRecognitionInputs Objects + +```python +class FacialRecognitionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1905) + +Input parameters for FacialRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1910) + +Initialize FacialRecognitionInputs. + +### FacialRecognitionOutputs Objects + +```python +class FacialRecognitionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1916) + +Output parameters for FacialRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1921) + +Initialize FacialRecognitionOutputs. + +### FacialRecognition Objects + +```python +class FacialRecognition(AssetNode[FacialRecognitionInputs, + FacialRecognitionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1927) + +FacialRecognition node. + +A facial recognition system is a technology capable of matching a human face +from a digital image or a video frame against a database of faces + +InputType: image +OutputType: label + +### QuestionAnsweringInputs Objects + +```python +class QuestionAnsweringInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1945) + +Input parameters for QuestionAnswering. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1951) + +Initialize QuestionAnsweringInputs. + +### QuestionAnsweringOutputs Objects + +```python +class QuestionAnsweringOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1958) + +Output parameters for QuestionAnswering. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1963) + +Initialize QuestionAnsweringOutputs. + +### QuestionAnswering Objects + +```python +class QuestionAnswering(AssetNode[QuestionAnsweringInputs, + QuestionAnsweringOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1969) + +QuestionAnswering node. + +building systems that automatically answer questions posed by humans in a +natural language usually from a given text + +InputType: text +OutputType: text + +### ImageImpaintingInputs Objects + +```python +class ImageImpaintingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1987) + +Input parameters for ImageImpainting. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1992) + +Initialize ImageImpaintingInputs. + +### ImageImpaintingOutputs Objects + +```python +class ImageImpaintingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L1998) + +Output parameters for ImageImpainting. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2003) + +Initialize ImageImpaintingOutputs. + +### ImageImpainting Objects + +```python +class ImageImpainting(AssetNode[ImageImpaintingInputs, + ImageImpaintingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2009) + +ImageImpainting node. + +Image inpainting is a process that involves filling in missing or damaged parts +of an image in a way that is visually coherent and seamlessly blends with the +surrounding areas, often using advanced algorithms and techniques to restore +the image to its original or intended appearance. + +InputType: image +OutputType: image + +### TextReconstructionInputs Objects + +```python +class TextReconstructionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2029) + +Input parameters for TextReconstruction. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2034) + +Initialize TextReconstructionInputs. + +### TextReconstructionOutputs Objects + +```python +class TextReconstructionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2040) + +Output parameters for TextReconstruction. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2045) + +Initialize TextReconstructionOutputs. + +### TextReconstruction Objects + +```python +class TextReconstruction(BaseReconstructor[TextReconstructionInputs, + TextReconstructionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2051) + +TextReconstruction node. + +Text Reconstruction is a process that involves piecing together fragmented or +incomplete text data to restore it to its original, coherent form. + +InputType: text +OutputType: text + +### ScriptExecutionInputs Objects + +```python +class ScriptExecutionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2069) + +Input parameters for ScriptExecution. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2074) + +Initialize ScriptExecutionInputs. + +### ScriptExecutionOutputs Objects + +```python +class ScriptExecutionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2080) + +Output parameters for ScriptExecution. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2085) + +Initialize ScriptExecutionOutputs. + +### ScriptExecution Objects + +```python +class ScriptExecution(AssetNode[ScriptExecutionInputs, + ScriptExecutionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2091) + +ScriptExecution node. + +Script Execution refers to the process of running a set of programmed +instructions or code within a computing environment, enabling the automated +performance of tasks, calculations, or operations as defined by the script. + +InputType: text +OutputType: text + +### SemanticSegmentationInputs Objects + +```python +class SemanticSegmentationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2110) + +Input parameters for SemanticSegmentation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2115) + +Initialize SemanticSegmentationInputs. + +### SemanticSegmentationOutputs Objects + +```python +class SemanticSegmentationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2121) + +Output parameters for SemanticSegmentation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2126) + +Initialize SemanticSegmentationOutputs. + +### SemanticSegmentation Objects + +```python +class SemanticSegmentation(AssetNode[SemanticSegmentationInputs, + SemanticSegmentationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2132) + +SemanticSegmentation node. + +Semantic segmentation is a computer vision process that involves classifying +each pixel in an image into a predefined category, effectively partitioning the +image into meaningful segments based on the objects or regions they represent. + +InputType: image +OutputType: label + +### AudioEmotionDetectionInputs Objects + +```python +class AudioEmotionDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2151) + +Input parameters for AudioEmotionDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2156) + +Initialize AudioEmotionDetectionInputs. + +### AudioEmotionDetectionOutputs Objects + +```python +class AudioEmotionDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2162) + +Output parameters for AudioEmotionDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2167) + +Initialize AudioEmotionDetectionOutputs. + +### AudioEmotionDetection Objects + +```python +class AudioEmotionDetection(AssetNode[AudioEmotionDetectionInputs, + AudioEmotionDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2173) + +AudioEmotionDetection node. + +Audio Emotion Detection is a technology that analyzes vocal characteristics and +patterns in audio recordings to identify and classify the emotional state of +the speaker. + +InputType: audio +OutputType: label + +### ImageCaptioningInputs Objects + +```python +class ImageCaptioningInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2192) + +Input parameters for ImageCaptioning. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2197) + +Initialize ImageCaptioningInputs. + +### ImageCaptioningOutputs Objects + +```python +class ImageCaptioningOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2203) + +Output parameters for ImageCaptioning. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2208) + +Initialize ImageCaptioningOutputs. + +### ImageCaptioning Objects + +```python +class ImageCaptioning(AssetNode[ImageCaptioningInputs, + ImageCaptioningOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2214) + +ImageCaptioning node. + +Image Captioning is a process that involves generating a textual description of +an image, typically using machine learning models to analyze the visual content +and produce coherent and contextually relevant sentences that describe the +objects, actions, and scenes depicted in the image. + +InputType: image +OutputType: text + +### SplitOnLinebreakInputs Objects + +```python +class SplitOnLinebreakInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2234) + +Input parameters for SplitOnLinebreak. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2239) + +Initialize SplitOnLinebreakInputs. + +### SplitOnLinebreakOutputs Objects + +```python +class SplitOnLinebreakOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2245) + +Output parameters for SplitOnLinebreak. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2251) + +Initialize SplitOnLinebreakOutputs. + +### SplitOnLinebreak Objects + +```python +class SplitOnLinebreak(BaseSegmentor[SplitOnLinebreakInputs, + SplitOnLinebreakOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2258) + +SplitOnLinebreak node. + +The "Split On Linebreak" function divides a given string into a list of +substrings, using linebreaks (newline characters) as the points of separation. + +InputType: text +OutputType: text + +### StyleTransferInputs Objects + +```python +class StyleTransferInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2276) + +Input parameters for StyleTransfer. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2281) + +Initialize StyleTransferInputs. + +### StyleTransferOutputs Objects + +```python +class StyleTransferOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2287) + +Output parameters for StyleTransfer. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2292) + +Initialize StyleTransferOutputs. + +### StyleTransfer Objects + +```python +class StyleTransfer(AssetNode[StyleTransferInputs, StyleTransferOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2298) + +StyleTransfer node. + +Style Transfer is a technique in artificial intelligence that applies the +visual style of one image (such as the brushstrokes of a famous painting) to +the content of another image, effectively blending the artistic elements of the +first image with the subject matter of the second. + +InputType: image +OutputType: image + +### BaseModelInputs Objects + +```python +class BaseModelInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2318) + +Input parameters for BaseModel. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2324) + +Initialize BaseModelInputs. + +### BaseModelOutputs Objects + +```python +class BaseModelOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2331) + +Output parameters for BaseModel. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2336) + +Initialize BaseModelOutputs. + +### BaseModel Objects + +```python +class BaseModel(AssetNode[BaseModelInputs, BaseModelOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2342) + +BaseModel node. + +The Base-Model function serves as a foundational framework designed to provide +essential features and capabilities upon which more specialized or advanced +models can be built and customized. + +InputType: text +OutputType: text + +### ImageManipulationInputs Objects + +```python +class ImageManipulationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2361) + +Input parameters for ImageManipulation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2367) + +Initialize ImageManipulationInputs. + +### ImageManipulationOutputs Objects + +```python +class ImageManipulationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2374) + +Output parameters for ImageManipulation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2379) + +Initialize ImageManipulationOutputs. + +### ImageManipulation Objects + +```python +class ImageManipulation(AssetNode[ImageManipulationInputs, + ImageManipulationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2385) + +ImageManipulation node. + +Image Manipulation refers to the process of altering or enhancing digital +images using various techniques and tools to achieve desired visual effects, +correct imperfections, or transform the image's appearance. + +InputType: image +OutputType: image + +### VideoEmbeddingInputs Objects + +```python +class VideoEmbeddingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2404) + +Input parameters for VideoEmbedding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2410) + +Initialize VideoEmbeddingInputs. + +### VideoEmbeddingOutputs Objects + +```python +class VideoEmbeddingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2417) + +Output parameters for VideoEmbedding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2422) + +Initialize VideoEmbeddingOutputs. + +### VideoEmbedding Objects + +```python +class VideoEmbedding(AssetNode[VideoEmbeddingInputs, VideoEmbeddingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2428) + +VideoEmbedding node. + +Video Embedding is a process that transforms video content into a fixed- +dimensional vector representation, capturing essential features and patterns to +facilitate tasks such as retrieval, classification, and recommendation. + +InputType: video +OutputType: embedding + +### DialectDetectionInputs Objects + +```python +class DialectDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2447) + +Input parameters for DialectDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2453) + +Initialize DialectDetectionInputs. + +### DialectDetectionOutputs Objects + +```python +class DialectDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2460) + +Output parameters for DialectDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2465) + +Initialize DialectDetectionOutputs. + +### DialectDetection Objects + +```python +class DialectDetection(AssetNode[DialectDetectionInputs, + DialectDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2471) + +DialectDetection node. + +Identifies specific dialects within a language, aiding in localized content +creation or user experience personalization. + +InputType: audio +OutputType: text + +### FillTextMaskInputs Objects + +```python +class FillTextMaskInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2489) + +Input parameters for FillTextMask. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2497) + +Initialize FillTextMaskInputs. + +### FillTextMaskOutputs Objects + +```python +class FillTextMaskOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2506) + +Output parameters for FillTextMask. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2511) + +Initialize FillTextMaskOutputs. + +### FillTextMask Objects + +```python +class FillTextMask(AssetNode[FillTextMaskInputs, FillTextMaskOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2517) + +FillTextMask node. + +Completes missing parts of a text based on the context, ideal for content +generation or data augmentation tasks. + +InputType: text +OutputType: text + +### ActivityDetectionInputs Objects + +```python +class ActivityDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2535) + +Input parameters for ActivityDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2540) + +Initialize ActivityDetectionInputs. + +### ActivityDetectionOutputs Objects + +```python +class ActivityDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2546) + +Output parameters for ActivityDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2551) + +Initialize ActivityDetectionOutputs. + +### ActivityDetection Objects + +```python +class ActivityDetection(AssetNode[ActivityDetectionInputs, + ActivityDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2557) + +ActivityDetection node. + +detection of the presence or absence of human speech, used in speech +processing. + +InputType: audio +OutputType: label + +### SelectSupplierForTranslationInputs Objects + +```python +class SelectSupplierForTranslationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2575) + +Input parameters for SelectSupplierForTranslation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2581) + +Initialize SelectSupplierForTranslationInputs. + +### SelectSupplierForTranslationOutputs Objects + +```python +class SelectSupplierForTranslationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2588) + +Output parameters for SelectSupplierForTranslation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2593) + +Initialize SelectSupplierForTranslationOutputs. + +### SelectSupplierForTranslation Objects + +```python +class SelectSupplierForTranslation( + AssetNode[SelectSupplierForTranslationInputs, + SelectSupplierForTranslationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2599) + +SelectSupplierForTranslation node. + +Supplier For Translation + +InputType: text +OutputType: label + +### ExpressionDetectionInputs Objects + +```python +class ExpressionDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2616) + +Input parameters for ExpressionDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2621) + +Initialize ExpressionDetectionInputs. + +### ExpressionDetectionOutputs Objects + +```python +class ExpressionDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2627) + +Output parameters for ExpressionDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2632) + +Initialize ExpressionDetectionOutputs. + +### ExpressionDetection Objects + +```python +class ExpressionDetection(AssetNode[ExpressionDetectionInputs, + ExpressionDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2638) + +ExpressionDetection node. + +Expression Detection is the process of identifying and analyzing facial +expressions to interpret emotions or intentions using AI and computer vision +techniques. + +InputType: text +OutputType: label + +### VideoGenerationInputs Objects + +```python +class VideoGenerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2657) + +Input parameters for VideoGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2662) + +Initialize VideoGenerationInputs. + +### VideoGenerationOutputs Objects + +```python +class VideoGenerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2668) + +Output parameters for VideoGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2673) + +Initialize VideoGenerationOutputs. + +### VideoGeneration Objects + +```python +class VideoGeneration(AssetNode[VideoGenerationInputs, + VideoGenerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2679) + +VideoGeneration node. + +Produces video content based on specific inputs or datasets. Can be used for +simulations, animations, or even deepfake detection. + +InputType: text +OutputType: video + +### ImageAnalysisInputs Objects + +```python +class ImageAnalysisInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2697) + +Input parameters for ImageAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2702) + +Initialize ImageAnalysisInputs. + +### ImageAnalysisOutputs Objects + +```python +class ImageAnalysisOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2708) + +Output parameters for ImageAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2713) + +Initialize ImageAnalysisOutputs. + +### ImageAnalysis Objects + +```python +class ImageAnalysis(AssetNode[ImageAnalysisInputs, ImageAnalysisOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2719) + +ImageAnalysis node. + +Image analysis is the extraction of meaningful information from images + +InputType: image +OutputType: label + +### NoiseRemovalInputs Objects + +```python +class NoiseRemovalInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2736) + +Input parameters for NoiseRemoval. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2741) + +Initialize NoiseRemovalInputs. + +### NoiseRemovalOutputs Objects + +```python +class NoiseRemovalOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2747) + +Output parameters for NoiseRemoval. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2752) + +Initialize NoiseRemovalOutputs. + +### NoiseRemoval Objects + +```python +class NoiseRemoval(AssetNode[NoiseRemovalInputs, NoiseRemovalOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2758) + +NoiseRemoval node. + +Noise Removal is a process that involves identifying and eliminating unwanted +random variations or disturbances from an audio signal to enhance the clarity +and quality of the underlying information. + +InputType: audio +OutputType: audio + +### ImageAndVideoAnalysisInputs Objects + +```python +class ImageAndVideoAnalysisInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2777) + +Input parameters for ImageAndVideoAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2782) + +Initialize ImageAndVideoAnalysisInputs. + +### ImageAndVideoAnalysisOutputs Objects + +```python +class ImageAndVideoAnalysisOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2788) + +Output parameters for ImageAndVideoAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2793) + +Initialize ImageAndVideoAnalysisOutputs. + +### ImageAndVideoAnalysis Objects + +```python +class ImageAndVideoAnalysis(AssetNode[ImageAndVideoAnalysisInputs, + ImageAndVideoAnalysisOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2799) + +ImageAndVideoAnalysis node. + +InputType: image +OutputType: text + +### KeywordExtractionInputs Objects + +```python +class KeywordExtractionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2814) + +Input parameters for KeywordExtraction. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2822) + +Initialize KeywordExtractionInputs. + +### KeywordExtractionOutputs Objects + +```python +class KeywordExtractionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2831) + +Output parameters for KeywordExtraction. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2836) + +Initialize KeywordExtractionOutputs. + +### KeywordExtraction Objects + +```python +class KeywordExtraction(AssetNode[KeywordExtractionInputs, + KeywordExtractionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2842) + +KeywordExtraction node. + +It helps concise the text and obtain relevant keywords Example use-cases are +finding topics of interest from a news article and identifying the problems +based on customer reviews and so. + +InputType: text +OutputType: label + +### SplitOnSilenceInputs Objects + +```python +class SplitOnSilenceInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2861) + +Input parameters for SplitOnSilence. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2866) + +Initialize SplitOnSilenceInputs. + +### SplitOnSilenceOutputs Objects + +```python +class SplitOnSilenceOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2872) + +Output parameters for SplitOnSilence. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2877) + +Initialize SplitOnSilenceOutputs. + +### SplitOnSilence Objects + +```python +class SplitOnSilence(AssetNode[SplitOnSilenceInputs, SplitOnSilenceOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2883) + +SplitOnSilence node. + +The "Split On Silence" function divides an audio recording into separate +segments based on periods of silence, allowing for easier editing and analysis +of individual sections. + +InputType: audio +OutputType: audio + +### IntentRecognitionInputs Objects + +```python +class IntentRecognitionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2902) + +Input parameters for IntentRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2909) + +Initialize IntentRecognitionInputs. + +### IntentRecognitionOutputs Objects + +```python +class IntentRecognitionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2917) + +Output parameters for IntentRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2922) + +Initialize IntentRecognitionOutputs. + +### IntentRecognition Objects + +```python +class IntentRecognition(AssetNode[IntentRecognitionInputs, + IntentRecognitionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2928) + +IntentRecognition node. + +classify the user's utterance (provided in varied natural language) or text +into one of several predefined classes, that is, intents. + +InputType: audio +OutputType: text + +### DepthEstimationInputs Objects + +```python +class DepthEstimationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2946) + +Input parameters for DepthEstimation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2952) + +Initialize DepthEstimationInputs. + +### DepthEstimationOutputs Objects + +```python +class DepthEstimationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2959) + +Output parameters for DepthEstimation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2964) + +Initialize DepthEstimationOutputs. + +### DepthEstimation Objects + +```python +class DepthEstimation(AssetNode[DepthEstimationInputs, + DepthEstimationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2970) + +DepthEstimation node. + +Depth estimation is a computational process that determines the distance of +objects from a viewpoint, typically using visual data from cameras or sensors +to create a three-dimensional understanding of a scene. + +InputType: image +OutputType: text + +### ConnectorInputs Objects + +```python +class ConnectorInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2989) + +Input parameters for Connector. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L2994) + +Initialize ConnectorInputs. + +### ConnectorOutputs Objects + +```python +class ConnectorOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3000) + +Output parameters for Connector. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3005) + +Initialize ConnectorOutputs. + +### Connector Objects + +```python +class Connector(AssetNode[ConnectorInputs, ConnectorOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3011) + +Connector node. + +Connectors are integration that allow you to connect your AI agents to external +tools + +InputType: text +OutputType: text + +### SpeakerRecognitionInputs Objects + +```python +class SpeakerRecognitionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3029) + +Input parameters for SpeakerRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3037) + +Initialize SpeakerRecognitionInputs. + +### SpeakerRecognitionOutputs Objects + +```python +class SpeakerRecognitionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3046) + +Output parameters for SpeakerRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3051) + +Initialize SpeakerRecognitionOutputs. + +### SpeakerRecognition Objects + +```python +class SpeakerRecognition(AssetNode[SpeakerRecognitionInputs, + SpeakerRecognitionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3057) + +SpeakerRecognition node. + +In speaker identification, an utterance from an unknown speaker is analyzed and +compared with speech models of known speakers. + +InputType: audio +OutputType: label + +### SyntaxAnalysisInputs Objects + +```python +class SyntaxAnalysisInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3075) + +Input parameters for SyntaxAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3082) + +Initialize SyntaxAnalysisInputs. + +### SyntaxAnalysisOutputs Objects + +```python +class SyntaxAnalysisOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3090) + +Output parameters for SyntaxAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3095) + +Initialize SyntaxAnalysisOutputs. + +### SyntaxAnalysis Objects + +```python +class SyntaxAnalysis(AssetNode[SyntaxAnalysisInputs, SyntaxAnalysisOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3101) + +SyntaxAnalysis node. + +Is the process of analyzing natural language with the rules of a formal +grammar. Grammatical rules are applied to categories and groups of words, not +individual words. Syntactic analysis basically assigns a semantic structure to +text. + +InputType: text +OutputType: text + +### EntitySentimentAnalysisInputs Objects + +```python +class EntitySentimentAnalysisInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3121) + +Input parameters for EntitySentimentAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3126) + +Initialize EntitySentimentAnalysisInputs. + +### EntitySentimentAnalysisOutputs Objects + +```python +class EntitySentimentAnalysisOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3132) + +Output parameters for EntitySentimentAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3137) + +Initialize EntitySentimentAnalysisOutputs. + +### EntitySentimentAnalysis Objects + +```python +class EntitySentimentAnalysis(AssetNode[EntitySentimentAnalysisInputs, + EntitySentimentAnalysisOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3143) + +EntitySentimentAnalysis node. + +Entity Sentiment Analysis combines both entity analysis and sentiment analysis +and attempts to determine the sentiment (positive or negative) expressed about +entities within the text. + +InputType: text +OutputType: label + +### ClassificationMetricInputs Objects + +```python +class ClassificationMetricInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3162) + +Input parameters for ClassificationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3171) + +Initialize ClassificationMetricInputs. + +### ClassificationMetricOutputs Objects + +```python +class ClassificationMetricOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3181) + +Output parameters for ClassificationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3186) + +Initialize ClassificationMetricOutputs. + +### ClassificationMetric Objects + +```python +class ClassificationMetric(BaseMetric[ClassificationMetricInputs, + ClassificationMetricOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3192) + +ClassificationMetric node. + +A Classification Metric is a quantitative measure used to evaluate the quality +and effectiveness of classification models. + +InputType: text +OutputType: text + +### TextDetectionInputs Objects + +```python +class TextDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3210) + +Input parameters for TextDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3215) + +Initialize TextDetectionInputs. + +### TextDetectionOutputs Objects + +```python +class TextDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3221) + +Output parameters for TextDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3226) + +Initialize TextDetectionOutputs. + +### TextDetection Objects + +```python +class TextDetection(AssetNode[TextDetectionInputs, TextDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3232) + +TextDetection node. + +detect text regions in the complex background and label them with bounding +boxes. + +InputType: image +OutputType: text + +### GuardrailsInputs Objects + +```python +class GuardrailsInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3250) + +Input parameters for Guardrails. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3255) + +Initialize GuardrailsInputs. + +### GuardrailsOutputs Objects + +```python +class GuardrailsOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3261) + +Output parameters for Guardrails. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3266) + +Initialize GuardrailsOutputs. + +### Guardrails Objects + +```python +class Guardrails(AssetNode[GuardrailsInputs, GuardrailsOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3272) + +Guardrails node. + + Guardrails are governance rules that enforce security, compliance, and +operational best practices, helping prevent mistakes and detect suspicious +activity + +InputType: text +OutputType: text + +### EmotionDetectionInputs Objects + +```python +class EmotionDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3291) + +Input parameters for EmotionDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3299) + +Initialize EmotionDetectionInputs. + +### EmotionDetectionOutputs Objects + +```python +class EmotionDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3308) + +Output parameters for EmotionDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3313) + +Initialize EmotionDetectionOutputs. + +### EmotionDetection Objects + +```python +class EmotionDetection(AssetNode[EmotionDetectionInputs, + EmotionDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3319) + +EmotionDetection node. + +Identifies human emotions from text or audio, enhancing user experience in +chatbots or customer feedback analysis. + +InputType: text +OutputType: label + +### VideoForcedAlignmentInputs Objects + +```python +class VideoForcedAlignmentInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3337) + +Input parameters for VideoForcedAlignment. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3346) + +Initialize VideoForcedAlignmentInputs. + +### VideoForcedAlignmentOutputs Objects + +```python +class VideoForcedAlignmentOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3356) + +Output parameters for VideoForcedAlignment. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3362) + +Initialize VideoForcedAlignmentOutputs. + +### VideoForcedAlignment Objects + +```python +class VideoForcedAlignment(AssetNode[VideoForcedAlignmentInputs, + VideoForcedAlignmentOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3369) + +VideoForcedAlignment node. + +Aligns the transcription of spoken content in a video with its corresponding +timecodes, facilitating subtitle creation. + +InputType: video +OutputType: video + +### ImageContentModerationInputs Objects + +```python +class ImageContentModerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3387) + +Input parameters for ImageContentModeration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3393) + +Initialize ImageContentModerationInputs. + +### ImageContentModerationOutputs Objects + +```python +class ImageContentModerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3400) + +Output parameters for ImageContentModeration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3405) + +Initialize ImageContentModerationOutputs. + +### ImageContentModeration Objects + +```python +class ImageContentModeration(AssetNode[ImageContentModerationInputs, + ImageContentModerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3411) + +ImageContentModeration node. + +Detects and filters out inappropriate or harmful images, essential for +platforms with user-generated visual content. + +InputType: image +OutputType: label + +### TextSummarizationInputs Objects + +```python +class TextSummarizationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3429) + +Input parameters for TextSummarization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3437) + +Initialize TextSummarizationInputs. + +### TextSummarizationOutputs Objects + +```python +class TextSummarizationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3446) + +Output parameters for TextSummarization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3451) + +Initialize TextSummarizationOutputs. + +### TextSummarization Objects + +```python +class TextSummarization(AssetNode[TextSummarizationInputs, + TextSummarizationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3457) + +TextSummarization node. + +Extracts the main points from a larger body of text, producing a concise +summary without losing the primary message. + +InputType: text +OutputType: text + +### ImageToVideoGenerationInputs Objects + +```python +class ImageToVideoGenerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3475) + +Input parameters for ImageToVideoGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3481) + +Initialize ImageToVideoGenerationInputs. + +### ImageToVideoGenerationOutputs Objects + +```python +class ImageToVideoGenerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3488) + +Output parameters for ImageToVideoGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3493) + +Initialize ImageToVideoGenerationOutputs. + +### ImageToVideoGeneration Objects + +```python +class ImageToVideoGeneration(AssetNode[ImageToVideoGenerationInputs, + ImageToVideoGenerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3499) + +ImageToVideoGeneration node. + +The Image To Video Generation function transforms a series of static images +into a cohesive, dynamic video sequence, often incorporating transitions, +effects, and synchronization with audio to create a visually engaging +narrative. + +InputType: image +OutputType: video + +### VideoUnderstandingInputs Objects + +```python +class VideoUnderstandingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3519) + +Input parameters for VideoUnderstanding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3528) + +Initialize VideoUnderstandingInputs. + +### VideoUnderstandingOutputs Objects + +```python +class VideoUnderstandingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3538) + +Output parameters for VideoUnderstanding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3543) + +Initialize VideoUnderstandingOutputs. + +### VideoUnderstanding Objects + +```python +class VideoUnderstanding(AssetNode[VideoUnderstandingInputs, + VideoUnderstandingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3549) + +VideoUnderstanding node. + +Video Understanding is the process of analyzing and interpreting video content +to extract meaningful information, such as identifying objects, actions, +events, and contextual relationships within the footage. + +InputType: video +OutputType: text + +### TextGenerationMetricDefaultInputs Objects + +```python +class TextGenerationMetricDefaultInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3568) + +Input parameters for TextGenerationMetricDefault. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3576) + +Initialize TextGenerationMetricDefaultInputs. + +### TextGenerationMetricDefaultOutputs Objects + +```python +class TextGenerationMetricDefaultOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3585) + +Output parameters for TextGenerationMetricDefault. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3590) + +Initialize TextGenerationMetricDefaultOutputs. + +### TextGenerationMetricDefault Objects + +```python +class TextGenerationMetricDefault( + BaseMetric[TextGenerationMetricDefaultInputs, + TextGenerationMetricDefaultOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3596) + +TextGenerationMetricDefault node. + +The "Text Generation Metric Default" function provides a standard set of +evaluation metrics for assessing the quality and performance of text generation +models. + +InputType: text +OutputType: text + +### TextToVideoGenerationInputs Objects + +```python +class TextToVideoGenerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3615) + +Input parameters for TextToVideoGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3621) + +Initialize TextToVideoGenerationInputs. + +### TextToVideoGenerationOutputs Objects + +```python +class TextToVideoGenerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3628) + +Output parameters for TextToVideoGeneration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3633) + +Initialize TextToVideoGenerationOutputs. + +### TextToVideoGeneration Objects + +```python +class TextToVideoGeneration(AssetNode[TextToVideoGenerationInputs, + TextToVideoGenerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3639) + +TextToVideoGeneration node. + +Text To Video Generation is a process that converts written descriptions or +scripts into dynamic, visual video content using advanced algorithms and +artificial intelligence. + +InputType: text +OutputType: video + +### VideoLabelDetectionInputs Objects + +```python +class VideoLabelDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3658) + +Input parameters for VideoLabelDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3664) + +Initialize VideoLabelDetectionInputs. + +### VideoLabelDetectionOutputs Objects + +```python +class VideoLabelDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3671) + +Output parameters for VideoLabelDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3676) + +Initialize VideoLabelDetectionOutputs. + +### VideoLabelDetection Objects + +```python +class VideoLabelDetection(AssetNode[VideoLabelDetectionInputs, + VideoLabelDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3682) + +VideoLabelDetection node. + +Identifies and tags objects, scenes, or activities within a video. Useful for +content indexing and recommendation systems. + +InputType: video +OutputType: label + +### TextSpamDetectionInputs Objects + +```python +class TextSpamDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3700) + +Input parameters for TextSpamDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3708) + +Initialize TextSpamDetectionInputs. + +### TextSpamDetectionOutputs Objects + +```python +class TextSpamDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3717) + +Output parameters for TextSpamDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3722) + +Initialize TextSpamDetectionOutputs. + +### TextSpamDetection Objects + +```python +class TextSpamDetection(AssetNode[TextSpamDetectionInputs, + TextSpamDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3728) + +TextSpamDetection node. + +Identifies and filters out unwanted or irrelevant text content, ideal for +moderating user-generated content or ensuring quality in communication +platforms. + +InputType: text +OutputType: label + +### TextContentModerationInputs Objects + +```python +class TextContentModerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3747) + +Input parameters for TextContentModeration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3755) + +Initialize TextContentModerationInputs. + +### TextContentModerationOutputs Objects + +```python +class TextContentModerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3764) + +Output parameters for TextContentModeration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3769) + +Initialize TextContentModerationOutputs. + +### TextContentModeration Objects + +```python +class TextContentModeration(AssetNode[TextContentModerationInputs, + TextContentModerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3775) + +TextContentModeration node. + +Scans and identifies potentially harmful, offensive, or inappropriate textual +content, ensuring safer user environments. + +InputType: text +OutputType: label + +### AudioTranscriptImprovementInputs Objects + +```python +class AudioTranscriptImprovementInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3793) + +Input parameters for AudioTranscriptImprovement. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3803) + +Initialize AudioTranscriptImprovementInputs. + +### AudioTranscriptImprovementOutputs Objects + +```python +class AudioTranscriptImprovementOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3814) + +Output parameters for AudioTranscriptImprovement. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3819) + +Initialize AudioTranscriptImprovementOutputs. + +### AudioTranscriptImprovement Objects + +```python +class AudioTranscriptImprovement(AssetNode[AudioTranscriptImprovementInputs, + AudioTranscriptImprovementOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3825) + +AudioTranscriptImprovement node. + +Refines and corrects transcriptions generated from audio data, improving +readability and accuracy. + +InputType: audio +OutputType: text + +### AudioTranscriptAnalysisInputs Objects + +```python +class AudioTranscriptAnalysisInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3843) + +Input parameters for AudioTranscriptAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3852) + +Initialize AudioTranscriptAnalysisInputs. + +### AudioTranscriptAnalysisOutputs Objects + +```python +class AudioTranscriptAnalysisOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3862) + +Output parameters for AudioTranscriptAnalysis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3867) + +Initialize AudioTranscriptAnalysisOutputs. + +### AudioTranscriptAnalysis Objects + +```python +class AudioTranscriptAnalysis(AssetNode[AudioTranscriptAnalysisInputs, + AudioTranscriptAnalysisOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3873) + +AudioTranscriptAnalysis node. + +Analyzes transcribed audio data for insights, patterns, or specific information +extraction. + +InputType: audio +OutputType: text + +### SpeechNonSpeechClassificationInputs Objects + +```python +class SpeechNonSpeechClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3891) + +Input parameters for SpeechNonSpeechClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3899) + +Initialize SpeechNonSpeechClassificationInputs. + +### SpeechNonSpeechClassificationOutputs Objects + +```python +class SpeechNonSpeechClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3908) + +Output parameters for SpeechNonSpeechClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3913) + +Initialize SpeechNonSpeechClassificationOutputs. + +### SpeechNonSpeechClassification Objects + +```python +class SpeechNonSpeechClassification( + AssetNode[SpeechNonSpeechClassificationInputs, + SpeechNonSpeechClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3919) + +SpeechNonSpeechClassification node. + +Differentiates between speech and non-speech audio segments. Great for editing +software and transcription services to exclude irrelevant audio. + +InputType: audio +OutputType: label + +### AudioGenerationMetricInputs Objects + +```python +class AudioGenerationMetricInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3939) + +Input parameters for AudioGenerationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3947) + +Initialize AudioGenerationMetricInputs. + +### AudioGenerationMetricOutputs Objects + +```python +class AudioGenerationMetricOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3956) + +Output parameters for AudioGenerationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3961) + +Initialize AudioGenerationMetricOutputs. + +### AudioGenerationMetric Objects + +```python +class AudioGenerationMetric(BaseMetric[AudioGenerationMetricInputs, + AudioGenerationMetricOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3967) + +AudioGenerationMetric node. + +The Audio Generation Metric is a quantitative measure used to evaluate the +quality, accuracy, and overall performance of audio generated by artificial +intelligence systems, often considering factors such as fidelity, +intelligibility, and similarity to human-produced audio. + +InputType: text +OutputType: text + +### NamedEntityRecognitionInputs Objects + +```python +class NamedEntityRecognitionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3987) + +Input parameters for NamedEntityRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L3996) + +Initialize NamedEntityRecognitionInputs. + +### NamedEntityRecognitionOutputs Objects + +```python +class NamedEntityRecognitionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4006) + +Output parameters for NamedEntityRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4011) + +Initialize NamedEntityRecognitionOutputs. + +### NamedEntityRecognition Objects + +```python +class NamedEntityRecognition(AssetNode[NamedEntityRecognitionInputs, + NamedEntityRecognitionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4017) + +NamedEntityRecognition node. + +Identifies and classifies named entities (e.g., persons, organizations, +locations) within text. Useful for information extraction, content tagging, and +search enhancements. + +InputType: text +OutputType: label + +### SpeechSynthesisInputs Objects + +```python +class SpeechSynthesisInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4036) + +Input parameters for SpeechSynthesis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4047) + +Initialize SpeechSynthesisInputs. + +### SpeechSynthesisOutputs Objects + +```python +class SpeechSynthesisOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4059) + +Output parameters for SpeechSynthesis. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4064) + +Initialize SpeechSynthesisOutputs. + +### SpeechSynthesis Objects + +```python +class SpeechSynthesis(AssetNode[SpeechSynthesisInputs, + SpeechSynthesisOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4070) + +SpeechSynthesis node. + +Generates human-like speech from written text. Ideal for text-to-speech +applications, audiobooks, and voice assistants. + +InputType: text +OutputType: audio + +### DocumentInformationExtractionInputs Objects + +```python +class DocumentInformationExtractionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4088) + +Input parameters for DocumentInformationExtraction. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4093) + +Initialize DocumentInformationExtractionInputs. + +### DocumentInformationExtractionOutputs Objects + +```python +class DocumentInformationExtractionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4099) + +Output parameters for DocumentInformationExtraction. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4104) + +Initialize DocumentInformationExtractionOutputs. + +### DocumentInformationExtraction Objects + +```python +class DocumentInformationExtraction( + AssetNode[DocumentInformationExtractionInputs, + DocumentInformationExtractionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4110) + +DocumentInformationExtraction node. + +Document Information Extraction is the process of automatically identifying, +extracting, and structuring relevant data from unstructured or semi-structured +documents, such as invoices, receipts, contracts, and forms, to facilitate +easier data management and analysis. + +InputType: image +OutputType: text + +### OcrInputs Objects + +```python +class OcrInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4132) + +Input parameters for Ocr. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4138) + +Initialize OcrInputs. + +### OcrOutputs Objects + +```python +class OcrOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4145) + +Output parameters for Ocr. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4150) + +Initialize OcrOutputs. + +### Ocr Objects + +```python +class Ocr(AssetNode[OcrInputs, OcrOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4156) + +Ocr node. + +Converts images of typed, handwritten, or printed text into machine-encoded +text. Used in digitizing printed texts for data retrieval. + +InputType: image +OutputType: text + +### SubtitlingTranslationInputs Objects + +```python +class SubtitlingTranslationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4174) + +Input parameters for SubtitlingTranslation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4183) + +Initialize SubtitlingTranslationInputs. + +### SubtitlingTranslationOutputs Objects + +```python +class SubtitlingTranslationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4193) + +Output parameters for SubtitlingTranslation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4198) + +Initialize SubtitlingTranslationOutputs. + +### SubtitlingTranslation Objects + +```python +class SubtitlingTranslation(AssetNode[SubtitlingTranslationInputs, + SubtitlingTranslationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4204) + +SubtitlingTranslation node. + +Converts the text of subtitles from one language to another, ensuring context +and cultural nuances are maintained. Essential for global content distribution. + +InputType: text +OutputType: text + +### TextToAudioInputs Objects + +```python +class TextToAudioInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4222) + +Input parameters for TextToAudio. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4228) + +Initialize TextToAudioInputs. + +### TextToAudioOutputs Objects + +```python +class TextToAudioOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4235) + +Output parameters for TextToAudio. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4240) + +Initialize TextToAudioOutputs. + +### TextToAudio Objects + +```python +class TextToAudio(AssetNode[TextToAudioInputs, TextToAudioOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4246) + +TextToAudio node. + +The Text to Audio function converts written text into spoken words, allowing +users to listen to the content instead of reading it. + +InputType: text +OutputType: audio + +### MultilingualSpeechRecognitionInputs Objects + +```python +class MultilingualSpeechRecognitionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4264) + +Input parameters for MultilingualSpeechRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4270) + +Initialize MultilingualSpeechRecognitionInputs. + +### MultilingualSpeechRecognitionOutputs Objects + +```python +class MultilingualSpeechRecognitionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4277) + +Output parameters for MultilingualSpeechRecognition. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4282) + +Initialize MultilingualSpeechRecognitionOutputs. + +### MultilingualSpeechRecognition Objects + +```python +class MultilingualSpeechRecognition( + AssetNode[MultilingualSpeechRecognitionInputs, + MultilingualSpeechRecognitionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4288) + +MultilingualSpeechRecognition node. + +Multilingual Speech Recognition is a technology that enables the automatic +transcription of spoken language into text across multiple languages, allowing +for seamless communication and understanding in diverse linguistic contexts. + +InputType: audio +OutputType: text + +### OffensiveLanguageIdentificationInputs Objects + +```python +class OffensiveLanguageIdentificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4309) + +Input parameters for OffensiveLanguageIdentification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4317) + +Initialize OffensiveLanguageIdentificationInputs. + +### OffensiveLanguageIdentificationOutputs Objects + +```python +class OffensiveLanguageIdentificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4326) + +Output parameters for OffensiveLanguageIdentification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4331) + +Initialize OffensiveLanguageIdentificationOutputs. + +### OffensiveLanguageIdentification Objects + +```python +class OffensiveLanguageIdentification( + AssetNode[OffensiveLanguageIdentificationInputs, + OffensiveLanguageIdentificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4337) + +OffensiveLanguageIdentification node. + +Detects language or phrases that might be considered offensive, aiding in +content moderation and creating respectful user interactions. + +InputType: text +OutputType: label + +### BenchmarkScoringMtInputs Objects + +```python +class BenchmarkScoringMtInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4357) + +Input parameters for BenchmarkScoringMt. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4364) + +Initialize BenchmarkScoringMtInputs. + +### BenchmarkScoringMtOutputs Objects + +```python +class BenchmarkScoringMtOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4372) + +Output parameters for BenchmarkScoringMt. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4377) + +Initialize BenchmarkScoringMtOutputs. + +### BenchmarkScoringMt Objects + +```python +class BenchmarkScoringMt(AssetNode[BenchmarkScoringMtInputs, + BenchmarkScoringMtOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4383) + +BenchmarkScoringMt node. + +Benchmark Scoring MT is a function designed to evaluate and score machine +translation systems by comparing their output against a set of predefined +benchmarks, thereby assessing their accuracy and performance. + +InputType: text +OutputType: label + +### SpeakerDiarizationAudioInputs Objects + +```python +class SpeakerDiarizationAudioInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4402) + +Input parameters for SpeakerDiarizationAudio. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4410) + +Initialize SpeakerDiarizationAudioInputs. + +### SpeakerDiarizationAudioOutputs Objects + +```python +class SpeakerDiarizationAudioOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4419) + +Output parameters for SpeakerDiarizationAudio. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4425) + +Initialize SpeakerDiarizationAudioOutputs. + +### SpeakerDiarizationAudio Objects + +```python +class SpeakerDiarizationAudio(BaseSegmentor[SpeakerDiarizationAudioInputs, + SpeakerDiarizationAudioOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4432) + +SpeakerDiarizationAudio node. + +Identifies individual speakers and their respective speech segments within an +audio clip. Ideal for multi-speaker recordings or conference calls. + +InputType: audio +OutputType: label + +### VoiceCloningInputs Objects + +```python +class VoiceCloningInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4450) + +Input parameters for VoiceCloning. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4461) + +Initialize VoiceCloningInputs. + +### VoiceCloningOutputs Objects + +```python +class VoiceCloningOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4473) + +Output parameters for VoiceCloning. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4478) + +Initialize VoiceCloningOutputs. + +### VoiceCloning Objects + +```python +class VoiceCloning(AssetNode[VoiceCloningInputs, VoiceCloningOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4484) + +VoiceCloning node. + +Replicates a person's voice based on a sample, allowing for the generation of +speech in that person's tone and style. Used cautiously due to ethical +considerations. + +InputType: text +OutputType: audio + +### SearchInputs Objects + +```python +class SearchInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4503) + +Input parameters for Search. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4508) + +Initialize SearchInputs. + +### SearchOutputs Objects + +```python +class SearchOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4514) + +Output parameters for Search. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4519) + +Initialize SearchOutputs. + +### Search Objects + +```python +class Search(AssetNode[SearchInputs, SearchOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4525) + +Search node. + +An algorithm that identifies and returns data or items that match particular +keywords or conditions from a dataset. A fundamental tool for databases and +websites. + +InputType: text +OutputType: text + +### ObjectDetectionInputs Objects + +```python +class ObjectDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4544) + +Input parameters for ObjectDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4549) + +Initialize ObjectDetectionInputs. + +### ObjectDetectionOutputs Objects + +```python +class ObjectDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4555) + +Output parameters for ObjectDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4560) + +Initialize ObjectDetectionOutputs. + +### ObjectDetection Objects + +```python +class ObjectDetection(AssetNode[ObjectDetectionInputs, + ObjectDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4566) + +ObjectDetection node. + +Object Detection is a computer vision technology that identifies and locates +objects within an image, typically by drawing bounding boxes around the +detected objects and classifying them into predefined categories. + +InputType: video +OutputType: text + +### DiacritizationInputs Objects + +```python +class DiacritizationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4585) + +Input parameters for Diacritization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4593) + +Initialize DiacritizationInputs. + +### DiacritizationOutputs Objects + +```python +class DiacritizationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4602) + +Output parameters for Diacritization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4607) + +Initialize DiacritizationOutputs. + +### Diacritization Objects + +```python +class Diacritization(AssetNode[DiacritizationInputs, DiacritizationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4613) + +Diacritization node. + +Adds diacritical marks to text, essential for languages where meaning can +change based on diacritics. + +InputType: text +OutputType: text + +### SpeakerDiarizationVideoInputs Objects + +```python +class SpeakerDiarizationVideoInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4631) + +Input parameters for SpeakerDiarizationVideo. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4639) + +Initialize SpeakerDiarizationVideoInputs. + +### SpeakerDiarizationVideoOutputs Objects + +```python +class SpeakerDiarizationVideoOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4648) + +Output parameters for SpeakerDiarizationVideo. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4653) + +Initialize SpeakerDiarizationVideoOutputs. + +### SpeakerDiarizationVideo Objects + +```python +class SpeakerDiarizationVideo(AssetNode[SpeakerDiarizationVideoInputs, + SpeakerDiarizationVideoOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4659) + +SpeakerDiarizationVideo node. + +Segments a video based on different speakers, identifying when each individual +speaks. Useful for transcriptions and understanding multi-person conversations. + +InputType: video +OutputType: label + +### AudioForcedAlignmentInputs Objects + +```python +class AudioForcedAlignmentInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4677) + +Input parameters for AudioForcedAlignment. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4686) + +Initialize AudioForcedAlignmentInputs. + +### AudioForcedAlignmentOutputs Objects + +```python +class AudioForcedAlignmentOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4696) + +Output parameters for AudioForcedAlignment. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4702) + +Initialize AudioForcedAlignmentOutputs. + +### AudioForcedAlignment Objects + +```python +class AudioForcedAlignment(AssetNode[AudioForcedAlignmentInputs, + AudioForcedAlignmentOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4709) + +AudioForcedAlignment node. + +Synchronizes phonetic and phonological text with the corresponding segments in +an audio file. Useful in linguistic research and detailed transcription tasks. + +InputType: audio +OutputType: audio + +### TokenClassificationInputs Objects + +```python +class TokenClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4727) + +Input parameters for TokenClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4734) + +Initialize TokenClassificationInputs. + +### TokenClassificationOutputs Objects + +```python +class TokenClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4742) + +Output parameters for TokenClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4747) + +Initialize TokenClassificationOutputs. + +### TokenClassification Objects + +```python +class TokenClassification(AssetNode[TokenClassificationInputs, + TokenClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4753) + +TokenClassification node. + +Token-level classification means that each token will be given a label, for +example a part-of-speech tagger will classify each word as one particular part +of speech. + +InputType: text +OutputType: label + +### TopicClassificationInputs Objects + +```python +class TopicClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4772) + +Input parameters for TopicClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4780) + +Initialize TopicClassificationInputs. + +### TopicClassificationOutputs Objects + +```python +class TopicClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4789) + +Output parameters for TopicClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4794) + +Initialize TopicClassificationOutputs. + +### TopicClassification Objects + +```python +class TopicClassification(AssetNode[TopicClassificationInputs, + TopicClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4800) + +TopicClassification node. + +Assigns categories or topics to a piece of text based on its content, +facilitating content organization and retrieval. + +InputType: text +OutputType: label + +### IntentClassificationInputs Objects + +```python +class IntentClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4818) + +Input parameters for IntentClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4824) + +Initialize IntentClassificationInputs. + +### IntentClassificationOutputs Objects + +```python +class IntentClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4831) + +Output parameters for IntentClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4836) + +Initialize IntentClassificationOutputs. + +### IntentClassification Objects + +```python +class IntentClassification(AssetNode[IntentClassificationInputs, + IntentClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4842) + +IntentClassification node. + +Intent Classification is a natural language processing task that involves +analyzing and categorizing user text input to determine the underlying purpose +or goal behind the communication, such as booking a flight, asking for weather +information, or setting a reminder. + +InputType: text +OutputType: label + +### VideoContentModerationInputs Objects + +```python +class VideoContentModerationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4862) + +Input parameters for VideoContentModeration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4868) + +Initialize VideoContentModerationInputs. + +### VideoContentModerationOutputs Objects + +```python +class VideoContentModerationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4875) + +Output parameters for VideoContentModeration. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4880) + +Initialize VideoContentModerationOutputs. + +### VideoContentModeration Objects + +```python +class VideoContentModeration(AssetNode[VideoContentModerationInputs, + VideoContentModerationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4886) + +VideoContentModeration node. + +Automatically reviews video content to detect and possibly remove inappropriate +or harmful material. Essential for user-generated content platforms. + +InputType: video +OutputType: label + +### TextGenerationMetricInputs Objects + +```python +class TextGenerationMetricInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4904) + +Input parameters for TextGenerationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4912) + +Initialize TextGenerationMetricInputs. + +### TextGenerationMetricOutputs Objects + +```python +class TextGenerationMetricOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4921) + +Output parameters for TextGenerationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4926) + +Initialize TextGenerationMetricOutputs. + +### TextGenerationMetric Objects + +```python +class TextGenerationMetric(BaseMetric[TextGenerationMetricInputs, + TextGenerationMetricOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4932) + +TextGenerationMetric node. + +A Text Generation Metric is a quantitative measure used to evaluate the quality +and effectiveness of text produced by natural language processing models, often +assessing aspects such as coherence, relevance, fluency, and adherence to given +prompts or instructions. + +InputType: text +OutputType: text + +### ImageEmbeddingInputs Objects + +```python +class ImageEmbeddingInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4952) + +Input parameters for ImageEmbedding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4958) + +Initialize ImageEmbeddingInputs. + +### ImageEmbeddingOutputs Objects + +```python +class ImageEmbeddingOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4965) + +Output parameters for ImageEmbedding. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4970) + +Initialize ImageEmbeddingOutputs. + +### ImageEmbedding Objects + +```python +class ImageEmbedding(AssetNode[ImageEmbeddingInputs, ImageEmbeddingOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4976) + +ImageEmbedding node. + +Image Embedding is a process that transforms an image into a fixed-dimensional +vector representation, capturing its essential features and enabling efficient +comparison, retrieval, and analysis in various machine learning and computer +vision tasks. + +InputType: image +OutputType: text + +### ImageLabelDetectionInputs Objects + +```python +class ImageLabelDetectionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L4996) + +Input parameters for ImageLabelDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5002) + +Initialize ImageLabelDetectionInputs. + +### ImageLabelDetectionOutputs Objects + +```python +class ImageLabelDetectionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5009) + +Output parameters for ImageLabelDetection. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5014) + +Initialize ImageLabelDetectionOutputs. + +### ImageLabelDetection Objects + +```python +class ImageLabelDetection(AssetNode[ImageLabelDetectionInputs, + ImageLabelDetectionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5020) + +ImageLabelDetection node. + +Identifies objects, themes, or topics within images, useful for image +categorization, search, and recommendation systems. + +InputType: image +OutputType: label + +### ImageColorizationInputs Objects + +```python +class ImageColorizationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5038) + +Input parameters for ImageColorization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5043) + +Initialize ImageColorizationInputs. + +### ImageColorizationOutputs Objects + +```python +class ImageColorizationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5049) + +Output parameters for ImageColorization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5054) + +Initialize ImageColorizationOutputs. + +### ImageColorization Objects + +```python +class ImageColorization(AssetNode[ImageColorizationInputs, + ImageColorizationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5060) + +ImageColorization node. + +Image colorization is a process that involves adding color to grayscale images, +transforming them from black-and-white to full-color representations, often +using advanced algorithms and machine learning techniques to predict and apply +the appropriate hues and shades. + +InputType: image +OutputType: image + +### MetricAggregationInputs Objects + +```python +class MetricAggregationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5080) + +Input parameters for MetricAggregation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5085) + +Initialize MetricAggregationInputs. + +### MetricAggregationOutputs Objects + +```python +class MetricAggregationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5091) + +Output parameters for MetricAggregation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5096) + +Initialize MetricAggregationOutputs. + +### MetricAggregation Objects + +```python +class MetricAggregation(BaseMetric[MetricAggregationInputs, + MetricAggregationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5102) + +MetricAggregation node. + +Metric Aggregation is a function that computes and summarizes numerical data by +applying statistical operations, such as averaging, summing, or finding the +minimum and maximum values, to provide insights and facilitate analysis of +large datasets. + +InputType: text +OutputType: text + +### InstanceSegmentationInputs Objects + +```python +class InstanceSegmentationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5122) + +Input parameters for InstanceSegmentation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5127) + +Initialize InstanceSegmentationInputs. + +### InstanceSegmentationOutputs Objects + +```python +class InstanceSegmentationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5133) + +Output parameters for InstanceSegmentation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5138) + +Initialize InstanceSegmentationOutputs. + +### InstanceSegmentation Objects + +```python +class InstanceSegmentation(AssetNode[InstanceSegmentationInputs, + InstanceSegmentationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5144) + +InstanceSegmentation node. + +Instance segmentation is a computer vision task that involves detecting and +delineating each distinct object within an image, assigning a unique label and +precise boundary to every individual instance of objects, even if they belong +to the same category. + +InputType: image +OutputType: label + +### OtherMultipurposeInputs Objects + +```python +class OtherMultipurposeInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5164) + +Input parameters for OtherMultipurpose. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5170) + +Initialize OtherMultipurposeInputs. + +### OtherMultipurposeOutputs Objects + +```python +class OtherMultipurposeOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5177) + +Output parameters for OtherMultipurpose. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5182) + +Initialize OtherMultipurposeOutputs. + +### OtherMultipurpose Objects + +```python +class OtherMultipurpose(AssetNode[OtherMultipurposeInputs, + OtherMultipurposeOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5188) + +OtherMultipurpose node. + +The "Other (Multipurpose)" function serves as a versatile category designed to +accommodate a wide range of tasks and activities that do not fit neatly into +predefined classifications, offering flexibility and adaptability for various +needs. + +InputType: text +OutputType: text + +### SpeechTranslationInputs Objects + +```python +class SpeechTranslationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5208) + +Input parameters for SpeechTranslation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5218) + +Initialize SpeechTranslationInputs. + +### SpeechTranslationOutputs Objects + +```python +class SpeechTranslationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5229) + +Output parameters for SpeechTranslation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5234) + +Initialize SpeechTranslationOutputs. + +### SpeechTranslation Objects + +```python +class SpeechTranslation(AssetNode[SpeechTranslationInputs, + SpeechTranslationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5240) + +SpeechTranslation node. + +Speech Translation is a technology that converts spoken language in real-time +from one language to another, enabling seamless communication between speakers +of different languages. + +InputType: audio +OutputType: text + +### ReferencelessTextGenerationMetricDefaultInputs Objects + +```python +class ReferencelessTextGenerationMetricDefaultInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5259) + +Input parameters for ReferencelessTextGenerationMetricDefault. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5266) + +Initialize ReferencelessTextGenerationMetricDefaultInputs. + +### ReferencelessTextGenerationMetricDefaultOutputs Objects + +```python +class ReferencelessTextGenerationMetricDefaultOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5274) + +Output parameters for ReferencelessTextGenerationMetricDefault. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5279) + +Initialize ReferencelessTextGenerationMetricDefaultOutputs. + +### ReferencelessTextGenerationMetricDefault Objects + +```python +class ReferencelessTextGenerationMetricDefault( + BaseMetric[ReferencelessTextGenerationMetricDefaultInputs, + ReferencelessTextGenerationMetricDefaultOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5285) + +ReferencelessTextGenerationMetricDefault node. + +The Referenceless Text Generation Metric Default is a function designed to +evaluate the quality of generated text without relying on reference texts for +comparison. + +InputType: text +OutputType: text + +### ReferencelessTextGenerationMetricInputs Objects + +```python +class ReferencelessTextGenerationMetricInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5306) + +Input parameters for ReferencelessTextGenerationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5313) + +Initialize ReferencelessTextGenerationMetricInputs. + +### ReferencelessTextGenerationMetricOutputs Objects + +```python +class ReferencelessTextGenerationMetricOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5321) + +Output parameters for ReferencelessTextGenerationMetric. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5326) + +Initialize ReferencelessTextGenerationMetricOutputs. + +### ReferencelessTextGenerationMetric Objects + +```python +class ReferencelessTextGenerationMetric( + BaseMetric[ReferencelessTextGenerationMetricInputs, + ReferencelessTextGenerationMetricOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5332) + +ReferencelessTextGenerationMetric node. + +The Referenceless Text Generation Metric is a method for evaluating the quality +of generated text without requiring a reference text for comparison, often +leveraging models or algorithms to assess coherence, relevance, and fluency +based on intrinsic properties of the text itself. + +InputType: text +OutputType: text + +### TextDenormalizationInputs Objects + +```python +class TextDenormalizationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5354) + +Input parameters for TextDenormalization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5363) + +Initialize TextDenormalizationInputs. + +### TextDenormalizationOutputs Objects + +```python +class TextDenormalizationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5375) + +Output parameters for TextDenormalization. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5380) + +Initialize TextDenormalizationOutputs. + +### TextDenormalization Objects + +```python +class TextDenormalization(AssetNode[TextDenormalizationInputs, + TextDenormalizationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5386) + +TextDenormalization node. + +Converts standardized or normalized text into its original, often more +readable, form. Useful in natural language generation tasks. + +InputType: text +OutputType: label + +### ImageCompressionInputs Objects + +```python +class ImageCompressionInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5404) + +Input parameters for ImageCompression. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5410) + +Initialize ImageCompressionInputs. + +### ImageCompressionOutputs Objects + +```python +class ImageCompressionOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5417) + +Output parameters for ImageCompression. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5422) + +Initialize ImageCompressionOutputs. + +### ImageCompression Objects + +```python +class ImageCompression(AssetNode[ImageCompressionInputs, + ImageCompressionOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5428) + +ImageCompression node. + +Reduces the size of image files without significantly compromising their visual +quality. Useful for optimizing storage and improving webpage load times. + +InputType: image +OutputType: image + +### TextClassificationInputs Objects + +```python +class TextClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5446) + +Input parameters for TextClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5454) + +Initialize TextClassificationInputs. + +### TextClassificationOutputs Objects + +```python +class TextClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5463) + +Output parameters for TextClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5468) + +Initialize TextClassificationOutputs. + +### TextClassification Objects + +```python +class TextClassification(AssetNode[TextClassificationInputs, + TextClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5474) + +TextClassification node. + +Categorizes text into predefined groups or topics, facilitating content +organization and targeted actions. + +InputType: text +OutputType: label + +### AsrAgeClassificationInputs Objects + +```python +class AsrAgeClassificationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5492) + +Input parameters for AsrAgeClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5497) + +Initialize AsrAgeClassificationInputs. + +### AsrAgeClassificationOutputs Objects + +```python +class AsrAgeClassificationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5503) + +Output parameters for AsrAgeClassification. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5508) + +Initialize AsrAgeClassificationOutputs. + +### AsrAgeClassification Objects + +```python +class AsrAgeClassification(AssetNode[AsrAgeClassificationInputs, + AsrAgeClassificationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5514) + +AsrAgeClassification node. + +The ASR Age Classification function is designed to analyze audio recordings of +speech to determine the speaker's age group by leveraging automatic speech +recognition (ASR) technology and machine learning algorithms. + +InputType: audio +OutputType: label + +### AsrQualityEstimationInputs Objects + +```python +class AsrQualityEstimationInputs(Inputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5533) + +Input parameters for AsrQualityEstimation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5539) + +Initialize AsrQualityEstimationInputs. + +### AsrQualityEstimationOutputs Objects + +```python +class AsrQualityEstimationOutputs(Outputs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5546) + +Output parameters for AsrQualityEstimation. + +#### \_\_init\_\_ + +```python +def __init__(node=None) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5551) + +Initialize AsrQualityEstimationOutputs. + +### AsrQualityEstimation Objects + +```python +class AsrQualityEstimation(AssetNode[AsrQualityEstimationInputs, + AsrQualityEstimationOutputs]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5557) + +AsrQualityEstimation node. + +ASR Quality Estimation is a process that evaluates the accuracy and reliability +of automatic speech recognition systems by analyzing their performance in +transcribing spoken language into text. + +InputType: text +OutputType: label + +### Pipeline Objects + +```python +class Pipeline(DefaultPipeline) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5576) + +Pipeline class for creating and managing AI processing pipelines. + +#### text\_normalization + +```python +def text_normalization(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextNormalization +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5579) + +Create a TextNormalization node. + +Converts unstructured or non-standard textual data into a more readable and +uniform format, dealing with abbreviations, numerals, and other non-standard +words. + +#### paraphrasing + +```python +def paraphrasing(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> Paraphrasing +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5588) + +Create a Paraphrasing node. + +Express the meaning of the writer or speaker or something written or spoken +using different words. + +#### language\_identification + +```python +def language_identification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> LanguageIdentification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5596) + +Create a LanguageIdentification node. + +Detects the language in which a given text is written, aiding in multilingual +platforms or content localization. + +#### benchmark\_scoring\_asr + +```python +def benchmark_scoring_asr(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> BenchmarkScoringAsr +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5604) + +Create a BenchmarkScoringAsr node. + +Benchmark Scoring ASR is a function that evaluates and compares the performance +of automatic speech recognition systems by analyzing their accuracy, speed, and +other relevant metrics against a standardized set of benchmarks. + +#### multi\_class\_text\_classification + +```python +def multi_class_text_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> MultiClassTextClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5613) + +Create a MultiClassTextClassification node. + +Multi Class Text Classification is a natural language processing task that +involves categorizing a given text into one of several predefined classes or +categories based on its content. + +#### speech\_embedding + +```python +def speech_embedding(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SpeechEmbedding +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5624) + +Create a SpeechEmbedding node. + +Transforms spoken content into a fixed-size vector in a high-dimensional space +that captures the content's essence. Facilitates tasks like speech recognition +and speaker verification. + +#### document\_image\_parsing + +```python +def document_image_parsing(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> DocumentImageParsing +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5633) + +Create a DocumentImageParsing node. + +Document Image Parsing is the process of analyzing and converting scanned or +photographed images of documents into structured, machine-readable formats by +identifying and extracting text, layout, and other relevant information. + +#### translation + +```python +def translation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> Translation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5642) + +Create a Translation node. + +Converts text from one language to another while maintaining the original +message's essence and context. Crucial for global communication. + +#### audio\_source\_separation + +```python +def audio_source_separation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AudioSourceSeparation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5650) + +Create a AudioSourceSeparation node. + +Audio Source Separation is the process of separating a mixture (e.g. a pop band +recording) into isolated sounds from individual sources (e.g. just the lead +vocals). + +#### speech\_recognition + +```python +def speech_recognition(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SpeechRecognition +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5659) + +Create a SpeechRecognition node. + +Converts spoken language into written text. Useful for transcription services, +voice assistants, and applications requiring voice-to-text capabilities. + +#### keyword\_spotting + +```python +def keyword_spotting(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> KeywordSpotting +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5667) + +Create a KeywordSpotting node. + +Keyword Spotting is a function that enables the detection and identification of +specific words or phrases within a stream of audio, often used in voice- +activated systems to trigger actions or commands based on recognized keywords. + +#### part\_of\_speech\_tagging + +```python +def part_of_speech_tagging(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> PartOfSpeechTagging +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5676) + +Create a PartOfSpeechTagging node. + +Part of Speech Tagging is a natural language processing task that involves +assigning each word in a sentence its corresponding part of speech, such as +noun, verb, adjective, or adverb, based on its role and context within the +sentence. + +#### referenceless\_audio\_generation\_metric + +```python +def referenceless_audio_generation_metric( + asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ReferencelessAudioGenerationMetric +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5686) + +Create a ReferencelessAudioGenerationMetric node. + +The Referenceless Audio Generation Metric is a tool designed to evaluate the +quality of generated audio content without the need for a reference or original +audio sample for comparison. + +#### voice\_activity\_detection + +```python +def voice_activity_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VoiceActivityDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5697) + +Create a VoiceActivityDetection node. + +Determines when a person is speaking in an audio clip. It's an essential +preprocessing step for other audio-related tasks. + +#### sentiment\_analysis + +```python +def sentiment_analysis(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SentimentAnalysis +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5705) + +Create a SentimentAnalysis node. + +Determines the sentiment or emotion (e.g., positive, negative, neutral) of a +piece of text, aiding in understanding user feedback or market sentiment. + +#### subtitling + +```python +def subtitling(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> Subtitling +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5713) + +Create a Subtitling node. + +Generates accurate subtitles for videos, enhancing accessibility for diverse +audiences. + +#### multi\_label\_text\_classification + +```python +def multi_label_text_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> MultiLabelTextClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5721) + +Create a MultiLabelTextClassification node. + +Multi Label Text Classification is a natural language processing task where a +given text is analyzed and assigned multiple relevant labels or categories from +a predefined set, allowing for the text to belong to more than one category +simultaneously. + +#### viseme\_generation + +```python +def viseme_generation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VisemeGeneration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5733) + +Create a VisemeGeneration node. + +Viseme Generation is the process of creating visual representations of +phonemes, which are the distinct units of sound in speech, to synchronize lip +movements with spoken words in animations or virtual avatars. + +#### text\_segmenation + +```python +def text_segmenation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextSegmenation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5742) + +Create a TextSegmenation node. + +Text Segmentation is the process of dividing a continuous text into meaningful +units, such as words, sentences, or topics, to facilitate easier analysis and +understanding. + +#### zero\_shot\_classification + +```python +def zero_shot_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ZeroShotClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5751) + +Create a ZeroShotClassification node. + +#### text\_generation + +```python +def text_generation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextGeneration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5755) + +Create a TextGeneration node. + +Creates coherent and contextually relevant textual content based on prompts or +certain parameters. Useful for chatbots, content creation, and data +augmentation. + +#### audio\_intent\_detection + +```python +def audio_intent_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AudioIntentDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5764) + +Create a AudioIntentDetection node. + +Audio Intent Detection is a process that involves analyzing audio signals to +identify and interpret the underlying intentions or purposes behind spoken +words, enabling systems to understand and respond appropriately to human +speech. + +#### entity\_linking + +```python +def entity_linking(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> EntityLinking +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5774) + +Create a EntityLinking node. + +Associates identified entities in the text with specific entries in a knowledge +base or database. + +#### connection + +```python +def connection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> Connection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5782) + +Create a Connection node. + +Connections are integration that allow you to connect your AI agents to +external tools + +#### visual\_question\_answering + +```python +def visual_question_answering(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VisualQuestionAnswering +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5790) + +Create a VisualQuestionAnswering node. + +Visual Question Answering (VQA) is a task in artificial intelligence that +involves analyzing an image and providing accurate, contextually relevant +answers to questions posed about the visual content of that image. + +#### loglikelihood + +```python +def loglikelihood(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> Loglikelihood +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5799) + +Create a Loglikelihood node. + +The Log Likelihood function measures the probability of observing the given +data under a specific statistical model by taking the natural logarithm of the +likelihood function, thereby transforming the product of probabilities into a +sum, which simplifies the process of optimization and parameter estimation. + +#### language\_identification\_audio + +```python +def language_identification_audio(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> LanguageIdentificationAudio +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5809) + +Create a LanguageIdentificationAudio node. + +The Language Identification Audio function analyzes audio input to determine +and identify the language being spoken. + +#### fact\_checking + +```python +def fact_checking(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> FactChecking +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5819) + +Create a FactChecking node. + +Fact Checking is the process of verifying the accuracy and truthfulness of +information, statements, or claims by cross-referencing with reliable sources +and evidence. + +#### table\_question\_answering + +```python +def table_question_answering(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TableQuestionAnswering +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5828) + +Create a TableQuestionAnswering node. + +The task of question answering over tables is given an input table (or a set of +tables) T and a natural language question Q (a user query), output the correct +answer A + +#### speech\_classification + +```python +def speech_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SpeechClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5837) + +Create a SpeechClassification node. + +Categorizes audio clips based on their content, aiding in content organization +and targeted actions. + +#### inverse\_text\_normalization + +```python +def inverse_text_normalization(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> InverseTextNormalization +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5845) + +Create a InverseTextNormalization node. + +Inverse Text Normalization is the process of converting spoken or written +language in its normalized form, such as numbers, dates, and abbreviations, +back into their original, more complex or detailed textual representations. + +#### multi\_class\_image\_classification + +```python +def multi_class_image_classification( + asset_id: Union[str, asset.Asset], *args, + **kwargs) -> MultiClassImageClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5856) + +Create a MultiClassImageClassification node. + +Multi Class Image Classification is a machine learning task where an algorithm +is trained to categorize images into one of several predefined classes or +categories based on their visual content. + +#### asr\_gender\_classification + +```python +def asr_gender_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AsrGenderClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5867) + +Create a AsrGenderClassification node. + +The ASR Gender Classification function analyzes audio recordings to determine +and classify the speaker's gender based on their voice characteristics. + +#### summarization + +```python +def summarization(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> Summarization +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5875) + +Create a Summarization node. + +Text summarization is the process of distilling the most important information +from a source (or sources) to produce an abridged version for a particular user +(or users) and task (or tasks) + +#### topic\_modeling + +```python +def topic_modeling(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TopicModeling +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5884) + +Create a TopicModeling node. + +Topic modeling is a type of statistical modeling for discovering the abstract +“topics” that occur in a collection of documents. + +#### audio\_reconstruction + +```python +def audio_reconstruction(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AudioReconstruction +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5892) + +Create a AudioReconstruction node. + +Audio Reconstruction is the process of restoring or recreating audio signals +from incomplete, damaged, or degraded recordings to achieve a high-quality, +accurate representation of the original sound. + +#### text\_embedding + +```python +def text_embedding(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextEmbedding +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5901) + +Create a TextEmbedding node. + +Text embedding is a process that converts text into numerical vectors, +capturing the semantic meaning and contextual relationships of words or +phrases, enabling machines to understand and analyze natural language more +effectively. + +#### detect\_language\_from\_text + +```python +def detect_language_from_text(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> DetectLanguageFromText +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5911) + +Create a DetectLanguageFromText node. + +Detect Language From Text + +#### extract\_audio\_from\_video + +```python +def extract_audio_from_video(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ExtractAudioFromVideo +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5918) + +Create a ExtractAudioFromVideo node. + +Isolates and extracts audio tracks from video files, aiding in audio analysis +or transcription tasks. + +#### scene\_detection + +```python +def scene_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SceneDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5926) + +Create a SceneDetection node. + +Scene detection is used for detecting transitions between shots in a video to +split it into basic temporal segments. + +#### text\_to\_image\_generation + +```python +def text_to_image_generation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextToImageGeneration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5934) + +Create a TextToImageGeneration node. + +Creates a visual representation based on textual input, turning descriptions +into pictorial forms. Used in creative processes and content generation. + +#### auto\_mask\_generation + +```python +def auto_mask_generation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AutoMaskGeneration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5942) + +Create a AutoMaskGeneration node. + +Auto-mask generation refers to the automated process of creating masks in image +processing or computer vision, typically for segmentation tasks. A mask is a +binary or multi-class image that labels different parts of an image, usually +separating the foreground (objects of interest) from the background, or +identifying specific object classes in an image. + +#### audio\_language\_identification + +```python +def audio_language_identification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AudioLanguageIdentification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5953) + +Create a AudioLanguageIdentification node. + +Audio Language Identification is a process that involves analyzing an audio +recording to determine the language being spoken. + +#### facial\_recognition + +```python +def facial_recognition(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> FacialRecognition +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5963) + +Create a FacialRecognition node. + +A facial recognition system is a technology capable of matching a human face +from a digital image or a video frame against a database of faces + +#### question\_answering + +```python +def question_answering(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> QuestionAnswering +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5971) + +Create a QuestionAnswering node. + +building systems that automatically answer questions posed by humans in a +natural language usually from a given text + +#### image\_impainting + +```python +def image_impainting(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageImpainting +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5979) + +Create a ImageImpainting node. + +Image inpainting is a process that involves filling in missing or damaged parts +of an image in a way that is visually coherent and seamlessly blends with the +surrounding areas, often using advanced algorithms and techniques to restore +the image to its original or intended appearance. + +#### text\_reconstruction + +```python +def text_reconstruction(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextReconstruction +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5989) + +Create a TextReconstruction node. + +Text Reconstruction is a process that involves piecing together fragmented or +incomplete text data to restore it to its original, coherent form. + +#### script\_execution + +```python +def script_execution(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ScriptExecution +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L5997) + +Create a ScriptExecution node. + +Script Execution refers to the process of running a set of programmed +instructions or code within a computing environment, enabling the automated +performance of tasks, calculations, or operations as defined by the script. + +#### semantic\_segmentation + +```python +def semantic_segmentation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SemanticSegmentation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6006) + +Create a SemanticSegmentation node. + +Semantic segmentation is a computer vision process that involves classifying +each pixel in an image into a predefined category, effectively partitioning the +image into meaningful segments based on the objects or regions they represent. + +#### audio\_emotion\_detection + +```python +def audio_emotion_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AudioEmotionDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6015) + +Create a AudioEmotionDetection node. + +Audio Emotion Detection is a technology that analyzes vocal characteristics and +patterns in audio recordings to identify and classify the emotional state of +the speaker. + +#### image\_captioning + +```python +def image_captioning(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageCaptioning +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6024) + +Create a ImageCaptioning node. + +Image Captioning is a process that involves generating a textual description of +an image, typically using machine learning models to analyze the visual content +and produce coherent and contextually relevant sentences that describe the +objects, actions, and scenes depicted in the image. + +#### split\_on\_linebreak + +```python +def split_on_linebreak(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SplitOnLinebreak +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6034) + +Create a SplitOnLinebreak node. + +The "Split On Linebreak" function divides a given string into a list of +substrings, using linebreaks (newline characters) as the points of separation. + +#### style\_transfer + +```python +def style_transfer(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> StyleTransfer +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6042) + +Create a StyleTransfer node. + +Style Transfer is a technique in artificial intelligence that applies the +visual style of one image (such as the brushstrokes of a famous painting) to +the content of another image, effectively blending the artistic elements of the +first image with the subject matter of the second. + +#### base\_model + +```python +def base_model(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> BaseModel +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6052) + +Create a BaseModel node. + +The Base-Model function serves as a foundational framework designed to provide +essential features and capabilities upon which more specialized or advanced +models can be built and customized. + +#### image\_manipulation + +```python +def image_manipulation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageManipulation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6061) + +Create a ImageManipulation node. + +Image Manipulation refers to the process of altering or enhancing digital +images using various techniques and tools to achieve desired visual effects, +correct imperfections, or transform the image's appearance. + +#### video\_embedding + +```python +def video_embedding(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VideoEmbedding +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6070) + +Create a VideoEmbedding node. + +Video Embedding is a process that transforms video content into a fixed- +dimensional vector representation, capturing essential features and patterns to +facilitate tasks such as retrieval, classification, and recommendation. + +#### dialect\_detection + +```python +def dialect_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> DialectDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6079) + +Create a DialectDetection node. + +Identifies specific dialects within a language, aiding in localized content +creation or user experience personalization. + +#### fill\_text\_mask + +```python +def fill_text_mask(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> FillTextMask +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6087) + +Create a FillTextMask node. + +Completes missing parts of a text based on the context, ideal for content +generation or data augmentation tasks. + +#### activity\_detection + +```python +def activity_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ActivityDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6095) + +Create a ActivityDetection node. + +detection of the presence or absence of human speech, used in speech +processing. + +#### select\_supplier\_for\_translation + +```python +def select_supplier_for_translation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SelectSupplierForTranslation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6103) + +Create a SelectSupplierForTranslation node. + +Supplier For Translation + +#### expression\_detection + +```python +def expression_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ExpressionDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6112) + +Create a ExpressionDetection node. + +Expression Detection is the process of identifying and analyzing facial +expressions to interpret emotions or intentions using AI and computer vision +techniques. + +#### video\_generation + +```python +def video_generation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VideoGeneration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6121) + +Create a VideoGeneration node. + +Produces video content based on specific inputs or datasets. Can be used for +simulations, animations, or even deepfake detection. + +#### image\_analysis + +```python +def image_analysis(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageAnalysis +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6129) + +Create a ImageAnalysis node. + +Image analysis is the extraction of meaningful information from images + +#### noise\_removal + +```python +def noise_removal(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> NoiseRemoval +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6136) + +Create a NoiseRemoval node. + +Noise Removal is a process that involves identifying and eliminating unwanted +random variations or disturbances from an audio signal to enhance the clarity +and quality of the underlying information. + +#### image\_and\_video\_analysis + +```python +def image_and_video_analysis(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageAndVideoAnalysis +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6145) + +Create a ImageAndVideoAnalysis node. + +#### keyword\_extraction + +```python +def keyword_extraction(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> KeywordExtraction +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6149) + +Create a KeywordExtraction node. + +It helps concise the text and obtain relevant keywords Example use-cases are +finding topics of interest from a news article and identifying the problems +based on customer reviews and so. + +#### split\_on\_silence + +```python +def split_on_silence(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SplitOnSilence +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6158) + +Create a SplitOnSilence node. + +The "Split On Silence" function divides an audio recording into separate +segments based on periods of silence, allowing for easier editing and analysis +of individual sections. + +#### intent\_recognition + +```python +def intent_recognition(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> IntentRecognition +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6167) + +Create a IntentRecognition node. + +classify the user's utterance (provided in varied natural language) or text +into one of several predefined classes, that is, intents. + +#### depth\_estimation + +```python +def depth_estimation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> DepthEstimation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6175) + +Create a DepthEstimation node. + +Depth estimation is a computational process that determines the distance of +objects from a viewpoint, typically using visual data from cameras or sensors +to create a three-dimensional understanding of a scene. + +#### connector + +```python +def connector(asset_id: Union[str, asset.Asset], *args, **kwargs) -> Connector +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6184) + +Create a Connector node. + +Connectors are integration that allow you to connect your AI agents to external +tools + +#### speaker\_recognition + +```python +def speaker_recognition(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SpeakerRecognition +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6192) + +Create a SpeakerRecognition node. + +In speaker identification, an utterance from an unknown speaker is analyzed and +compared with speech models of known speakers. + +#### syntax\_analysis + +```python +def syntax_analysis(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SyntaxAnalysis +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6200) + +Create a SyntaxAnalysis node. + +Is the process of analyzing natural language with the rules of a formal +grammar. Grammatical rules are applied to categories and groups of words, not +individual words. Syntactic analysis basically assigns a semantic structure to +text. + +#### entity\_sentiment\_analysis + +```python +def entity_sentiment_analysis(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> EntitySentimentAnalysis +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6210) + +Create a EntitySentimentAnalysis node. + +Entity Sentiment Analysis combines both entity analysis and sentiment analysis +and attempts to determine the sentiment (positive or negative) expressed about +entities within the text. + +#### classification\_metric + +```python +def classification_metric(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ClassificationMetric +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6219) + +Create a ClassificationMetric node. + +A Classification Metric is a quantitative measure used to evaluate the quality +and effectiveness of classification models. + +#### text\_detection + +```python +def text_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6227) + +Create a TextDetection node. + +detect text regions in the complex background and label them with bounding +boxes. + +#### guardrails + +```python +def guardrails(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> Guardrails +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6235) + +Create a Guardrails node. + + Guardrails are governance rules that enforce security, compliance, and +operational best practices, helping prevent mistakes and detect suspicious +activity + +#### emotion\_detection + +```python +def emotion_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> EmotionDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6244) + +Create a EmotionDetection node. + +Identifies human emotions from text or audio, enhancing user experience in +chatbots or customer feedback analysis. + +#### video\_forced\_alignment + +```python +def video_forced_alignment(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VideoForcedAlignment +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6252) + +Create a VideoForcedAlignment node. + +Aligns the transcription of spoken content in a video with its corresponding +timecodes, facilitating subtitle creation. + +#### image\_content\_moderation + +```python +def image_content_moderation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageContentModeration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6260) + +Create a ImageContentModeration node. + +Detects and filters out inappropriate or harmful images, essential for +platforms with user-generated visual content. + +#### text\_summarization + +```python +def text_summarization(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextSummarization +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6268) + +Create a TextSummarization node. + +Extracts the main points from a larger body of text, producing a concise +summary without losing the primary message. + +#### image\_to\_video\_generation + +```python +def image_to_video_generation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageToVideoGeneration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6276) + +Create a ImageToVideoGeneration node. + +The Image To Video Generation function transforms a series of static images +into a cohesive, dynamic video sequence, often incorporating transitions, +effects, and synchronization with audio to create a visually engaging +narrative. + +#### video\_understanding + +```python +def video_understanding(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VideoUnderstanding +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6286) + +Create a VideoUnderstanding node. + +Video Understanding is the process of analyzing and interpreting video content +to extract meaningful information, such as identifying objects, actions, +events, and contextual relationships within the footage. + +#### text\_generation\_metric\_default + +```python +def text_generation_metric_default(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextGenerationMetricDefault +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6295) + +Create a TextGenerationMetricDefault node. + +The "Text Generation Metric Default" function provides a standard set of +evaluation metrics for assessing the quality and performance of text generation +models. + +#### text\_to\_video\_generation + +```python +def text_to_video_generation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextToVideoGeneration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6306) + +Create a TextToVideoGeneration node. + +Text To Video Generation is a process that converts written descriptions or +scripts into dynamic, visual video content using advanced algorithms and +artificial intelligence. + +#### video\_label\_detection + +```python +def video_label_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VideoLabelDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6315) + +Create a VideoLabelDetection node. + +Identifies and tags objects, scenes, or activities within a video. Useful for +content indexing and recommendation systems. + +#### text\_spam\_detection + +```python +def text_spam_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextSpamDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6323) + +Create a TextSpamDetection node. + +Identifies and filters out unwanted or irrelevant text content, ideal for +moderating user-generated content or ensuring quality in communication +platforms. + +#### text\_content\_moderation + +```python +def text_content_moderation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextContentModeration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6332) + +Create a TextContentModeration node. + +Scans and identifies potentially harmful, offensive, or inappropriate textual +content, ensuring safer user environments. + +#### audio\_transcript\_improvement + +```python +def audio_transcript_improvement(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AudioTranscriptImprovement +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6340) + +Create a AudioTranscriptImprovement node. + +Refines and corrects transcriptions generated from audio data, improving +readability and accuracy. + +#### audio\_transcript\_analysis + +```python +def audio_transcript_analysis(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AudioTranscriptAnalysis +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6350) + +Create a AudioTranscriptAnalysis node. + +Analyzes transcribed audio data for insights, patterns, or specific information +extraction. + +#### speech\_non\_speech\_classification + +```python +def speech_non_speech_classification( + asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SpeechNonSpeechClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6358) + +Create a SpeechNonSpeechClassification node. + +Differentiates between speech and non-speech audio segments. Great for editing +software and transcription services to exclude irrelevant audio. + +#### audio\_generation\_metric + +```python +def audio_generation_metric(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AudioGenerationMetric +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6368) + +Create a AudioGenerationMetric node. + +The Audio Generation Metric is a quantitative measure used to evaluate the +quality, accuracy, and overall performance of audio generated by artificial +intelligence systems, often considering factors such as fidelity, +intelligibility, and similarity to human-produced audio. + +#### named\_entity\_recognition + +```python +def named_entity_recognition(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> NamedEntityRecognition +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6378) + +Create a NamedEntityRecognition node. + +Identifies and classifies named entities (e.g., persons, organizations, +locations) within text. Useful for information extraction, content tagging, and +search enhancements. + +#### speech\_synthesis + +```python +def speech_synthesis(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SpeechSynthesis +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6387) + +Create a SpeechSynthesis node. + +Generates human-like speech from written text. Ideal for text-to-speech +applications, audiobooks, and voice assistants. + +#### document\_information\_extraction + +```python +def document_information_extraction(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> DocumentInformationExtraction +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6395) + +Create a DocumentInformationExtraction node. + +Document Information Extraction is the process of automatically identifying, +extracting, and structuring relevant data from unstructured or semi-structured +documents, such as invoices, receipts, contracts, and forms, to facilitate +easier data management and analysis. + +#### ocr + +```python +def ocr(asset_id: Union[str, asset.Asset], *args, **kwargs) -> Ocr +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6407) + +Create a Ocr node. + +Converts images of typed, handwritten, or printed text into machine-encoded +text. Used in digitizing printed texts for data retrieval. + +#### subtitling\_translation + +```python +def subtitling_translation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SubtitlingTranslation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6415) + +Create a SubtitlingTranslation node. + +Converts the text of subtitles from one language to another, ensuring context +and cultural nuances are maintained. Essential for global content distribution. + +#### text\_to\_audio + +```python +def text_to_audio(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextToAudio +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6423) + +Create a TextToAudio node. + +The Text to Audio function converts written text into spoken words, allowing +users to listen to the content instead of reading it. + +#### multilingual\_speech\_recognition + +```python +def multilingual_speech_recognition(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> MultilingualSpeechRecognition +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6431) + +Create a MultilingualSpeechRecognition node. + +Multilingual Speech Recognition is a technology that enables the automatic +transcription of spoken language into text across multiple languages, allowing +for seamless communication and understanding in diverse linguistic contexts. + +#### offensive\_language\_identification + +```python +def offensive_language_identification( + asset_id: Union[str, asset.Asset], *args, + **kwargs) -> OffensiveLanguageIdentification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6442) + +Create a OffensiveLanguageIdentification node. + +Detects language or phrases that might be considered offensive, aiding in +content moderation and creating respectful user interactions. + +#### benchmark\_scoring\_mt + +```python +def benchmark_scoring_mt(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> BenchmarkScoringMt +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6452) + +Create a BenchmarkScoringMt node. + +Benchmark Scoring MT is a function designed to evaluate and score machine +translation systems by comparing their output against a set of predefined +benchmarks, thereby assessing their accuracy and performance. + +#### speaker\_diarization\_audio + +```python +def speaker_diarization_audio(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SpeakerDiarizationAudio +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6461) + +Create a SpeakerDiarizationAudio node. + +Identifies individual speakers and their respective speech segments within an +audio clip. Ideal for multi-speaker recordings or conference calls. + +#### voice\_cloning + +```python +def voice_cloning(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VoiceCloning +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6469) + +Create a VoiceCloning node. + +Replicates a person's voice based on a sample, allowing for the generation of +speech in that person's tone and style. Used cautiously due to ethical +considerations. + +#### search + +```python +def search(asset_id: Union[str, asset.Asset], *args, **kwargs) -> Search +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6478) + +Create a Search node. + +An algorithm that identifies and returns data or items that match particular +keywords or conditions from a dataset. A fundamental tool for databases and +websites. + +#### object\_detection + +```python +def object_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ObjectDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6487) + +Create a ObjectDetection node. + +Object Detection is a computer vision technology that identifies and locates +objects within an image, typically by drawing bounding boxes around the +detected objects and classifying them into predefined categories. + +#### diacritization + +```python +def diacritization(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> Diacritization +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6496) + +Create a Diacritization node. + +Adds diacritical marks to text, essential for languages where meaning can +change based on diacritics. + +#### speaker\_diarization\_video + +```python +def speaker_diarization_video(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SpeakerDiarizationVideo +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6504) + +Create a SpeakerDiarizationVideo node. + +Segments a video based on different speakers, identifying when each individual +speaks. Useful for transcriptions and understanding multi-person conversations. + +#### audio\_forced\_alignment + +```python +def audio_forced_alignment(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AudioForcedAlignment +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6512) + +Create a AudioForcedAlignment node. + +Synchronizes phonetic and phonological text with the corresponding segments in +an audio file. Useful in linguistic research and detailed transcription tasks. + +#### token\_classification + +```python +def token_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TokenClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6520) + +Create a TokenClassification node. + +Token-level classification means that each token will be given a label, for +example a part-of-speech tagger will classify each word as one particular part +of speech. + +#### topic\_classification + +```python +def topic_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TopicClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6529) + +Create a TopicClassification node. + +Assigns categories or topics to a piece of text based on its content, +facilitating content organization and retrieval. + +#### intent\_classification + +```python +def intent_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> IntentClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6537) + +Create a IntentClassification node. + +Intent Classification is a natural language processing task that involves +analyzing and categorizing user text input to determine the underlying purpose +or goal behind the communication, such as booking a flight, asking for weather +information, or setting a reminder. + +#### video\_content\_moderation + +```python +def video_content_moderation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> VideoContentModeration +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6547) + +Create a VideoContentModeration node. + +Automatically reviews video content to detect and possibly remove inappropriate +or harmful material. Essential for user-generated content platforms. + +#### text\_generation\_metric + +```python +def text_generation_metric(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextGenerationMetric +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6555) + +Create a TextGenerationMetric node. + +A Text Generation Metric is a quantitative measure used to evaluate the quality +and effectiveness of text produced by natural language processing models, often +assessing aspects such as coherence, relevance, fluency, and adherence to given +prompts or instructions. + +#### image\_embedding + +```python +def image_embedding(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageEmbedding +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6565) + +Create a ImageEmbedding node. + +Image Embedding is a process that transforms an image into a fixed-dimensional +vector representation, capturing its essential features and enabling efficient +comparison, retrieval, and analysis in various machine learning and computer +vision tasks. + +#### image\_label\_detection + +```python +def image_label_detection(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageLabelDetection +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6575) + +Create a ImageLabelDetection node. + +Identifies objects, themes, or topics within images, useful for image +categorization, search, and recommendation systems. + +#### image\_colorization + +```python +def image_colorization(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageColorization +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6583) + +Create a ImageColorization node. + +Image colorization is a process that involves adding color to grayscale images, +transforming them from black-and-white to full-color representations, often +using advanced algorithms and machine learning techniques to predict and apply +the appropriate hues and shades. + +#### metric\_aggregation + +```python +def metric_aggregation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> MetricAggregation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6593) + +Create a MetricAggregation node. + +Metric Aggregation is a function that computes and summarizes numerical data by +applying statistical operations, such as averaging, summing, or finding the +minimum and maximum values, to provide insights and facilitate analysis of +large datasets. + +#### instance\_segmentation + +```python +def instance_segmentation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> InstanceSegmentation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6603) + +Create a InstanceSegmentation node. + +Instance segmentation is a computer vision task that involves detecting and +delineating each distinct object within an image, assigning a unique label and +precise boundary to every individual instance of objects, even if they belong +to the same category. + +#### other\_\_multipurpose\_ + +```python +def other__multipurpose_(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> OtherMultipurpose +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6613) + +Create a OtherMultipurpose node. + +The "Other (Multipurpose)" function serves as a versatile category designed to +accommodate a wide range of tasks and activities that do not fit neatly into +predefined classifications, offering flexibility and adaptability for various +needs. + +#### speech\_translation + +```python +def speech_translation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> SpeechTranslation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6623) + +Create a SpeechTranslation node. + +Speech Translation is a technology that converts spoken language in real-time +from one language to another, enabling seamless communication between speakers +of different languages. + +#### referenceless\_text\_generation\_metric\_default + +```python +def referenceless_text_generation_metric_default( + asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ReferencelessTextGenerationMetricDefault +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6632) + +Create a ReferencelessTextGenerationMetricDefault node. + +The Referenceless Text Generation Metric Default is a function designed to +evaluate the quality of generated text without relying on reference texts for +comparison. + +#### referenceless\_text\_generation\_metric + +```python +def referenceless_text_generation_metric( + asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ReferencelessTextGenerationMetric +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6643) + +Create a ReferencelessTextGenerationMetric node. + +The Referenceless Text Generation Metric is a method for evaluating the quality +of generated text without requiring a reference text for comparison, often +leveraging models or algorithms to assess coherence, relevance, and fluency +based on intrinsic properties of the text itself. + +#### text\_denormalization + +```python +def text_denormalization(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextDenormalization +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6655) + +Create a TextDenormalization node. + +Converts standardized or normalized text into its original, often more +readable, form. Useful in natural language generation tasks. + +#### image\_compression + +```python +def image_compression(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> ImageCompression +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6663) + +Create a ImageCompression node. + +Reduces the size of image files without significantly compromising their visual +quality. Useful for optimizing storage and improving webpage load times. + +#### text\_classification + +```python +def text_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> TextClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6671) + +Create a TextClassification node. + +Categorizes text into predefined groups or topics, facilitating content +organization and targeted actions. + +#### asr\_age\_classification + +```python +def asr_age_classification(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AsrAgeClassification +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6679) + +Create a AsrAgeClassification node. + +The ASR Age Classification function is designed to analyze audio recordings of +speech to determine the speaker's age group by leveraging automatic speech +recognition (ASR) technology and machine learning algorithms. + +#### asr\_quality\_estimation + +```python +def asr_quality_estimation(asset_id: Union[str, asset.Asset], *args, + **kwargs) -> AsrQualityEstimation +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/pipeline.py#L6688) + +Create a AsrQualityEstimation node. + +ASR Quality Estimation is a process that evaluates the accuracy and reliability +of automatic speech recognition systems by analyzing their performance in +transcribing spoken language into text. + diff --git a/docs/api-reference/python/aixplain/v1/modules/pipeline/response.md b/docs/api-reference/python/aixplain/v1/modules/pipeline/response.md new file mode 100644 index 000000000..e0c6cc6a2 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/pipeline/response.md @@ -0,0 +1,169 @@ +--- +sidebar_label: response +title: aixplain.v1.modules.pipeline.response +--- + +### PipelineResponse Objects + +```python +@dataclass +class PipelineResponse() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/response.py#L7) + +A response object for pipeline operations. + +This class encapsulates the response from pipeline operations, including +status, error information, timing data, and any additional fields. + +**Attributes**: + +- `status` _ResponseStatus_ - The status of the pipeline operation. +- `error` _Optional[Dict[str, Any]]_ - Error details if operation failed. +- `elapsed_time` _Optional[float]_ - Time taken to complete the operation. +- `data` _Optional[Text]_ - The main response data. +- `url` _Optional[Text]_ - URL for polling or accessing results. +- `additional_fields` _Dict[str, Any]_ - Any extra fields provided. + +#### \_\_init\_\_ + +```python +def __init__(status: ResponseStatus, + error: Optional[Dict[str, Any]] = None, + elapsed_time: Optional[float] = 0.0, + data: Optional[Text] = None, + url: Optional[Text] = "", + **kwargs) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/response.py#L22) + +Initialize a new PipelineResponse instance. + +**Arguments**: + +- `status` _ResponseStatus_ - The status of the pipeline operation. +- `error` _Optional[Dict[str, Any]], optional_ - Error details if operation + failed. Defaults to None. +- `elapsed_time` _Optional[float], optional_ - Time taken to complete the + operation in seconds. Defaults to 0.0. +- `data` _Optional[Text], optional_ - The main response data. + Defaults to None. +- `url` _Optional[Text], optional_ - URL for polling or accessing results. + Defaults to "". +- `**kwargs` - Additional fields to store in the response. + +#### \_\_getattr\_\_ + +```python +def __getattr__(key: str) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/response.py#L52) + +Get an attribute from additional_fields if it exists. + +This method is called when an attribute lookup has not found the +attribute in the usual places (i.e., it is not an instance attribute +nor found through the __mro__ chain). + +**Arguments**: + +- `key` _str_ - The name of the attribute to get. + + +**Returns**: + +- `Any` - The value from additional_fields. + + +**Raises**: + +- `AttributeError` - If the key is not found in additional_fields. + +#### get + +```python +def get(key: str, default: Any = None) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/response.py#L73) + +Get an attribute value with a default if not found. + +**Arguments**: + +- `key` _str_ - The name of the attribute to get. +- `default` _Any, optional_ - Value to return if key is not found. + Defaults to None. + + +**Returns**: + +- `Any` - The attribute value or default if not found. + +#### \_\_getitem\_\_ + +```python +def __getitem__(key: str) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/response.py#L86) + +Get an attribute value using dictionary-style access. + +This method enables dictionary-style access to attributes +(e.g., response["status"]). + +**Arguments**: + +- `key` _str_ - The name of the attribute to get. + + +**Returns**: + +- `Any` - The attribute value. + + +**Raises**: + +- `AttributeError` - If the key is not found. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/response.py#L103) + +Return a string representation of the PipelineResponse. + +**Returns**: + +- `str` - A string in the format "PipelineResponse(status=X, error=Y, ...)" + containing all non-empty fields. + +#### \_\_contains\_\_ + +```python +def __contains__(key: str) -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/pipeline/response.py#L123) + +Check if an attribute exists using 'in' operator. + +This method enables using the 'in' operator to check for attribute +existence (e.g., "status" in response). + +**Arguments**: + +- `key` _str_ - The name of the attribute to check. + + +**Returns**: + +- `bool` - True if the attribute exists, False otherwise. + diff --git a/docs/api-reference/python/aixplain/v1/modules/team_agent/evolver_response_data.md b/docs/api-reference/python/aixplain/v1/modules/team_agent/evolver_response_data.md new file mode 100644 index 000000000..32ffa6648 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/team_agent/evolver_response_data.md @@ -0,0 +1,146 @@ +--- +sidebar_label: evolver_response_data +title: aixplain.v1.modules.team_agent.evolver_response_data +--- + +### EvolverResponseData Objects + +```python +class EvolverResponseData() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/evolver_response_data.py#L7) + +Container for team agent evolution response data. + +This class encapsulates all the data returned from a team agent evolution +process, including the evolved agent, code, evaluation reports, and +historical archive information. + +**Attributes**: + +- `evolved_agent` _TeamAgent_ - The evolved team agent instance. +- `current_code` _str_ - The current YAML code representation of the agent. +- `evaluation_report` _str_ - Report containing evaluation results. +- `comparison_report` _str_ - Report comparing different agent versions. +- `criteria` _str_ - Criteria used for evolution evaluation. +- `archive` _List[str]_ - Historical archive of previous versions. +- `current_output` _str_ - Current output from the agent. + +#### \_\_init\_\_ + +```python +def __init__(evolved_agent: "TeamAgent", + current_code: Text, + evaluation_report: Text, + comparison_report: Text, + criteria: Text, + archive: List[Text], + current_output: Text = "") -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/evolver_response_data.py#L25) + +Initialize the EvolverResponseData instance. + +**Arguments**: + +- `evolved_agent` _TeamAgent_ - The evolved team agent instance. +- `current_code` _str_ - The current YAML code representation. +- `evaluation_report` _str_ - Report containing evaluation results. +- `comparison_report` _str_ - Report comparing different versions. +- `criteria` _str_ - Criteria used for evolution evaluation. +- `archive` _List[str]_ - Historical archive of previous versions. +- `current_output` _str, optional_ - Current output from the agent. + Defaults to empty string. + +#### from\_dict + +```python +@classmethod +def from_dict(cls, data: Dict[str, Any], llm_id: Text, + api_key: Text) -> "EvolverResponseData" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/evolver_response_data.py#L57) + +Create an EvolverResponseData instance from a dictionary. + +**Arguments**: + +- `data` _Dict[str, Any]_ - Dictionary containing the response data. +- `llm_id` _str_ - The LLM identifier for building the team agent. +- `api_key` _str_ - API key for accessing the LLM service. + + +**Returns**: + +- `EvolverResponseData` - A new instance created from the dictionary data. + +#### to\_dict + +```python +def to_dict() -> Dict[str, Any] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/evolver_response_data.py#L83) + +Convert the EvolverResponseData instance to a dictionary. + +**Returns**: + + Dict[str, Any]: Dictionary representation of the instance data. + +#### \_\_getitem\_\_ + +```python +def __getitem__(key: str) -> Any +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/evolver_response_data.py#L100) + +Get an attribute value using dictionary-style access. + +**Arguments**: + +- `key` _str_ - The attribute name to retrieve. + + +**Returns**: + +- `Any` - The value of the requested attribute, or None if not found. + +#### \_\_setitem\_\_ + +```python +def __setitem__(key: str, value: Any) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/evolver_response_data.py#L112) + +Set an attribute value using dictionary-style access. + +**Arguments**: + +- `key` _str_ - The attribute name to set. +- `value` _Any_ - The value to assign to the attribute. + + +**Raises**: + +- `KeyError` - If the key is not a valid attribute of the class. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/evolver_response_data.py#L128) + +Return a string representation of the EvolverResponseData instance. + +**Returns**: + +- `str` - A string representation showing key attributes of the instance. + diff --git a/docs/api-reference/python/aixplain/v1/modules/team_agent/init.md b/docs/api-reference/python/aixplain/v1/modules/team_agent/init.md new file mode 100644 index 000000000..6cd1da800 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/team_agent/init.md @@ -0,0 +1,502 @@ +--- +sidebar_label: team_agent +title: aixplain.v1.modules.team_agent +--- + +Team Agent module for aiXplain SDK. + +This module provides the TeamAgent class and related functionality for creating and managing +multi-agent teams that can collaborate on complex tasks. + +Copyright 2024 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: Lucas Pavanelli and Thiago Castro Ferreira +Date: August 15th 2024 +Description: + Team Agent Class + +### InspectorTarget Objects + +```python +class InspectorTarget(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L60) + +Target stages for inspector validation in the team agent pipeline. + +This enumeration defines the stages where inspectors can be applied to +validate and ensure quality of the team agent's operation. + +**Attributes**: + +- `INPUT` - Validates the input data before processing. +- `STEPS` - Validates intermediate steps during processing. +- `OUTPUT` - Validates the final output before returning. + +#### \_\_str\_\_ + +```python +def __str__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L76) + +Return the string value of the enum member. + +**Returns**: + +- `str` - The string value associated with the enum member. + +### TeamAgent Objects + +```python +class TeamAgent(Model, DeployableMixin[Agent]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L85) + +Advanced AI system capable of using multiple agents to perform a variety of tasks. + +**Attributes**: + +- `id` _Text_ - ID of the Team Agent +- `name` _Text_ - Name of the Team Agent +- `agents` _List[Agent]_ - List of agents that the Team Agent uses. +- `description` _Text, optional_ - description of the Team Agent. Defaults to "". +- `llm` _Optional[LLM]_ - Main LLM instance for the team agent. +- `supervisor_llm` _Optional[LLM]_ - Supervisor LLM instance for the team agent. +- `api_key` _str_ - The TEAM API key used for authentication. +- `supplier` _Text_ - Supplier of the Team Agent. +- `version` _Text_ - Version of the Team Agent. +- `cost` _Dict, optional_ - model price. Defaults to None. +- `name`0 _AssetStatus_ - Status of the Team Agent. Defaults to DRAFT. +- `name`1 _Optional[Text]_ - Instructions to guide the team agent. +- `name`2 _OutputFormat_ - Response format. Defaults to TEXT. +- `name`3 _Optional[Union[BaseModel, Text, dict]]_ - Expected output format. + + Deprecated Attributes: +- `name`4 _Text_ - DEPRECATED. Use 'llm' parameter instead. Large language model ID. +- `name`5 _Optional[LLM]_ - DEPRECATED. LLM for planning. +- `name`6 _bool_ - DEPRECATED. Whether to use Mentalist agent for pre-planning. + +#### \_\_init\_\_ + +```python +def __init__(id: Text, + name: Text, + agents: List[Agent] = [], + description: Text = "", + llm: Optional[LLM] = None, + supervisor_llm: Optional[LLM] = None, + api_key: Optional[Text] = config.TEAM_API_KEY, + supplier: Union[Dict, Text, Supplier, int] = "aiXplain", + version: Optional[Text] = None, + cost: Optional[Dict] = None, + status: AssetStatus = AssetStatus.DRAFT, + instructions: Optional[Text] = None, + output_format: OutputFormat = OutputFormat.TEXT, + expected_output: Optional[Union[BaseModel, Text, dict]] = None, + **additional_info) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L112) + +Initialize a TeamAgent instance. + +**Arguments**: + +- `id` _Text_ - Unique identifier for the team agent. +- `name` _Text_ - Name of the team agent. +- `agents` _List[Agent], optional_ - List of agents in the team. Defaults to []. +- `description` _Text, optional_ - Description of the team agent. Defaults to "". +- `llm` _Optional[LLM], optional_ - LLM instance. Defaults to None. +- `supervisor_llm` _Optional[LLM], optional_ - Supervisor LLM instance. Defaults to None. +- `api_key` _Optional[Text], optional_ - API key. Defaults to config.TEAM_API_KEY. +- `supplier` _Union[Dict, Text, Supplier, int], optional_ - Supplier. Defaults to "aiXplain". +- `version` _Optional[Text], optional_ - Version. Defaults to None. +- `cost` _Optional[Dict], optional_ - Cost information. Defaults to None. +- `name`0 _AssetStatus, optional_ - Status of the team agent. Defaults to AssetStatus.DRAFT. +- `name`1 _Optional[Text], optional_ - Instructions for the team agent. Defaults to None. +- `name`2 _OutputFormat, optional_ - Output format. Defaults to OutputFormat.TEXT. +- `name`3 _Optional[Union[BaseModel, Text, dict]], optional_ - Expected output format. Defaults to None. +- `name`4 - Additional keyword arguments. + + Deprecated Args: +- `name`5 _Text, optional_ - DEPRECATED. Use 'llm' parameter instead. ID of the language model. Defaults to "6895d6d1d50c89537c1cf237". +- `name`6 _Optional[LLM], optional_ - DEPRECATED. Mentalist/Planner LLM instance. Defaults to None. +- `name`7 _bool, optional_ - DEPRECATED. Whether to use mentalist/planner. Defaults to True. + +#### generate\_session\_id + +```python +def generate_session_id(history: list = None) -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L241) + +Generate a new session ID for the team agent. + +**Arguments**: + +- `history` _list, optional_ - Chat history to initialize the session with. Defaults to None. + + +**Returns**: + +- `str` - The generated session ID in format "\{team_agent_id}_\{timestamp}". + +#### sync\_poll + +```python +def sync_poll(poll_url: Text, + name: Text = "model_process", + wait_time: float = 0.5, + timeout: float = 300, + progress_verbosity: Optional[str] = "compact") -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L490) + +Poll the platform until team agent execution completes or times out. + +**Arguments**: + +- `poll_url` _Text_ - URL to poll for operation status. +- `name` _Text, optional_ - Identifier for the operation. Defaults to "model_process". +- `wait_time` _float, optional_ - Initial wait time in seconds between polls. Defaults to 0.5. +- `timeout` _float, optional_ - Maximum total time to poll in seconds. Defaults to 300. +- `progress_verbosity` _Optional[str], optional_ - Progress display mode - "full" (detailed), "compact" (brief), or None (no progress). Defaults to "compact". + + +**Returns**: + +- `AgentResponse` - The final response from the team agent execution. + +#### run + +```python +def run(data: Optional[Union[Dict, Text]] = None, + query: Optional[Text] = None, + session_id: Optional[Text] = None, + history: Optional[List[Dict]] = None, + name: Text = "model_process", + timeout: float = 300, + parameters: Dict = {}, + wait_time: float = 0.5, + content: Optional[Union[Dict[Text, Text], List[Text]]] = None, + max_tokens: int = 2048, + max_iterations: int = 30, + trace_request: bool = False, + progress_verbosity: Optional[str] = "compact", + **kwargs) -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L568) + +Runs a team agent call. + +**Arguments**: + +- `data` _Optional[Union[Dict, Text]], optional_ - data to be processed by the team agent. Defaults to None. +- `query` _Optional[Text], optional_ - query to be processed by the team agent. Defaults to None. +- `session_id` _Optional[Text], optional_ - conversation Session ID. Defaults to None. +- `history` _Optional[List[Dict]], optional_ - chat history (in case session ID is None). Defaults to None. +- `name` _Text, optional_ - ID given to a call. Defaults to "model_process". +- `timeout` _float, optional_ - total polling time. Defaults to 300. +- `parameters` _Dict, optional_ - optional parameters to the model. Defaults to "\{}". +- `wait_time` _float, optional_ - wait time in seconds between polling calls. Defaults to 0.5. +- `content` _Union[Dict[Text, Text], List[Text]], optional_ - Content inputs to be processed according to the query. Defaults to None. +- `max_tokens` _int, optional_ - maximum number of tokens which can be generated by the agents. Defaults to 2048. +- `query`0 _int, optional_ - maximum number of iterations between the agents. Defaults to 30. +- `query`1 _bool, optional_ - return the request id for tracing the request. Defaults to False. +- `query`2 _Optional[str], optional_ - Progress display mode - "full" (detailed), "compact" (brief), or None (no progress). Defaults to "compact". +- `query`3 - Additional deprecated keyword arguments (output_format, expected_output). + + +**Returns**: + +- `query`4 - parsed output from model + +#### run\_async + +```python +def run_async(data: Optional[Union[Dict, Text]] = None, + query: Optional[Text] = None, + session_id: Optional[Text] = None, + history: Optional[List[Dict]] = None, + name: Text = "model_process", + parameters: Dict = {}, + content: Optional[Union[Dict[Text, Text], List[Text]]] = None, + max_tokens: int = 2048, + max_iterations: int = 30, + output_format: Optional[OutputFormat] = None, + expected_output: Optional[Union[BaseModel, Text, dict]] = None, + evolve: Union[Dict[str, Any], EvolveParam, None] = None, + trace_request: bool = False) -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L699) + +Runs asynchronously a Team Agent call. + +**Arguments**: + +- `data` _Optional[Union[Dict, Text]], optional_ - data to be processed by the Team Agent. Defaults to None. +- `query` _Optional[Text], optional_ - query to be processed by the Team Agent. Defaults to None. +- `session_id` _Optional[Text], optional_ - conversation Session ID. Defaults to None. +- `history` _Optional[List[Dict]], optional_ - chat history (in case session ID is None). Defaults to None. +- `name` _Text, optional_ - ID given to a call. Defaults to "model_process". +- `parameters` _Dict, optional_ - optional parameters to the model. Defaults to "\{}". +- `content` _Union[Dict[Text, Text], List[Text]], optional_ - Content inputs to be processed according to the query. Defaults to None. +- `max_tokens` _int, optional_ - maximum number of tokens which can be generated by the agents. Defaults to 2048. +- `max_iterations` _int, optional_ - maximum number of iterations between the agents. Defaults to 30. +- `output_format` _OutputFormat, optional_ - response format. If not provided, uses the format set during initialization. +- `query`0 _Union[BaseModel, Text, dict], optional_ - expected output. Defaults to None. +- `query`1 _Union[Dict[str, Any], EvolveParam, None], optional_ - evolve the team agent configuration. Can be a dictionary, EvolveParam instance, or None. +- `query`2 _bool, optional_ - return the request id for tracing the request. Defaults to False. + + +**Returns**: + +- `query`3 - polling URL in response + +#### poll + +```python +def poll(poll_url: Text, name: Text = "model_process") -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L842) + +Poll once for team agent execution status. + +**Arguments**: + +- `poll_url` _Text_ - URL to poll for status. +- `name` _Text, optional_ - Identifier for the operation. Defaults to "model_process". + + +**Returns**: + +- `AgentResponse` - Response containing status, data, and progress information. + +#### delete + +```python +def delete() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L917) + +Deletes Team Agent. + +#### to\_dict + +```python +def to_dict() -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L979) + +Convert the TeamAgent instance to a dictionary representation. + +This method serializes the TeamAgent and all its components (agents, LLMs, etc.) into a dictionary format suitable for storage +or transmission. + +**Returns**: + +- `Dict` - A dictionary containing: + - id (str): The team agent's ID + - name (str): The team agent's name + - agents (List[Dict]): Serialized list of agents + - links (List): Empty list (reserved for future use) + - description (str): The team agent's description + - llmId (str): ID of the main language model + - supervisorId (str): ID of the supervisor language model + - plannerId (str): ID of the planner model (if use_mentalist) + - supplier (str): The supplier code + - version (str): The version number + - status (str): The current status + - instructions (str): The team agent's instructions + +#### from\_dict + +```python +@classmethod +def from_dict(cls, data: Dict) -> "TeamAgent" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L1022) + +Create a TeamAgent instance from a dictionary representation. + +**Arguments**: + +- `data` - Dictionary containing TeamAgent parameters + + +**Returns**: + + TeamAgent instance + +#### validate + +```python +def validate(raise_exception: bool = False) -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L1123) + +Validate the TeamAgent configuration. + +This method checks the validity of the TeamAgent's configuration, +including name format, LLM compatibility, and agent validity. + +**Arguments**: + +- `raise_exception` _bool, optional_ - If True, raises exceptions for + validation failures. If False, logs warnings. Defaults to False. + + +**Returns**: + +- `bool` - True if validation succeeds, False otherwise. + + +**Raises**: + +- `Exception` - If raise_exception is True and validation fails, with + details about the specific validation error. + + +**Notes**: + + - The team agent cannot be run until all validation issues are fixed + - Name must contain only alphanumeric chars, spaces, hyphens, brackets + - LLM must be a text generation model + - All agents must pass their own validation + +#### update + +```python +def update() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L1159) + +Update the TeamAgent in the backend. + +This method validates and updates the TeamAgent's configuration in the +backend system. It is deprecated in favor of the save() method. + +**Raises**: + +- `Exception` - If validation fails or if the update request fails. + Specific error messages will indicate: + - Validation failures with details + - HTTP errors with status codes + - General update errors requiring admin attention + + +**Notes**: + + - This method is deprecated, use save() instead + - Performs validation before attempting update + - Requires valid team API key for authentication + - Returns a new TeamAgent instance if successful + +#### save + +```python +def save() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L1211) + +Save the Agent. + +#### \_\_repr\_\_ + +```python +def __repr__() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L1215) + +Return a string representation of the TeamAgent. + +**Returns**: + +- `str` - A string in the format "TeamAgent: <name> (id=<id>)". + +#### evolve\_async + +```python +def evolve_async(evolve_type: Union[EvolveType, str] = EvolveType.TEAM_TUNING, + max_successful_generations: int = 3, + max_failed_generation_retries: int = 3, + max_iterations: int = 50, + max_non_improving_generations: Optional[int] = 2, + llm: Optional[Union[Text, LLM]] = None) -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L1223) + +Asynchronously evolve the Team Agent and return a polling URL in the AgentResponse. + +**Arguments**: + +- `evolve_type` _Union[EvolveType, str]_ - Type of evolution (TEAM_TUNING or INSTRUCTION_TUNING). Defaults to TEAM_TUNING. +- `max_successful_generations` _int_ - Maximum number of successful generations to evolve. Defaults to 3. +- `max_failed_generation_retries` _int_ - Maximum retry attempts for failed generations. Defaults to 3. +- `max_iterations` _int_ - Maximum number of iterations. Defaults to 50. +- `max_non_improving_generations` _Optional[int]_ - Stop condition parameter for non-improving generations. Defaults to 2, can be None. +- `llm` _Optional[Union[Text, LLM]]_ - LLM to use for evolution. Can be an LLM ID string or LLM object. Defaults to None. + + +**Returns**: + +- `AgentResponse` - Response containing polling URL and status. + +#### evolve + +```python +def evolve(evolve_type: Union[EvolveType, str] = EvolveType.TEAM_TUNING, + max_successful_generations: int = 3, + max_failed_generation_retries: int = 3, + max_iterations: int = 50, + max_non_improving_generations: Optional[int] = 2, + llm: Optional[Union[Text, LLM]] = None) -> AgentResponse +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/__init__.py#L1263) + +Synchronously evolve the Team Agent and poll for the result. + +**Arguments**: + +- `evolve_type` _Union[EvolveType, str]_ - Type of evolution (TEAM_TUNING or INSTRUCTION_TUNING). Defaults to TEAM_TUNING. +- `max_successful_generations` _int_ - Maximum number of successful generations to evolve. Defaults to 3. +- `max_failed_generation_retries` _int_ - Maximum retry attempts for failed generations. Defaults to 3. +- `max_iterations` _int_ - Maximum number of iterations. Defaults to 50. +- `max_non_improving_generations` _Optional[int]_ - Stop condition parameter for non-improving generations. Defaults to 2, can be None. +- `llm` _Optional[Union[Text, LLM]]_ - LLM to use for evolution. Can be an LLM ID string or LLM object. Defaults to None. + + +**Returns**: + +- `AgentResponse` - Final response from the evolution process. + diff --git a/docs/api-reference/python/aixplain/v1/modules/team_agent/inspector.md b/docs/api-reference/python/aixplain/v1/modules/team_agent/inspector.md new file mode 100644 index 000000000..db7e38dfc --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/team_agent/inspector.md @@ -0,0 +1,209 @@ +--- +sidebar_label: inspector +title: aixplain.v1.modules.team_agent.inspector +--- + +Pre-defined agent for inspecting the data flow within a team agent. + +WARNING: This feature is currently in private beta. + +#### AUTO\_DEFAULT\_MODEL\_ID + +GPT-4.1 Nano + +### Inspectoraction\_type Objects + +```python +class Inspectoraction_type(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L19) + +Enum defining the types of actions an inspector can take. + +### InspectorOnExhaust Objects + +```python +class InspectorOnExhaust(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L28) + +Enum defining behavior when inspector retries are exhausted. + +### InspectorSeverity Objects + +```python +class InspectorSeverity(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L35) + +Enum defining the severity levels for inspector findings. + +### InspectorActionConfig Objects + +```python +class InspectorActionConfig(BaseModel) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L48) + +Configuration for what an inspector should do when it finds issues. + +LLM-style actions (continue/rerun/abort): + - evaluator + evaluator_prompt + - (rerun only) max_retries/on_exhaust + +EDIT action: + - edit_fn (required) + - edit_evaluator_fn (optional gate) + +#### to\_dict + +```python +def to_dict() -> Dict[str, Any] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L122) + +Convert the action config to a dictionary for serialization. + +**Returns**: + + Dict[str, Any]: Dictionary representation with camelCase keys. + +### Inspector Objects + +```python +class Inspector(BaseModel) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L136) + +Inspector config object (SDK-side). + +#### validate\_name + +```python +@field_validator("name") +@classmethod +def validate_name(cls, v: Text) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L147) + +Validate that the inspector name is not empty. + +**Arguments**: + +- `v` - The name value to validate. + + +**Returns**: + + The validated name. + + +**Raises**: + +- `ValueError` - If the name is empty or whitespace-only. + +#### validate\_targets + +```python +@field_validator("targets") +@classmethod +def validate_targets(cls, v: List[Text]) -> List[Text] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L165) + +Validate and filter the targets list. + +**Arguments**: + +- `v` - The list of target names to validate. + + +**Returns**: + + A filtered list containing only non-empty target names. + +#### model\_dump + +```python +def model_dump(*args, **kwargs) -> Dict[str, Any] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L178) + +Serialize the inspector to a dictionary. + +**Arguments**: + +- `*args` - Positional arguments passed to parent model_dump. +- `**kwargs` - Keyword arguments passed to parent model_dump. + + +**Returns**: + + Dict[str, Any]: Dictionary representation of the inspector. + +#### to\_dict + +```python +def to_dict() -> Dict[str, Any] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L194) + +Convert the inspector to a dictionary for serialization. + +**Returns**: + + Dict[str, Any]: Dictionary representation excluding None values. + +### VerificationInspector Objects + +```python +class VerificationInspector(Inspector) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L203) + +Convenience inspector for rerun-based verification. + +#### \_\_init\_\_ + +```python +def __init__( + *, + evaluator: Text, + evaluator_prompt: Text = "Check the output against the plan", + targets: Optional[List[Text]] = None, + maxRetries: int = 2, + onExhaust: InspectorOnExhaust = InspectorOnExhaust.CONTINUE, + severity: InspectorSeverity = InspectorSeverity.MEDIUM, + name: Text = "VerificationInspector", + description: + Text = "Checks output against the plan and requests rerun on mismatch", + **kwargs: Any) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/team_agent/inspector.py#L206) + +Initialize a verification inspector with rerun-based verification. + +**Arguments**: + +- `evaluator` - The evaluator model ID to use for verification. +- `evaluator_prompt` - The prompt for the evaluator. +- `targets` - List of target agent names to inspect. +- `maxRetries` - Maximum number of rerun attempts. +- `onExhaust` - Behavior when retries are exhausted. +- `severity` - The severity level of this inspector. +- `name` - The name of the inspector. +- `description` - Description of the inspector's purpose. +- `**kwargs` - Additional keyword arguments passed to the parent class. + diff --git a/docs/api-reference/python/aixplain/v1/modules/wallet.md b/docs/api-reference/python/aixplain/v1/modules/wallet.md new file mode 100644 index 000000000..ef289f816 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/modules/wallet.md @@ -0,0 +1,61 @@ +--- +sidebar_label: wallet +title: aixplain.v1.modules.wallet +--- + +#### \_\_author\_\_ + +Copyright 2024 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: aiXplain Team +Date: August 20th 2024 +Description: + Wallet Class + +### Wallet Objects + +```python +class Wallet() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/wallet.py#L25) + +A class representing a wallet for managing credit balances. + +This class provides functionality for managing credit balances in a wallet, +including total, reserved, and available balances. It is used to track and +manage credit resources in the aiXplain platform. + +**Attributes**: + +- `total_balance` _float_ - Total credit balance in the wallet. +- `reserved_balance` _float_ - Reserved credit balance in the wallet. +- `available_balance` _float_ - Available balance (total - reserved). + +#### \_\_init\_\_ + +```python +def __init__(total_balance: float, reserved_balance: float) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/modules/wallet.py#L38) + +Initialize a new Wallet instance. + +**Arguments**: + +- `total_balance` _float_ - Total credit balance in the wallet. +- `reserved_balance` _float_ - Reserved credit balance in the wallet. + diff --git a/docs/api-reference/python/aixplain/v1/processes/data_onboarding/init.md b/docs/api-reference/python/aixplain/v1/processes/data_onboarding/init.md new file mode 100644 index 000000000..d95322587 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/processes/data_onboarding/init.md @@ -0,0 +1,6 @@ +--- +draft: true +sidebar_label: data_onboarding +title: aixplain.v1.processes.data_onboarding +--- + diff --git a/docs/api-reference/python/aixplain/v1/processes/data_onboarding/onboard_functions.md b/docs/api-reference/python/aixplain/v1/processes/data_onboarding/onboard_functions.md new file mode 100644 index 000000000..a8acef4bf --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/processes/data_onboarding/onboard_functions.md @@ -0,0 +1,299 @@ +--- +sidebar_label: onboard_functions +title: aixplain.v1.processes.data_onboarding.onboard_functions +--- + +#### get\_paths + +```python +def get_paths(input_paths: List[Union[str, Path]]) -> List[Path] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/onboard_functions.py#L40) + +Recursively collect all supported local file paths from the given input paths. + +This function traverses through the provided paths, which can be files or directories, +and collects paths to all supported files (currently only CSV files). It also performs +size validation to ensure files don't exceed 1GB. + +**Arguments**: + +- `input_paths` _List[Union[str, Path]]_ - List of input paths. Can include both + individual file paths and directory paths. + + +**Returns**: + +- `List[Path]` - List of validated local file paths that are supported. + + +**Raises**: + +- `AssertionError` - If any CSV file exceeds 1GB in size. +- `Warning` - If a file has an unsupported extension. + +#### process\_data\_files + +```python +def process_data_files( + data_asset_name: str, + metadata: MetaData, + paths: List, + folder: Optional[Union[str, Path]] = None +) -> Tuple[List[File], int, int, int, int] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/onboard_functions.py#L85) + +Process data files based on their type and prepare them for upload to S3. + +This function handles different types of data files (audio, image, text, etc.) +by delegating to appropriate processing modules. It compresses the files if needed +and prepares them for upload to S3. + +**Arguments**: + +- `data_asset_name` _str_ - Name of the data asset being processed. +- `metadata` _MetaData_ - Metadata object containing type and subtype information + for the data being processed. +- `paths` _List_ - List of paths to local files that need processing. +- `folder` _Optional[Union[str, Path]], optional_ - Local folder to save processed + files before uploading to S3. If None, uses data_asset_name. Defaults to None. + + +**Returns**: + + Tuple[List[File], int, int, int, int]: A tuple containing: + - List[File]: List of processed file objects ready for S3 upload + - int: Index of the data column + - int: Index of the start column (for intervals) + - int: Index of the end column (for intervals) + - int: Total number of rows processed + +#### build\_payload\_data + +```python +def build_payload_data(data: Data) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/onboard_functions.py#L136) + +Build a payload dictionary for data onboarding to the core engine. + +This function creates a standardized payload structure for onboarding data +to the core engine. It includes data properties, file information, and metadata +such as languages and column mappings. + +**Arguments**: + +- `data` _Data_ - Data object containing information about the data to be onboarded, + including name, type, files, and language information. + + +**Returns**: + +- `Dict` - A dictionary containing the formatted payload with the following key fields: + - name: Name of the data + - dataColumn: Column identifier for the data + - dataType: Type of the data + - dataSubtype: Subtype of the data + - batches: List of file information with paths and order + - tags: List of descriptive tags + - metaData: Additional metadata including languages + Additional fields may be added for interval data (start/end columns). + +#### build\_payload\_corpus + +```python +def build_payload_corpus(corpus: Corpus, ref_data: List[Text], + error_handler: ErrorHandler) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/onboard_functions.py#L186) + +Build a payload dictionary for corpus onboarding to the core engine. + +This function creates a standardized payload structure for onboarding a corpus, +including all its associated data, metadata, and configuration settings. + +**Arguments**: + +- `corpus` _Corpus_ - Corpus object containing the data collection to be onboarded, + including name, description, functions, and associated data. +- `ref_data` _List[Text]_ - List of referenced data IDs that this corpus depends on + or is related to. +- `error_handler` _ErrorHandler_ - Configuration for how to handle rows that fail + during the onboarding process. + + +**Returns**: + +- `Dict` - A dictionary containing the formatted payload with the following key fields: + - name: Name of the corpus + - description: Description of the corpus + - suggestedFunctions: List of suggested AI functions + - onboardingErrorsPolicy: Error handling policy + - tags: List of descriptive tags + - pricing: Pricing configuration + - privacy: Privacy settings + - license: License information + - refData: Referenced data IDs + - data: List of data payloads for each data component + +#### build\_payload\_dataset + +```python +def build_payload_dataset(dataset: Dataset, input_ref_data: Dict[Text, Any], + output_ref_data: Dict[Text, List[Any]], + hypotheses_ref_data: Dict[Text, Any], + meta_ref_data: Dict[Text, Any], tags: List[Text], + error_handler: ErrorHandler) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/onboard_functions.py#L232) + +Build a payload dictionary for dataset onboarding to the core engine. + +This function creates a comprehensive payload structure for onboarding a dataset, +including all its components: input data, output data, hypotheses, and metadata. +It handles both new data and references to existing data. + +**Arguments**: + +- `dataset` _Dataset_ - Dataset object to be onboarded, containing all the data + components and configuration. +- `input_ref_data` _Dict[Text, Any]_ - Dictionary mapping input names to existing + data IDs in the system. +- `output_ref_data` _Dict[Text, List[Any]]_ - Dictionary mapping output names to + lists of existing data IDs for multi-reference outputs. +- `hypotheses_ref_data` _Dict[Text, Any]_ - Dictionary mapping hypothesis names to + existing data IDs for model outputs or predictions. +- `meta_ref_data` _Dict[Text, Any]_ - Dictionary mapping metadata names to existing + metadata IDs in the system. +- `tags` _List[Text]_ - List of descriptive tags for the dataset. +- `error_handler` _ErrorHandler_ - Configuration for how to handle rows that fail + during the onboarding process. + + +**Returns**: + +- `Dict` - A dictionary containing the formatted payload with the following sections: + - Basic information (name, description, function, etc.) + - Configuration (error handling, privacy, license) + - Input data section with both new and referenced inputs + - Output data section with both new and referenced outputs + - Hypotheses section with both new and referenced hypotheses + - Metadata section with both new and referenced metadata + +#### create\_data\_asset + +```python +def create_data_asset(payload: Dict, + data_asset_type: Text = "corpus", + api_key: Optional[Text] = None) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/onboard_functions.py#L367) + +Create a new data asset (corpus or dataset) in the core engine. + +This function sends the onboarding request to the core engine and handles the response. +It supports both corpus and dataset creation with proper authentication. + +**Arguments**: + +- `payload` _Dict_ - The complete payload for the data asset, containing all necessary + information for onboarding (structure depends on data_asset_type). +- `data_asset_type` _Text, optional_ - Type of data asset to create. Must be either + "corpus" or "dataset". Defaults to "corpus". +- `api_key` _Optional[Text], optional_ - Team API key for authentication. If None, + uses the default key from config. Defaults to None. + + +**Returns**: + +- `Dict` - A dictionary containing the onboarding status with the following fields: + - success (bool): Whether the operation was successful + - asset_id (str): ID of the created asset (if successful) + - status (str): Current status of the asset (if successful) + - error (str): Error message (if not successful) + + +**Notes**: + + The function handles both successful and failed responses, providing appropriate + error messages in case of failure. + +#### is\_data + +```python +def is_data(data_id: Text) -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/onboard_functions.py#L423) + +Check if a data object exists in the system by its ID. + +This function makes an API call to verify the existence of a data object +in the system. It's typically used to validate references before creating +new assets that depend on existing data. + +**Arguments**: + +- `data_id` _Text_ - The ID of the data object to check. + + +**Returns**: + +- `bool` - True if the data exists and is accessible, False otherwise. + Returns False in case of API errors or if the data is not found. + + +**Notes**: + + The function handles API errors gracefully, returning False instead + of raising exceptions. + +#### split\_data + +```python +def split_data(paths: List, split_rate: List[float], + split_labels: List[Text]) -> MetaData +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/onboard_functions.py#L456) + +Split data files into partitions based on specified rates and labels. + +This function adds a new column to CSV files to indicate the split assignment +for each row. It randomly assigns rows to splits based on the provided rates. +The function tries to find an unused column name for the split information. + +**Arguments**: + +- `paths` _List_ - List of paths to CSV files that need to be split. +- `split_rate` _List[float]_ - List of proportions for each split. Should sum to 1.0. + For example, [0.8, 0.1, 0.1] for train/dev/test split. +- `split_labels` _List[Text]_ - List of labels corresponding to each split rate. + For example, ["train", "dev", "test"]. + + +**Returns**: + +- `MetaData` - A metadata object for the new split column with: + - name: The generated column name for the split + - dtype: Set to DataType.LABEL + - dsubtype: Set to DataSubtype.SPLIT + - storage_type: Set to StorageType.TEXT + + +**Raises**: + +- `Exception` - If no available column name is found or if file operations fail. + + +**Notes**: + + The function modifies the input CSV files in place, adding the new split column. + diff --git a/docs/api-reference/python/aixplain/v1/processes/data_onboarding/process_media_files.md b/docs/api-reference/python/aixplain/v1/processes/data_onboarding/process_media_files.md new file mode 100644 index 000000000..24428605b --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/processes/data_onboarding/process_media_files.md @@ -0,0 +1,83 @@ +--- +sidebar_label: process_media_files +title: aixplain.v1.processes.data_onboarding.process_media_files +--- + +#### compress\_folder + +```python +def compress_folder(folder_path: str) -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/process_media_files.py#L25) + +Compress a folder into a gzipped tar archive. + +This function takes a folder and creates a compressed tar archive (.tgz) +containing all files in the folder. The archive is created in the same +directory as the input folder. + +**Arguments**: + +- `folder_path` _str_ - Path to the folder to be compressed. + + +**Returns**: + +- `str` - Path to the created .tgz archive file. + +#### run + +```python +def run(metadata: MetaData, + paths: List, + folder: Path, + batch_size: int = 100) -> Tuple[List[File], int, int, int, int] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/process_media_files.py#L44) + +Process media files and prepare them for upload to S3 with batch processing. + +This function handles the processing and uploading of media files (audio, image, etc.) +to S3. It supports both local files and public URLs, processes them in batches, +and creates index files to track the media locations and any interval information. + +The process works as follows: +1. For each media file in the input paths: +- If it's a public URL: Add the URL to an index CSV file +- If it's a local file: Copy to a temporary folder and add path to index +2. After every batch_size files: +- For local files: Compress the folder into .tgz and upload to S3 +- Create and upload an index CSV file with paths and metadata +- Reset for the next batch + +**Arguments**: + +- `metadata` _MetaData_ - Metadata object containing information about the media type, + storage type, and column mappings. +- `paths` _List_ - List of paths to CSV files containing media information. +- `folder` _Path_ - Local folder path where temporary files and compressed archives + will be stored during processing. +- `batch_size` _int, optional_ - Number of media files to process in each batch. + Defaults to 100. + + +**Returns**: + + Tuple[List[File], int, int, int, int]: A tuple containing: + - List[File]: List of File objects pointing to uploaded index files in S3 + - int: Index of the data column in the index CSV + - int: Index of the start column for intervals (-1 if not used) + - int: Index of the end column for intervals (-1 if not used) + - int: Total number of media files processed + + +**Raises**: + +- `Exception` - If: + - Input files are not found + - Required columns are missing + - File size limits are exceeded (50MB for audio, 25MB for others) + - Invalid interval configurations are detected + diff --git a/docs/api-reference/python/aixplain/v1/processes/data_onboarding/process_text_files.md b/docs/api-reference/python/aixplain/v1/processes/data_onboarding/process_text_files.md new file mode 100644 index 000000000..859ea26c4 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/processes/data_onboarding/process_text_files.md @@ -0,0 +1,98 @@ +--- +sidebar_label: process_text_files +title: aixplain.v1.processes.data_onboarding.process_text_files +--- + +#### process\_text + +```python +def process_text(content: str, storage_type: StorageType) -> Text +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/process_text_files.py#L18) + +Process text content based on its storage type and location. + +This function handles different types of text content: +- Local files: Reads the file content (with size validation) +- URLs: Marks them for non-download if they're public links +- Direct text: Uses the content as-is + +**Arguments**: + +- `content` _str_ - The text content to process. Can be: + - A path to a local file + - A URL pointing to text content + - The actual text content +- `storage_type` _StorageType_ - The type of storage for the content: + - StorageType.FILE for local files + - StorageType.TEXT for direct text content + - Other storage types for different handling + + +**Returns**: + +- `Text` - The processed text content. URLs may be prefixed with + "DONOTDOWNLOAD" if they should not be downloaded. + + +**Raises**: + +- `AssertionError` - If a local text file exceeds 25MB in size. +- `IOError` - If there are issues reading a local file. + +#### run + +```python +def run(metadata: MetaData, + paths: List, + folder: Path, + batch_size: int = 1000) -> Tuple[List[File], int, int] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v1/processes/data_onboarding/process_text_files.py#L65) + +Process text files in batches and upload them to S3 with index tracking. + +This function processes text files (either local or from URLs) in batches, +creating compressed CSV index files that track the text content and their +positions. The index files are then uploaded to S3. + +The process works as follows: +1. For each input CSV file: +- Read the specified column containing text content/paths +- Process each text entry (read files, handle URLs) +- Add processed text to the current batch +2. After every batch_size entries: +- Create a new index CSV with the processed texts +- Add row indices for tracking +- Compress and upload the index to S3 +- Start a new batch + +**Arguments**: + +- `metadata` _MetaData_ - Metadata object containing information about the text data, + including column names and storage type configuration. +- `paths` _List_ - List of paths to CSV files containing the text data or + references to text content. +- `folder` _Path_ - Local folder path where the generated index files will be + temporarily stored before upload. +- `batch_size` _int, optional_ - Number of text entries to process in each batch. + Defaults to 1000. + + +**Returns**: + + Tuple[List[File], int, int]: A tuple containing: + - List[File]: List of File objects pointing to uploaded index files in S3 + - int: Index of the data column in the index CSV files + - int: Total number of text entries processed + + +**Raises**: + +- `Exception` - If: + - Input CSV files are not found + - Required columns are missing in input files + - Text processing fails (e.g., file size limit exceeded) + diff --git a/docs/api-reference/python/aixplain/v1/processes/init.md b/docs/api-reference/python/aixplain/v1/processes/init.md new file mode 100644 index 000000000..2bb516032 --- /dev/null +++ b/docs/api-reference/python/aixplain/v1/processes/init.md @@ -0,0 +1,6 @@ +--- +draft: true +sidebar_label: processes +title: aixplain.v1.processes +--- + diff --git a/docs/api-reference/python/aixplain/v2/agent.md b/docs/api-reference/python/aixplain/v2/agent.md index ccbf7ba7d..1bde0732c 100644 --- a/docs/api-reference/python/aixplain/v2/agent.md +++ b/docs/api-reference/python/aixplain/v2/agent.md @@ -291,18 +291,11 @@ Run the agent with optional progress display. - `progress_verbosity` - Detail level 1-3 (default: 1) - `progress_truncate` - Truncate long text (default: True) - `**kwargs` - Additional run parameters -- `*args` - Positional arguments (first arg is treated as query) -- `query` - The query to run -- `progress_format` - Display format - "status" or "logs". If None (default), - progress tracking is disabled. -- `progress_verbosity` - Detail level 1-3 (default: 1) -- `progress_truncate` - Truncate long text (default: True) -- `**kwargs` - Additional run parameters **Returns**: -- `query`2 - The result of the agent execution +- `AgentRunResult` - The result of the agent execution #### run\_async @@ -310,7 +303,7 @@ Run the agent with optional progress display. def run_async(*args: Any, **kwargs: Unpack[AgentRunParams]) -> AgentRunResult ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L472) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L468) Run the agent asynchronously. @@ -331,7 +324,7 @@ Run the agent asynchronously. def save(*args: Any, **kwargs: Any) -> "Agent" ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L520) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L519) Save the agent with dependency management. @@ -361,7 +354,7 @@ child components before the agent itself is saved. def before_save(*args: Any, **kwargs: Any) -> Optional[dict] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L636) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L635) Callback to be called before the resource is saved. @@ -374,7 +367,7 @@ def after_clone(result: Union["Agent", Exception], **kwargs: Any) -> Optional["Agent"] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L651) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L650) Callback called after the agent is cloned. @@ -389,7 +382,7 @@ def search(cls: type["Agent"], **kwargs: Unpack[BaseSearchParams]) -> "Page[Agent]" ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L661) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L660) Search agents with optional query and filtering. @@ -409,7 +402,7 @@ Search agents with optional query and filtering. def build_save_payload(**kwargs: Any) -> dict ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L681) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L680) Build the payload for the save action. @@ -419,7 +412,7 @@ Build the payload for the save action. def build_run_payload(**kwargs: Unpack[AgentRunParams]) -> dict ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L778) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L777) Build the payload for the run action. @@ -430,18 +423,18 @@ def generate_session_id( history: Optional[List[ConversationMessage]] = None) -> str ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L851) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L850) Generate a unique session ID for agent conversations. -This method creates a unique session identifier based on the agent ID and current timestamp. -If conversation history is provided, it attempts to initialize the session on the server -to enable context-aware conversations. +Creates a unique session identifier based on the agent ID and current timestamp. +If conversation history is provided, it attempts to initialize the session on the +server to enable context-aware conversations. **Arguments**: -- `history` _Optional[List[Dict]], optional_ - Previous conversation history. - Each dict should contain 'role' (either 'user' or 'assistant') and 'content' keys. +- `history` - Previous conversation history. Each message should contain + 'role' (either 'user' or 'assistant') and 'content' keys. Defaults to None. diff --git a/docs/api-reference/python/aixplain/v2/api_key.md b/docs/api-reference/python/aixplain/v2/api_key.md new file mode 100644 index 000000000..51cff6c1b --- /dev/null +++ b/docs/api-reference/python/aixplain/v2/api_key.md @@ -0,0 +1,341 @@ +--- +sidebar_label: api_key +title: aixplain.v2.api_key +--- + +API Key management module for aiXplain v2 API. + +This module provides classes for managing API keys and their rate limits +using the V2 SDK foundation with proper mixin usage. + +### TokenType Objects + +```python +class TokenType(Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L47) + +Token type for rate limiting. + +### APIKeyLimits Objects + +```python +@dataclass_json + +@dataclass +class APIKeyLimits() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L57) + +Rate limits configuration for an API key. + +**Arguments**: + +- `token_per_minute` - Maximum tokens per minute (maps to API ``tpm``). +- `token_per_day` - Maximum tokens per day (maps to API ``tpd``). +- `request_per_minute` - Maximum requests per minute (maps to API ``rpm``). +- `request_per_day` - Maximum requests per day (maps to API ``rpd``). +- ``2 - The model to rate-limit. Accepts a model path string, a model + ID, or a :class:``3 object (maps to API ``assetId``). +- ``6 - Which tokens to count (input, output, or total). + +#### \_\_post\_init\_\_ + +```python +def __post_init__() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L84) + +Handle string token_type conversion and model object resolution. + +#### validate + +```python +def validate() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L91) + +Validate rate limit values are non-negative. + +### APIKeyUsageLimit Objects + +```python +@dataclass_json + +@dataclass +class APIKeyUsageLimit() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L127) + +Usage statistics for an API key. + +All fields are Optional since the API may return null values. + +### APIKeySearchParams Objects + +```python +class APIKeySearchParams(BaseSearchParams) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L154) + +Search parameters for API keys (not used - endpoint returns all keys). + +### APIKeyGetParams Objects + +```python +class APIKeyGetParams(BaseGetParams) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L160) + +Get parameters for API keys. + +### APIKeyDeleteParams Objects + +```python +class APIKeyDeleteParams(BaseDeleteParams) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L166) + +Delete parameters for API keys. + +### APIKey Objects + +```python +@dataclass_json + +@dataclass(repr=False) +class APIKey(BaseResource, SearchResourceMixin[APIKeySearchParams, "APIKey"], + GetResourceMixin[APIKeyGetParams, "APIKey"], + DeleteResourceMixin[APIKeyDeleteParams, DeleteResult]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L174) + +An API key for accessing aiXplain services. + +Inherits from V2 foundation: +- BaseResource: provides save() with _create/_update, clone(), _action() +- SearchResourceMixin: provides search() for listing with pagination +- GetResourceMixin: provides get() class method +- DeleteResourceMixin: provides delete() instance method + +Configuration for non-paginated list endpoint: +- PAGINATE_PATH = "": Direct GET to RESOURCE_PATH (no /paginate suffix) +- PAGINATE_METHOD = "get": Use GET instead of POST +- Override _populate_filters: Return empty dict (no pagination params) +- Override _build_page: Fix page_total for non-paginated response + +#### PAGINATE\_PATH + +No /paginate suffix - direct GET to RESOURCE_PATH + +#### PAGINATE\_METHOD + +GET request instead of POST + +#### \_\_post\_init\_\_ + +```python +def __post_init__() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L218) + +Validate limits and restore cached model paths. + +#### \_\_repr\_\_ + +```python +def __repr__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L226) + +Return string representation. + +#### before\_save + +```python +def before_save(*args: Any, **kwargs: Any) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L234) + +Switch to update mode when a key with the same name already exists. + +#### build\_save\_payload + +```python +def build_save_payload(**kwargs: Any) -> Dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L246) + +Build the payload for save operations. + +Override because: +1. Nested limits need manual serialization to API format. +2. Default to_dict() excludes global_limits and asset_limits. +3. Model paths must be resolved to IDs before sending to the backend. + +#### list + +```python +@classmethod +def list(cls, **kwargs) -> List["APIKey"] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L327) + +List all API keys. + +Convenience wrapper around search() that returns the results list directly. + +#### get\_by\_access\_key + +```python +@classmethod +def get_by_access_key(cls, access_key: str, **kwargs) -> "APIKey" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L336) + +Find an API key by matching first/last 4 chars of access key. + +**Arguments**: + +- `access_key` - The full access key to match against (must be at least 8 chars) +- `**kwargs` - Additional arguments passed to list() + + +**Returns**: + + The matching APIKey instance + + +**Raises**: + +- `ValidationError` - If access_key is too short +- `ResourceError` - If no matching key is found + +#### get\_usage + +```python +def get_usage(model: Optional[Any] = None) -> List[APIKeyUsageLimit] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L364) + +Get usage statistics for this API key. + +**Arguments**: + +- `model` - Optional model to filter usage by (string path/ID or Model object) + + +**Returns**: + + List of usage limit objects + +#### get\_usage\_limits + +```python +@classmethod +def get_usage_limits(cls, + model: Optional[Any] = None, + **kwargs) -> List[APIKeyUsageLimit] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L385) + +Get usage limits for the current API key (the one used for authentication). + +**Arguments**: + +- `model` - Optional model to filter usage by (string path/ID or Model object) +- `**kwargs` - Additional arguments (unused, for API consistency) + + +**Returns**: + + List of usage limit objects + +#### set\_token\_per\_day + +```python +def set_token_per_day(value: int, model: Optional[Any] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L413) + +Set token per day limit. + +#### set\_token\_per\_minute + +```python +def set_token_per_minute(value: int, model: Optional[Any] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L417) + +Set token per minute limit. + +#### set\_request\_per\_day + +```python +def set_request_per_day(value: int, model: Optional[Any] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L421) + +Set request per day limit. + +#### set\_request\_per\_minute + +```python +def set_request_per_minute(value: int, model: Optional[Any] = None) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L425) + +Set request per minute limit. + +#### create + +```python +@classmethod +def create(cls, + name: str, + budget: float, + global_limits: Union[Dict, APIKeyLimits], + asset_limits: Optional[List[Union[Dict, APIKeyLimits]]] = None, + expires_at: Optional[Union[datetime, str]] = None, + **kwargs) -> "APIKey" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/api_key.py#L434) + +Create a new API key with specified limits and budget. + +**Arguments**: + +- `name` - Name for the API key +- `budget` - Budget limit +- `global_limits` - Global rate limits (dict or APIKeyLimits) +- `asset_limits` - Optional per-asset rate limits +- `expires_at` - Optional expiration datetime +- `**kwargs` - Additional arguments passed to save() + + +**Returns**: + + The created APIKey instance + diff --git a/docs/api-reference/python/aixplain/v2/client.md b/docs/api-reference/python/aixplain/v2/client.md index 103a5af64..ca5f97369 100644 --- a/docs/api-reference/python/aixplain/v2/client.md +++ b/docs/api-reference/python/aixplain/v2/client.md @@ -55,16 +55,16 @@ def __init__( [[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/client.py#L56) -Initializes AixplainClient with authentication and retry configuration. +Initialize AixplainClient with authentication and retry configuration. **Arguments**: - `base_url` _str_ - The base URL for the API. - `aixplain_api_key` _str, optional_ - The individual API key. - `team_api_key` _str, optional_ - The team API key. -- `retry_total` _int, optional_ - Total number of retries allowed. Defaults to None, uses DEFAULT_RETRY_TOTAL. -- `retry_backoff_factor` _float, optional_ - Backoff factor to apply between retry attempts. Defaults to None, uses DEFAULT_RETRY_BACKOFF_FACTOR. -- `retry_status_forcelist` _list, optional_ - List of HTTP status codes to force a retry on. Defaults to None, uses DEFAULT_RETRY_STATUS_FORCELIST. +- `retry_total` _int_ - Total number of retries allowed. Defaults to 5. +- `retry_backoff_factor` _float_ - Backoff factor between retry attempts. Defaults to 0.1. +- `retry_status_forcelist` _list_ - HTTP status codes that trigger a retry. Defaults to [500, 502, 503, 504]. #### request\_raw @@ -126,5 +126,54 @@ Sends an HTTP GET request. **Returns**: -- `requests.Response` - The response from the request +- `dict` - The JSON response from the request + +#### post + +```python +def post(path: str, **kwargs: Any) -> dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/client.py#L164) + +Sends an HTTP POST request. + +**Arguments**: + +- `path` _str_ - URL path +- `kwargs` _dict, optional_ - Additional keyword arguments for the request + + +**Returns**: + +- `dict` - The JSON response from the request + +#### request\_stream + +```python +def request_stream(method: str, path: str, **kwargs: Any) -> requests.Response +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/client.py#L176) + +Sends a streaming HTTP request. + +This method is similar to request_raw but enables streaming mode, +which is necessary for Server-Sent Events (SSE) responses. + +**Arguments**: + +- `method` _str_ - HTTP method (e.g. 'GET', 'POST') +- `path` _str_ - URL path or full URL +- `kwargs` _dict, optional_ - Additional keyword arguments for the request + + +**Returns**: + +- `requests.Response` - The streaming response (not consumed) + + +**Raises**: + +- `APIError` - If the request fails diff --git a/docs/api-reference/python/aixplain/v2/code_utils.md b/docs/api-reference/python/aixplain/v2/code_utils.md new file mode 100644 index 000000000..c6b0a51b1 --- /dev/null +++ b/docs/api-reference/python/aixplain/v2/code_utils.md @@ -0,0 +1,95 @@ +--- +sidebar_label: code_utils +title: aixplain.v2.code_utils +--- + +Code parsing utilities for v2 utility models. + +Adapted from aixplain.modules.model.utils to avoid v1 import chain +that triggers env var validation. + +### UtilityModelInput Objects + +```python +@dataclass +class UtilityModelInput() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/code_utils.py#L26) + +Input parameter for a utility model. + +**Attributes**: + +- `name` - The name of the input parameter. +- `description` - A description of what this input parameter represents. +- `type` - The data type of the input parameter. + +#### validate + +```python +def validate() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/code_utils.py#L39) + +Validate that the input type is one of TEXT, BOOLEAN, or NUMBER. + +#### to\_dict + +```python +def to_dict() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/code_utils.py#L44) + +Convert to dictionary representation. + +#### parse\_code + +```python +def parse_code( + code: Union[Text, Callable], + api_key: Optional[Text] = None, + backend_url: Optional[Text] = None) -> Tuple[Text, List, Text, Text] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/code_utils.py#L141) + +Parse and process code for utility model creation. + +**Arguments**: + +- `code` - The code to parse (callable, file path, URL, or raw code string). +- `api_key` - API key for authentication when uploading code. +- `backend_url` - Backend URL for file upload. + + +**Returns**: + + Tuple of (code_url, inputs, description, name). + +#### parse\_code\_decorated + +```python +def parse_code_decorated( + code: Union[Text, Callable], + api_key: Optional[Text] = None, + backend_url: Optional[Text] = None) -> Tuple[Text, List, Text, Text] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/code_utils.py#L207) + +Parse and process code that may be decorated with @utility_tool. + +**Arguments**: + +- `code` - The code to parse (decorated/non-decorated callable, file path, URL, or raw string). +- `api_key` - API key for authentication when uploading code. +- `backend_url` - Backend URL for file upload. + + +**Returns**: + + Tuple of (code_url, inputs, description, name). + diff --git a/docs/api-reference/python/aixplain/v2/core.md b/docs/api-reference/python/aixplain/v2/core.md index 31aa9f18e..c1a18ec89 100644 --- a/docs/api-reference/python/aixplain/v2/core.md +++ b/docs/api-reference/python/aixplain/v2/core.md @@ -11,7 +11,7 @@ Core module for aiXplain v2 API. class Aixplain() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/core.py#L28) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/core.py#L30) Main class for the Aixplain API. @@ -27,16 +27,16 @@ def __init__(api_key: Optional[str] = None, model_url: Optional[str] = None) -> None ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/core.py#L71) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/core.py#L74) Initialize the Aixplain class. **Arguments**: -- `api_key` - str: The API key for the Aixplain API. -- `backend_url` - str: The URL for the backend. -- `pipeline_url` - str: The URL for the pipeline. -- `model_url` - str: The URL for the model. +- `api_key` _str, optional_ - The API key. Falls back to TEAM_API_KEY env var. +- `backend_url` _str, optional_ - The backend URL. Falls back to BACKEND_URL env var. +- `pipeline_url` _str, optional_ - The pipeline execution URL. Falls back to PIPELINES_RUN_URL env var. +- `model_url` _str, optional_ - The model execution URL. Falls back to MODELS_RUN_URL env var. #### init\_client @@ -44,7 +44,7 @@ Initialize the Aixplain class. def init_client() -> None ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/core.py#L99) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/core.py#L102) Initialize the client. @@ -54,7 +54,7 @@ Initialize the client. def init_resources() -> None ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/core.py#L106) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/core.py#L109) Initialize the resources. diff --git a/docs/api-reference/python/aixplain/v2/enums.md b/docs/api-reference/python/aixplain/v2/enums.md index 4ecf96ab3..99f0de814 100644 --- a/docs/api-reference/python/aixplain/v2/enums.md +++ b/docs/api-reference/python/aixplain/v2/enums.md @@ -191,13 +191,47 @@ class CodeInterpreterModel(str, Enum) Code interpreter models. +### DataType Objects + +```python +class DataType(str, Enum) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/enums.py#L202) + +Enumeration of supported data types in the aiXplain system. + +**Attributes**: + +- `AUDIO` - Audio data type. +- `FLOAT` - Floating-point number data type. +- `IMAGE` - Image data type. +- `INTEGER` - Integer number data type. +- `LABEL` - Label/category data type. +- `TENSOR` - Tensor/multi-dimensional array data type. +- `TEXT` - Text data type. +- `VIDEO` - Video data type. +- `EMBEDDING` - Vector embedding data type. +- `NUMBER` - Generic number data type. +- `FLOAT`0 - Boolean data type. + +#### \_\_str\_\_ + +```python +def __str__() -> str +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/enums.py#L231) + +Return the string representation of the data type. + ### SplittingOptions Objects ```python class SplittingOptions(str, Enum) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/enums.py#L202) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/enums.py#L236) Enumeration of possible splitting options for text chunking. diff --git a/docs/api-reference/python/aixplain/v2/exceptions.md b/docs/api-reference/python/aixplain/v2/exceptions.md index 370d33585..260134900 100644 --- a/docs/api-reference/python/aixplain/v2/exceptions.md +++ b/docs/api-reference/python/aixplain/v2/exceptions.md @@ -110,7 +110,7 @@ Raised when file upload operations fail. def create_operation_failed_error(response: Dict[str, Any]) -> APIError ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/exceptions.py#L83) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/exceptions.py#L101) Create an operation failed error from API response. diff --git a/docs/api-reference/python/aixplain/v2/integration.md b/docs/api-reference/python/aixplain/v2/integration.md index fb8c8c58d..461529d65 100644 --- a/docs/api-reference/python/aixplain/v2/integration.md +++ b/docs/api-reference/python/aixplain/v2/integration.md @@ -11,7 +11,7 @@ Integration module for managing external service integrations. class ActionInputsProxy() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L16) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L17) Proxy object that provides both dict-like and dot notation access to action input parameters. @@ -24,7 +24,7 @@ when needed, allowing for runtime discovery and validation of action inputs. def __init__(container, action_name: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L23) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L24) Initialize ActionInputsProxy with container and action name. @@ -34,7 +34,7 @@ Initialize ActionInputsProxy with container and action name. def __getitem__(key: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L92) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L93) Get input value by key. @@ -44,7 +44,7 @@ Get input value by key. def __setitem__(key: str, value) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L96) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L97) Set input value by key. @@ -54,7 +54,7 @@ Set input value by key. def __contains__(key: str) -> bool ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L100) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L101) Check if input parameter exists. @@ -64,7 +64,7 @@ Check if input parameter exists. def __len__() -> int ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L108) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L109) Return the number of input parameters. @@ -74,7 +74,7 @@ Return the number of input parameters. def __iter__() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L113) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L114) Iterate over input parameter keys. @@ -84,7 +84,7 @@ Iterate over input parameter keys. def __getattr__(name: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L119) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L120) Get input value by attribute name. @@ -94,7 +94,7 @@ Get input value by attribute name. def __setattr__(name: str, value) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L126) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L127) Set input value by attribute name. @@ -104,7 +104,7 @@ Set input value by attribute name. def get(key: str, default=None) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L137) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L138) Get input value with optional default. @@ -114,7 +114,7 @@ Get input value with optional default. def update(**kwargs) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L144) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L145) Update multiple inputs at once. @@ -124,7 +124,7 @@ Update multiple inputs at once. def keys() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L149) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L150) Get input parameter codes. @@ -134,7 +134,7 @@ Get input parameter codes. def values() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L154) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L155) Get input parameter values. @@ -144,7 +144,7 @@ Get input parameter values. def items() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L159) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L160) Get input parameter code-value pairs. @@ -154,7 +154,7 @@ Get input parameter code-value pairs. def reset_input(input_code: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L168) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L169) Reset an input parameter to its backend default value. @@ -164,7 +164,7 @@ Reset an input parameter to its backend default value. def reset_all_inputs() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L174) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L175) Reset all input parameters to their backend default values. @@ -174,7 +174,7 @@ Reset all input parameters to their backend default values. def __repr__() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L179) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L180) Return string representation of the proxy. @@ -187,7 +187,7 @@ Return string representation of the proxy. class Input() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L187) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L188) Input parameter for an action. @@ -200,7 +200,7 @@ Input parameter for an action. class Action() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L205) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L206) Container for tool action information and inputs. @@ -210,7 +210,7 @@ Container for tool action information and inputs. def __repr__() -> str ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L223) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L224) Return a string representation showing name and input parameters. @@ -220,7 +220,7 @@ Return a string representation showing name and input parameters. def get_inputs_proxy(container) -> ActionInputsProxy ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L239) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L240) Get an ActionInputsProxy for this action from a container. @@ -242,7 +242,7 @@ Get an ActionInputsProxy for this action from a container. class ToolId() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L253) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L254) Result for tool operations. @@ -255,7 +255,7 @@ Result for tool operations. class IntegrationResult(Result) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L261) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L263) Result for connection operations. @@ -267,7 +267,7 @@ The backend returns the connection ID in data.id. class IntegrationSearchParams(BaseSearchParams) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L270) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L272) Parameters for listing integrations. @@ -277,7 +277,7 @@ Parameters for listing integrations. class ActionMixin() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L276) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L278) Mixin class providing action-related functionality for integrations and tools. @@ -287,7 +287,7 @@ Mixin class providing action-related functionality for integrations and tools. def list_actions() -> List[Action] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L282) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L284) List available actions for the integration. @@ -297,7 +297,7 @@ List available actions for the integration. def list_inputs(*actions: str) -> List[Action] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L309) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L311) List available inputs for the integration. @@ -308,7 +308,7 @@ List available inputs for the integration. def actions() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L334) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L336) Get a proxy object that provides access to actions with their inputs. @@ -324,7 +324,7 @@ This enables the syntax: mytool.actions['ACTION_NAME'].channel = ' def set_inputs(inputs_dict: Dict[str, Dict[str, Any]]) -> None ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L344) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L346) Set multiple action inputs in bulk using a dictionary tree structure. @@ -378,7 +378,7 @@ Action names are automatically converted to lowercase for consistent lookup. class ActionsProxy() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L410) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L412) Proxy object that provides access to actions with their inputs. @@ -390,7 +390,7 @@ This enables the syntax: mytool.actions['ACTION_NAME'].channel = ' def __init__(container) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L416) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L418) Initialize ActionsProxy with container resource. @@ -400,7 +400,7 @@ Initialize ActionsProxy with container resource. def __getitem__(action_name: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L444) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L446) Get an action with its inputs proxy. @@ -412,7 +412,7 @@ Converts action name to lowercase for consistent lookup. def __getattr__(attr_name: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L464) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L466) Get an action with its inputs proxy using attribute notation. @@ -424,7 +424,7 @@ Converts attribute name to lowercase for consistent lookup. def __contains__(action_name: str) -> bool ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L478) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L480) Check if an action exists. @@ -434,7 +434,7 @@ Check if an action exists. def get_available_actions() -> List[str] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L487) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L489) Get a list of available action names. @@ -444,7 +444,7 @@ Get a list of available action names. def refresh_cache() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L492) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L494) Clear the actions cache to force re-fetching. @@ -454,7 +454,7 @@ Clear the actions cache to force re-fetching. class Integration(Model, ActionMixin) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L498) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L500) Resource for integrations. @@ -467,7 +467,7 @@ All connection logic is centralized here. def run(**kwargs: Any) -> IntegrationResult ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L524) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L526) Run the integration with validation. @@ -477,17 +477,25 @@ Run the integration with validation. def connect(**kwargs: Any) -> "Tool" ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L528) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L530) Connect the integration. +For OAuth-based integrations, the backend may return a redirect URL +that the user must visit to complete authentication before using the tool. + +**Returns**: + +- `Tool` - The created tool. If OAuth authentication is required, + ``tool.redirect_url`` will contain the URL the user must visit. + #### handle\_run\_response ```python def handle_run_response(response: dict, **kwargs: Any) -> IntegrationResult ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L534) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/integration.py#L549) Handle the response from the integration. diff --git a/docs/api-reference/python/aixplain/v2/model.md b/docs/api-reference/python/aixplain/v2/model.md index 4b44896d4..e51f8c4f6 100644 --- a/docs/api-reference/python/aixplain/v2/model.md +++ b/docs/api-reference/python/aixplain/v2/model.md @@ -14,7 +14,7 @@ Model resource for v2 API. class Message() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L27) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L35) Message structure from the API response. @@ -27,7 +27,7 @@ Message structure from the API response. class Detail() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L38) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L47) Detail structure from the API response. @@ -40,7 +40,7 @@ Detail structure from the API response. class Usage() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L49) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L58) Usage structure from the API response. @@ -53,17 +53,147 @@ Usage structure from the API response. class ModelResult(Result) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L59) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L68) Result for model runs with specific fields from the backend response. +### StreamChunk Objects + +```python +@dataclass +class StreamChunk() +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L78) + +A chunk of streamed response data. + +**Attributes**: + +- `status` - The current status of the streaming operation (IN_PROGRESS or SUCCESS) +- `data` - The content/token of this chunk +- `tool_calls` - Tool call deltas when stream uses OpenAI-style chunk format +- `usage` - Usage payload when provided in a stream chunk +- `finish_reason` - Completion reason for the current choice, when provided + +#### \_\_post\_init\_\_ + +```python +def __post_init__() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L95) + +Ensure data remains a text chunk. + +### ModelResponseStreamer Objects + +```python +class ModelResponseStreamer(Iterator[StreamChunk]) +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L101) + +A streamer for model responses that yields chunks as they arrive. + +This class provides an iterator interface for streaming model responses. +It handles the conversion of Server-Sent Events (SSE) into StreamChunk objects +and manages the response status. + +The streamer can be used directly in a for loop or as a context manager +for proper resource cleanup. + +**Example**: + + >>> model = aix.Model.get("6895d6d1d50c89537c1cf237") # GPT-5 Mini + >>> for chunk in model.run(text="Explain LLMs", stream=True): + ... print(chunk.data, end="", flush=True) + + >>> # With context manager for proper cleanup + >>> with model.run_stream(text="Hello") as stream: + ... for chunk in stream: + ... print(chunk.data, end="", flush=True) + +#### \_\_init\_\_ + +```python +def __init__(response: "requests.Response") +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L122) + +Initialize a new ModelResponseStreamer instance. + +**Arguments**: + +- `response` - A requests.Response object with streaming enabled + +#### \_\_iter\_\_ + +```python +def __iter__() -> Iterator[StreamChunk] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L134) + +Return the iterator for the ModelResponseStreamer. + +#### \_\_next\_\_ + +```python +def __next__() -> StreamChunk +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L138) + +Return the next chunk of the response. + +**Returns**: + +- `StreamChunk` - A StreamChunk object containing the next chunk of the response. + + +**Raises**: + +- `StopIteration` - When the stream is complete + +#### close + +```python +def close() -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L253) + +Close the underlying response connection. + +#### \_\_enter\_\_ + +```python +def __enter__() -> "ModelResponseStreamer" +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L258) + +Context manager entry. + +#### \_\_exit\_\_ + +```python +def __exit__(exc_type, exc_val, exc_tb) -> None +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L262) + +Context manager exit - ensures response is closed. + ### InputsProxy Objects ```python class InputsProxy() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L68) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L267) Proxy object that provides both dict-like and dot notation access to model parameters. @@ -73,7 +203,7 @@ Proxy object that provides both dict-like and dot notation access to model param def __init__(model) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L71) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L270) Initialize InputsProxy with a model instance. @@ -83,7 +213,7 @@ Initialize InputsProxy with a model instance. def __getitem__(key: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L98) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L297) Dict-like access: inputs['temperature']. @@ -93,7 +223,7 @@ Dict-like access: inputs['temperature']. def __setitem__(key: str, value) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L104) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L303) Dict-like assignment: inputs['temperature'] = 0.7. @@ -103,7 +233,7 @@ Dict-like assignment: inputs['temperature'] = 0.7. def __getattr__(name: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L121) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L320) Dot notation access: inputs.temperature. @@ -113,7 +243,7 @@ Dot notation access: inputs.temperature. def __setattr__(name: str, value) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L127) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L326) Dot notation assignment: inputs.temperature = 0.7. @@ -123,7 +253,7 @@ Dot notation assignment: inputs.temperature = 0.7. def __contains__(key: str) -> bool ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L146) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L345) Check if parameter exists: 'temperature' in inputs. @@ -133,7 +263,7 @@ Check if parameter exists: 'temperature' in inputs. def __len__() -> int ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L150) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L349) Number of parameters. @@ -143,7 +273,7 @@ Number of parameters. def __iter__() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L154) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L353) Iterate over parameter names. @@ -153,7 +283,7 @@ Iterate over parameter names. def keys() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L158) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L357) Get parameter names. @@ -163,7 +293,7 @@ Get parameter names. def values() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L162) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L361) Get parameter values. @@ -173,7 +303,7 @@ Get parameter values. def items() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L166) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L365) Get parameter name-value pairs. @@ -183,7 +313,7 @@ Get parameter name-value pairs. def get(key: str, default=None) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L170) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L369) Get parameter value with default. @@ -193,7 +323,7 @@ Get parameter value with default. def update(**kwargs) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L176) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L375) Update multiple parameters at once. @@ -203,7 +333,7 @@ Update multiple parameters at once. def clear() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L184) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L383) Reset all parameters to backend defaults. @@ -213,7 +343,7 @@ Reset all parameters to backend defaults. def copy() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L189) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L388) Get a copy of current parameter values. @@ -223,7 +353,7 @@ Get a copy of current parameter values. def has_parameter(param_name: str) -> bool ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L193) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L392) Check if a parameter exists. @@ -233,7 +363,7 @@ Check if a parameter exists. def get_parameter_names() -> list ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L197) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L396) Get a list of all available parameter names. @@ -243,7 +373,7 @@ Get a list of all available parameter names. def get_required_parameters() -> list ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L201) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L400) Get a list of required parameter names. @@ -253,7 +383,7 @@ Get a list of required parameter names. def get_parameter_info(param_name: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L205) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L404) Get information about a specific parameter. @@ -263,7 +393,7 @@ Get information about a specific parameter. def get_all_parameters() -> dict ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L211) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L410) Get all current parameter values. @@ -273,7 +403,7 @@ Get all current parameter values. def reset_parameter(param_name: str) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L215) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L414) Reset a parameter to its backend default value. @@ -283,7 +413,7 @@ Reset a parameter to its backend default value. def reset_all_parameters() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L226) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L425) Reset all parameters to their backend default values. @@ -293,7 +423,7 @@ Reset all parameters to their backend default values. def __repr__() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L271) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L470) Return string representation of InputsProxy. @@ -303,7 +433,7 @@ Return string representation of InputsProxy. def find_supplier_by_id(supplier_id: Union[str, int]) -> Optional[Supplier] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L277) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L476) Find supplier enum by ID. @@ -313,7 +443,7 @@ Find supplier enum by ID. def find_function_by_id(function_id: str) -> Optional[Function] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L286) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L485) Find function enum by ID. @@ -326,7 +456,7 @@ Find function enum by ID. class Attribute() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L296) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L495) Common attribute structure from the API response. @@ -339,7 +469,7 @@ Common attribute structure from the API response. class Parameter() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L306) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L505) Common parameter structure from the API response. @@ -352,7 +482,7 @@ Common parameter structure from the API response. class Version() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L322) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L521) Version structure from the API response. @@ -365,7 +495,7 @@ Version structure from the API response. class Pricing() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L331) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L530) Pricing structure from the API response. @@ -378,7 +508,7 @@ Pricing structure from the API response. class VendorInfo() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L341) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L540) Supplier information structure from the API response. @@ -388,7 +518,7 @@ Supplier information structure from the API response. class ModelSearchParams(BaseSearchParams) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L349) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L548) Search parameters for model queries. @@ -414,12 +544,14 @@ Filter by path prefix (e.g., "openai/gpt-4") class ModelRunParams(BaseRunParams) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L365) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L564) Parameters for running models. -This class is intentionally empty to allow dynamic validation -based on each model's specific parameters from the backend. +**Attributes**: + +- `stream` - If True, returns a ModelResponseStreamer for streaming responses. + The model must support streaming (check supports_streaming attribute). ### Model Objects @@ -432,7 +564,7 @@ class Model(BaseResource, SearchResourceMixin[ModelSearchParams, "Model"], RunnableResourceMixin[ModelRunParams, ModelResult], ToolableMixin) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L377) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L577) Resource for models. @@ -442,17 +574,69 @@ Resource for models. def __post_init__() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L425) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L629) Initialize dynamic attributes based on backend parameters. +#### supports\_tool\_calling + +```python +@property +def supports_tool_calling() -> Optional[bool] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L672) + +Return whether this LLM supports tool calling, inferred from backend params. + +#### supports\_structured\_output + +```python +@property +def supports_structured_output() -> Optional[bool] +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L687) + +Return whether this LLM supports structured output, inferred from backend params. + +#### is\_sync\_only + +```python +@property +def is_sync_only() -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L702) + +Check if the model only supports synchronous execution. + +**Returns**: + +- `bool` - True if the model only supports synchronous execution + +#### is\_async\_capable + +```python +@property +def is_async_capable() -> bool +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L713) + +Check if the model supports asynchronous execution. + +**Returns**: + +- `bool` - True if the model supports asynchronous execution + #### \_\_setattr\_\_ ```python def __setattr__(name: str, value) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L430) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L723) Handle bulk assignment to inputs. @@ -462,7 +646,7 @@ Handle bulk assignment to inputs. def build_run_url(**kwargs: Unpack[ModelRunParams]) -> str ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L439) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L732) Build the URL for running the model. @@ -472,7 +656,7 @@ Build the URL for running the model. def mark_as_deleted() -> None ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L444) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L737) Mark the model as deleted by setting status to DELETED and calling parent method. @@ -484,7 +668,7 @@ def get(cls: type["Model"], id: str, **kwargs: Unpack[BaseGetParams]) -> "Model" ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L452) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L745) Get a model by ID. @@ -497,7 +681,7 @@ def search(cls: type["Model"], **kwargs: Unpack[ModelSearchParams]) -> Page["Model"] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L461) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L754) Search with optional query and filtering. @@ -517,17 +701,82 @@ Search with optional query and filtering. def run(**kwargs: Unpack[ModelRunParams]) -> ModelResult ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L482) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L775) Run the model with dynamic parameter validation and default handling. +This method routes the execution based on the model's connection type: +- Sync models: Uses V2 endpoint directly (returns result immediately) +- Async models: Uses V2 endpoint and polls until completion + +#### run\_async + +```python +def run_async(**kwargs: Unpack[ModelRunParams]) -> ModelResult +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L816) + +Run the model asynchronously. + +This method routes the execution based on the model's connection type: +- Sync models: Falls back to V1 endpoint (V2 doesn't support async for sync models) +- Async models: Uses V2 endpoint directly (returns polling URL) + +**Returns**: + +- `ModelResult` - Result with polling URL for async models, + or immediate result via V1 for sync-only models + +#### run\_stream + +```python +def run_stream(**kwargs: Unpack[ModelRunParams]) -> ModelResponseStreamer +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L912) + +Run the model with streaming response. + +This method executes the model and returns a streamer that yields response +chunks as they are generated. This is useful for real-time output display +or processing large responses incrementally. + +**Arguments**: + +- `**kwargs` - Model-specific parameters (same as run() without stream parameter) + + +**Returns**: + +- `ModelResponseStreamer` - A streamer that yields StreamChunk objects. Can be + iterated directly or used as a context manager. + + +**Raises**: + +- `ValidationError` - If the model explicitly does not support streaming + (supports_streaming is False) + + +**Example**: + + >>> model = aix.Model.get("6895d6d1d50c89537c1cf237") # GPT-5 Mini + >>> with model.run_stream(text="Explain quantum computing") as stream: + ... for chunk in stream: + ... print(chunk.data, end="", flush=True) + + >>> # Or without context manager + >>> for chunk in model.run_stream(text="Hello"): + ... print(chunk.data, end="", flush=True) + #### as\_tool ```python def as_tool() -> ToolDict ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L568) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L1044) Serialize this model as a tool for agent creation. @@ -560,7 +809,7 @@ expects for model tools. def get_parameters() -> List[dict] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L626) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/model.py#L1102) Get current parameter values for this model. diff --git a/docs/api-reference/python/aixplain/v2/resource.md b/docs/api-reference/python/aixplain/v2/resource.md index f3db4083f..ac0415010 100644 --- a/docs/api-reference/python/aixplain/v2/resource.md +++ b/docs/api-reference/python/aixplain/v2/resource.md @@ -150,10 +150,12 @@ Base class for all resources. **Attributes**: -- `context` - Aixplain: The Aixplain instance (hidden from serialization). -- `RESOURCE_PATH` - str: The resource path. -- `id` - str: The resource ID. -- `name` - str: The resource name. +- `context` - The Aixplain client instance (hidden from serialization). +- `RESOURCE_PATH` - The API resource path. +- `id` - The resource ID. +- `name` - The resource name. +- `description` - The resource description. +- `path` - Full path identifier (e.g., "openai/whisper-large/groq"). #### path @@ -166,7 +168,7 @@ Full path e.g. "openai/whisper-large/groq" def is_modified() -> bool ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L260) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L262) Check if the resource has been modified since last save. @@ -181,7 +183,7 @@ Check if the resource has been modified since last save. def is_deleted() -> bool ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L269) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L271) Check if the resource has been deleted. @@ -195,7 +197,7 @@ Check if the resource has been deleted. def before_save(*args: Any, **kwargs: Any) -> Optional[dict] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L285) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L287) Optional callback called before the resource is saved. @@ -220,7 +222,7 @@ def after_save(result: Union[dict, Exception], *args: Any, **kwargs: Any) -> Optional[dict] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L301) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L303) Optional callback called after the resource is saved. @@ -246,7 +248,7 @@ Override this method to add custom logic after saving. def build_save_payload(**kwargs: Any) -> dict ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L319) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L321) Build the payload for the save action. @@ -257,7 +259,7 @@ Build the payload for the save action. def save(*args: Any, **kwargs: Any) -> "BaseResource" ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L346) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L348) Save the resource with attribute shortcuts. @@ -291,7 +293,7 @@ This generic implementation provides consistent save behavior across all resourc def clone(**kwargs: Any) -> "BaseResource" ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L387) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L389) Clone the resource and return a copy with id=None. @@ -318,7 +320,7 @@ This generic implementation provides consistent clone behavior across all resour def __repr__() -> str ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L451) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L453) Return a string representation using path > id priority. @@ -328,7 +330,7 @@ Return a string representation using path > id priority. def __str__() -> str ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L458) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L460) Return string representation of the resource. @@ -339,7 +341,7 @@ Return string representation of the resource. def encoded_id() -> str ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L463) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L465) Get the URL-encoded version of the resource ID. @@ -353,7 +355,7 @@ Get the URL-encoded version of the resource ID. class BaseParams(TypedDict) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L474) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L476) Base class for parameters that include API key and resource path. @@ -368,7 +370,7 @@ Base class for parameters that include API key and resource path. class BaseSearchParams(BaseParams) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L486) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L488) Base class for all search parameters. @@ -392,14 +394,13 @@ Base class for all search parameters. class BaseGetParams(BaseParams) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L513) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L515) Base class for all get parameters. **Attributes**: -- `id` - str: The resource ID. -- `host` - str: The host URL for the request (optional). +- `host` - The host URL for the request (optional). ### BaseDeleteParams Objects @@ -407,27 +408,24 @@ Base class for all get parameters. class BaseDeleteParams(BaseParams) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L524) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L525) Base class for all delete parameters. -**Attributes**: - -- `id` - str: The resource ID. - ### BaseRunParams Objects ```python class BaseRunParams(BaseParams) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L534) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L531) Base class for all run parameters. **Attributes**: -- `text` - str: The text to run. +- `timeout` - Maximum time in seconds to wait for completion. +- `wait_time` - Initial interval in seconds between poll attempts. ### BaseResult Objects @@ -438,7 +436,7 @@ Base class for all run parameters. class BaseResult() ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L547) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L545) Abstract base class for running results. @@ -455,7 +453,7 @@ fields and handling their specific data structures. class Result(BaseResult) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L562) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L560) Default implementation of running results with common fields. @@ -465,7 +463,7 @@ Default implementation of running results with common fields. def __getattr__(name: str) -> Any ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L574) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L572) Allow access to any field from the raw response data. @@ -475,7 +473,7 @@ Allow access to any field from the raw response data. def __repr__() -> str ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L580) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L578) Return a formatted string representation with truncated data. @@ -488,7 +486,7 @@ Return a formatted string representation with truncated data. class DeleteResult(Result) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L642) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L640) Result for delete operations. @@ -498,14 +496,16 @@ Result for delete operations. class Page(Generic[ResourceT]) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L658) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L656) -Page of resources. +A paginated page of resources. **Attributes**: -- `items` - List[ResourceT]: The list of resources. -- `total` - int: The total number of resources. +- `results` - The list of resources in this page. +- `page_number` - Current page number (0-indexed). +- `page_total` - Total number of pages. +- `total` - Total number of resources across all pages. #### \_\_init\_\_ @@ -852,7 +852,7 @@ in the 'data' field. def before_run(*args: Any, **kwargs: Unpack[RunParamsT]) -> Optional[ResultT] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1141) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1142) Optional callback called before the resource is run. @@ -877,7 +877,7 @@ def after_run(result: Union[ResultT, Exception], *args: Any, **kwargs: Unpack[RunParamsT]) -> Optional[ResultT] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1157) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1158) Optional callback called after the resource is run. @@ -903,7 +903,7 @@ Override this method to add custom logic after running. def run(*args: Any, **kwargs: Unpack[RunParamsT]) -> ResultT ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1180) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1181) Run the resource synchronously with automatic polling. @@ -929,7 +929,7 @@ Run the resource synchronously with automatic polling. def run_async(**kwargs: Unpack[RunParamsT]) -> ResultT ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1210) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1211) Run the resource asynchronously. @@ -948,14 +948,13 @@ Run the resource asynchronously. def poll(poll_url: str) -> ResultT ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1238) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1239) Poll for the result of an asynchronous operation. **Arguments**: - `poll_url` - URL to poll for results -- `name` - Name/ID of the process **Returns**: @@ -994,16 +993,20 @@ def sync_poll(poll_url: str, **kwargs: Unpack[RunParamsT]) -> ResultT [[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/resource.py#L1307) -Keeps polling until an asynchronous operation is complete. +Keep polling until an asynchronous operation is complete. **Arguments**: - `poll_url` - URL to poll for results -- `name` - Name/ID of the process -- `**kwargs` - Run parameters including timeout, wait_time, and show_progress +- `**kwargs` - Run parameters including timeout and wait_time **Returns**: Response instance from the configured RESPONSE_CLASS + + +**Raises**: + +- `TimeoutError` - If the operation exceeds the timeout duration diff --git a/docs/api-reference/python/aixplain/v2/tool.md b/docs/api-reference/python/aixplain/v2/tool.md index 02f1e5be8..2579ad7d3 100644 --- a/docs/api-reference/python/aixplain/v2/tool.md +++ b/docs/api-reference/python/aixplain/v2/tool.md @@ -46,7 +46,7 @@ Script integration def __post_init__() -> None ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L49) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L50) Initialize tool after dataclass creation. @@ -59,7 +59,7 @@ Validates integration type if provided. def list_actions() -> List[Action] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L112) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L107) List available actions for the tool. @@ -76,7 +76,7 @@ Overrides parent method to add fallback to base integration. def list_inputs(*actions: str) -> List["Action"] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L133) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L126) List available inputs for specified actions. @@ -98,17 +98,20 @@ Overrides parent method to add fallback to base integration. def validate_allowed_actions() -> None ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L219) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L211) Validate that all allowed actions are available for this tool. Checks that: -- Integration is available +- Integration is available (attempts lazy resolution) - All actions in allowed_actions list exist in the integration +Skips validation gracefully when integration cannot be resolved +(e.g. tools fetched via search/get without integration data). + **Raises**: -- `AssertionError` - If validation fails. +- `AssertionError` - If integration is available but actions don't match. #### get\_parameters @@ -116,7 +119,7 @@ Checks that: def get_parameters() -> List[dict] ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L242) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L238) Get parameters for the tool in the format expected by agent saving. @@ -124,13 +127,33 @@ This method includes both static backend values and dynamically set values from the ActionInputsProxy instances, ensuring agents get the current configured action inputs. +#### as\_tool + +```python +def as_tool() -> dict +``` + +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L300) + +Serialize this tool for agent creation. + +This method extends the base Model.as_tool() to include tool-specific +fields like actions, which tells the backend which actions +the agent is permitted to use. + +**Returns**: + +- `dict` - A dictionary representing this tool with: + - All fields from Model.as_tool() + - actions: Explicit list of actions (filtered to allowed only) + #### run ```python def run(*args: Any, **kwargs: Unpack[ModelRunParams]) -> ToolResult ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L366) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/tool.py#L373) Run the tool. diff --git a/docs/api-reference/python/aixplain/v2/utility.md b/docs/api-reference/python/aixplain/v2/utility.md index 1dc54ff7f..994be731a 100644 --- a/docs/api-reference/python/aixplain/v2/utility.md +++ b/docs/api-reference/python/aixplain/v2/utility.md @@ -17,10 +17,8 @@ Parameters for listing utilities. **Attributes**: -- `function` - Function: The function of the utility (should be UTILITIES). -- `status` - str: The status of the utility. -- `query` - str: Search query for utilities. -- `ownership` - Tuple[OwnershipType, List[OwnershipType]]: Ownership filter. +- `function` - The function type to filter by (e.g., Function.UTILITIES). +- `status` - The status of the utility to filter by. ### UtilityRunParams Objects @@ -28,7 +26,7 @@ Parameters for listing utilities. class UtilityRunParams(BaseRunParams) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/utility.py#L37) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/utility.py#L35) Parameters for running utilities. @@ -49,7 +47,7 @@ class Utility(BaseResource, SearchResourceMixin[UtilitySearchParams, RunnableResourceMixin[UtilityRunParams, Result]) ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/utility.py#L49) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/utility.py#L47) Resource for utilities. @@ -63,7 +61,7 @@ executed on the platform. def __post_init__() -> None ``` -[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/utility.py#L69) +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/utility.py#L67) Parse code and validate description for new utility instances. diff --git a/docs/api-reference/python/api_sidebar.js b/docs/api-reference/python/api_sidebar.js index 473c96d71..923f0fdcd 100644 --- a/docs/api-reference/python/api_sidebar.js +++ b/docs/api-reference/python/api_sidebar.js @@ -4,280 +4,287 @@ "items": [ { "items": [ - "api-reference/python/aixplain/base/parameters" - ], - "label": "aixplain.base", - "type": "category" - }, - { - "items": [ - "api-reference/python/aixplain/decorators/init", - "api-reference/python/aixplain/decorators/api_key_checker" - ], - "label": "aixplain.decorators", - "type": "category" - }, - { - "items": [ - "api-reference/python/aixplain/enums/init", - "api-reference/python/aixplain/enums/asset_status", - "api-reference/python/aixplain/enums/code_interpreter", - "api-reference/python/aixplain/enums/data_split", - "api-reference/python/aixplain/enums/data_subtype", - "api-reference/python/aixplain/enums/data_type", - "api-reference/python/aixplain/enums/database_source", - "api-reference/python/aixplain/enums/embedding_model", - "api-reference/python/aixplain/enums/error_handler", - "api-reference/python/aixplain/enums/evolve_type", - "api-reference/python/aixplain/enums/file_type", - "api-reference/python/aixplain/enums/function", - "api-reference/python/aixplain/enums/function_type", - "api-reference/python/aixplain/enums/generated_enums", - "api-reference/python/aixplain/enums/index_stores", - "api-reference/python/aixplain/enums/language", - "api-reference/python/aixplain/enums/license", - "api-reference/python/aixplain/enums/onboard_status", - "api-reference/python/aixplain/enums/ownership_type", - "api-reference/python/aixplain/enums/privacy", - "api-reference/python/aixplain/enums/response_status", - "api-reference/python/aixplain/enums/sort_by", - "api-reference/python/aixplain/enums/sort_order", - "api-reference/python/aixplain/enums/splitting_options", - "api-reference/python/aixplain/enums/status", - "api-reference/python/aixplain/enums/storage_type", - "api-reference/python/aixplain/enums/supplier" + "api-reference/python/aixplain/exceptions/init", + "api-reference/python/aixplain/exceptions/types" ], - "label": "aixplain.enums", + "label": "aixplain.exceptions", "type": "category" }, { "items": [ - "api-reference/python/aixplain/exceptions/init", - "api-reference/python/aixplain/exceptions/types" + "api-reference/python/aixplain/utils/init", + "api-reference/python/aixplain/utils/asset_cache", + "api-reference/python/aixplain/utils/cache_utils", + "api-reference/python/aixplain/utils/config", + "api-reference/python/aixplain/utils/convert_datatype_utils", + "api-reference/python/aixplain/utils/evolve_utils", + "api-reference/python/aixplain/utils/file_utils", + "api-reference/python/aixplain/utils/llm_utils", + "api-reference/python/aixplain/utils/request_utils", + "api-reference/python/aixplain/utils/validation_utils" ], - "label": "aixplain.exceptions", + "label": "aixplain.utils", "type": "category" }, { "items": [ { "items": [ - "api-reference/python/aixplain/factories/agent_factory/init", - "api-reference/python/aixplain/factories/agent_factory/utils" + "api-reference/python/aixplain/v1/base/parameters" ], - "label": "aixplain.factories.agent_factory", + "label": "aixplain.v1.base", "type": "category" }, { "items": [ - "api-reference/python/aixplain/factories/cli/model_factory_cli" + "api-reference/python/aixplain/v1/decorators/init", + "api-reference/python/aixplain/v1/decorators/api_key_checker" ], - "label": "aixplain.factories.cli", + "label": "aixplain.v1.decorators", "type": "category" }, { "items": [ - "api-reference/python/aixplain/factories/finetune_factory/init", - "api-reference/python/aixplain/factories/finetune_factory/prompt_validator" + "api-reference/python/aixplain/v1/enums/init", + "api-reference/python/aixplain/v1/enums/asset_status", + "api-reference/python/aixplain/v1/enums/code_interpreter", + "api-reference/python/aixplain/v1/enums/data_split", + "api-reference/python/aixplain/v1/enums/data_subtype", + "api-reference/python/aixplain/v1/enums/data_type", + "api-reference/python/aixplain/v1/enums/database_source", + "api-reference/python/aixplain/v1/enums/embedding_model", + "api-reference/python/aixplain/v1/enums/error_handler", + "api-reference/python/aixplain/v1/enums/evolve_type", + "api-reference/python/aixplain/v1/enums/file_type", + "api-reference/python/aixplain/v1/enums/function", + "api-reference/python/aixplain/v1/enums/function_type", + "api-reference/python/aixplain/v1/enums/generated_enums", + "api-reference/python/aixplain/v1/enums/index_stores", + "api-reference/python/aixplain/v1/enums/language", + "api-reference/python/aixplain/v1/enums/license", + "api-reference/python/aixplain/v1/enums/onboard_status", + "api-reference/python/aixplain/v1/enums/ownership_type", + "api-reference/python/aixplain/v1/enums/privacy", + "api-reference/python/aixplain/v1/enums/response_status", + "api-reference/python/aixplain/v1/enums/sort_by", + "api-reference/python/aixplain/v1/enums/sort_order", + "api-reference/python/aixplain/v1/enums/splitting_options", + "api-reference/python/aixplain/v1/enums/status", + "api-reference/python/aixplain/v1/enums/storage_type", + "api-reference/python/aixplain/v1/enums/supplier" ], - "label": "aixplain.factories.finetune_factory", - "type": "category" - }, - { - "items": [ - "api-reference/python/aixplain/factories/index_factory/init", - "api-reference/python/aixplain/factories/index_factory/utils" - ], - "label": "aixplain.factories.index_factory", + "label": "aixplain.v1.enums", "type": "category" }, { "items": [ { "items": [ - "api-reference/python/aixplain/factories/model_factory/mixins/init", - "api-reference/python/aixplain/factories/model_factory/mixins/model_getter", - "api-reference/python/aixplain/factories/model_factory/mixins/model_list" + "api-reference/python/aixplain/v1/factories/agent_factory/init", + "api-reference/python/aixplain/v1/factories/agent_factory/utils" ], - "label": "aixplain.factories.model_factory.mixins", + "label": "aixplain.v1.factories.agent_factory", "type": "category" }, - "api-reference/python/aixplain/factories/model_factory/init", - "api-reference/python/aixplain/factories/model_factory/utils" - ], - "label": "aixplain.factories.model_factory", - "type": "category" - }, - { - "items": [ - "api-reference/python/aixplain/factories/pipeline_factory/init", - "api-reference/python/aixplain/factories/pipeline_factory/utils" - ], - "label": "aixplain.factories.pipeline_factory", - "type": "category" - }, - { - "items": [ - "api-reference/python/aixplain/factories/team_agent_factory/init", - "api-reference/python/aixplain/factories/team_agent_factory/utils" - ], - "label": "aixplain.factories.team_agent_factory", - "type": "category" - }, - "api-reference/python/aixplain/factories/init", - "api-reference/python/aixplain/factories/api_key_factory", - "api-reference/python/aixplain/factories/asset_factory", - "api-reference/python/aixplain/factories/benchmark_factory", - "api-reference/python/aixplain/factories/corpus_factory", - "api-reference/python/aixplain/factories/data_factory", - "api-reference/python/aixplain/factories/dataset_factory", - "api-reference/python/aixplain/factories/file_factory", - "api-reference/python/aixplain/factories/integration_factory", - "api-reference/python/aixplain/factories/metric_factory", - "api-reference/python/aixplain/factories/script_factory", - "api-reference/python/aixplain/factories/tool_factory", - "api-reference/python/aixplain/factories/wallet_factory" - ], - "label": "aixplain.factories", - "type": "category" - }, - { - "items": [ - { - "items": [ { "items": [ - "api-reference/python/aixplain/modules/agent/tool/init", - "api-reference/python/aixplain/modules/agent/tool/model_tool", - "api-reference/python/aixplain/modules/agent/tool/pipeline_tool", - "api-reference/python/aixplain/modules/agent/tool/python_interpreter_tool", - "api-reference/python/aixplain/modules/agent/tool/sql_tool" + "api-reference/python/aixplain/v1/factories/cli/model_factory_cli" ], - "label": "aixplain.modules.agent.tool", + "label": "aixplain.v1.factories.cli", + "type": "category" + }, + { + "items": [ + "api-reference/python/aixplain/v1/factories/finetune_factory/init", + "api-reference/python/aixplain/v1/factories/finetune_factory/prompt_validator" + ], + "label": "aixplain.v1.factories.finetune_factory", + "type": "category" + }, + { + "items": [ + "api-reference/python/aixplain/v1/factories/index_factory/init", + "api-reference/python/aixplain/v1/factories/index_factory/utils" + ], + "label": "aixplain.v1.factories.index_factory", + "type": "category" + }, + { + "items": [ + { + "items": [ + "api-reference/python/aixplain/v1/factories/model_factory/mixins/init", + "api-reference/python/aixplain/v1/factories/model_factory/mixins/model_getter", + "api-reference/python/aixplain/v1/factories/model_factory/mixins/model_list" + ], + "label": "aixplain.v1.factories.model_factory.mixins", + "type": "category" + }, + "api-reference/python/aixplain/v1/factories/model_factory/init", + "api-reference/python/aixplain/v1/factories/model_factory/utils" + ], + "label": "aixplain.v1.factories.model_factory", + "type": "category" + }, + { + "items": [ + "api-reference/python/aixplain/v1/factories/pipeline_factory/init", + "api-reference/python/aixplain/v1/factories/pipeline_factory/utils" + ], + "label": "aixplain.v1.factories.pipeline_factory", "type": "category" }, - "api-reference/python/aixplain/modules/agent/init", - "api-reference/python/aixplain/modules/agent/agent_response", - "api-reference/python/aixplain/modules/agent/agent_response_data", - "api-reference/python/aixplain/modules/agent/agent_task", - "api-reference/python/aixplain/modules/agent/evolve_param", - "api-reference/python/aixplain/modules/agent/model_with_params", - "api-reference/python/aixplain/modules/agent/output_format", - "api-reference/python/aixplain/modules/agent/utils" - ], - "label": "aixplain.modules.agent", - "type": "category" - }, - { - "items": [ - "api-reference/python/aixplain/modules/finetune/init", - "api-reference/python/aixplain/modules/finetune/cost", - "api-reference/python/aixplain/modules/finetune/hyperparameters", - "api-reference/python/aixplain/modules/finetune/status" - ], - "label": "aixplain.modules.finetune", - "type": "category" - }, - { - "items": [ - "api-reference/python/aixplain/modules/model/init", - "api-reference/python/aixplain/modules/model/connection", - "api-reference/python/aixplain/modules/model/index_model", - "api-reference/python/aixplain/modules/model/integration", - "api-reference/python/aixplain/modules/model/llm_model", - "api-reference/python/aixplain/modules/model/mcp_connection", - "api-reference/python/aixplain/modules/model/model_parameters", - "api-reference/python/aixplain/modules/model/model_response_streamer", - "api-reference/python/aixplain/modules/model/record", - "api-reference/python/aixplain/modules/model/response", - "api-reference/python/aixplain/modules/model/utility_model", - "api-reference/python/aixplain/modules/model/utils" - ], - "label": "aixplain.modules.model", - "type": "category" - }, - { - "items": [ { "items": [ - "api-reference/python/aixplain/modules/pipeline/designer/init", - "api-reference/python/aixplain/modules/pipeline/designer/base", - "api-reference/python/aixplain/modules/pipeline/designer/enums", - "api-reference/python/aixplain/modules/pipeline/designer/mixins", - "api-reference/python/aixplain/modules/pipeline/designer/nodes", - "api-reference/python/aixplain/modules/pipeline/designer/pipeline", - "api-reference/python/aixplain/modules/pipeline/designer/utils" + "api-reference/python/aixplain/v1/factories/team_agent_factory/init", + "api-reference/python/aixplain/v1/factories/team_agent_factory/utils" ], - "label": "aixplain.modules.pipeline.designer", + "label": "aixplain.v1.factories.team_agent_factory", "type": "category" }, - "api-reference/python/aixplain/modules/pipeline/init", - "api-reference/python/aixplain/modules/pipeline/asset", - "api-reference/python/aixplain/modules/pipeline/default", - "api-reference/python/aixplain/modules/pipeline/pipeline", - "api-reference/python/aixplain/modules/pipeline/response" + "api-reference/python/aixplain/v1/factories/init", + "api-reference/python/aixplain/v1/factories/api_key_factory", + "api-reference/python/aixplain/v1/factories/asset_factory", + "api-reference/python/aixplain/v1/factories/benchmark_factory", + "api-reference/python/aixplain/v1/factories/corpus_factory", + "api-reference/python/aixplain/v1/factories/data_factory", + "api-reference/python/aixplain/v1/factories/dataset_factory", + "api-reference/python/aixplain/v1/factories/file_factory", + "api-reference/python/aixplain/v1/factories/integration_factory", + "api-reference/python/aixplain/v1/factories/metric_factory", + "api-reference/python/aixplain/v1/factories/script_factory", + "api-reference/python/aixplain/v1/factories/tool_factory", + "api-reference/python/aixplain/v1/factories/wallet_factory" ], - "label": "aixplain.modules.pipeline", + "label": "aixplain.v1.factories", "type": "category" }, { "items": [ - "api-reference/python/aixplain/modules/team_agent/init", - "api-reference/python/aixplain/modules/team_agent/evolver_response_data", - "api-reference/python/aixplain/modules/team_agent/inspector" + { + "items": [ + { + "items": [ + "api-reference/python/aixplain/v1/modules/agent/tool/init", + "api-reference/python/aixplain/v1/modules/agent/tool/model_tool", + "api-reference/python/aixplain/v1/modules/agent/tool/pipeline_tool", + "api-reference/python/aixplain/v1/modules/agent/tool/python_interpreter_tool", + "api-reference/python/aixplain/v1/modules/agent/tool/sql_tool" + ], + "label": "aixplain.v1.modules.agent.tool", + "type": "category" + }, + "api-reference/python/aixplain/v1/modules/agent/init", + "api-reference/python/aixplain/v1/modules/agent/agent_response", + "api-reference/python/aixplain/v1/modules/agent/agent_response_data", + "api-reference/python/aixplain/v1/modules/agent/agent_task", + "api-reference/python/aixplain/v1/modules/agent/evolve_param", + "api-reference/python/aixplain/v1/modules/agent/model_with_params", + "api-reference/python/aixplain/v1/modules/agent/output_format", + "api-reference/python/aixplain/v1/modules/agent/utils" + ], + "label": "aixplain.v1.modules.agent", + "type": "category" + }, + { + "items": [ + "api-reference/python/aixplain/v1/modules/finetune/init", + "api-reference/python/aixplain/v1/modules/finetune/cost", + "api-reference/python/aixplain/v1/modules/finetune/hyperparameters", + "api-reference/python/aixplain/v1/modules/finetune/status" + ], + "label": "aixplain.v1.modules.finetune", + "type": "category" + }, + { + "items": [ + "api-reference/python/aixplain/v1/modules/model/init", + "api-reference/python/aixplain/v1/modules/model/connection", + "api-reference/python/aixplain/v1/modules/model/index_model", + "api-reference/python/aixplain/v1/modules/model/integration", + "api-reference/python/aixplain/v1/modules/model/llm_model", + "api-reference/python/aixplain/v1/modules/model/mcp_connection", + "api-reference/python/aixplain/v1/modules/model/model_parameters", + "api-reference/python/aixplain/v1/modules/model/model_response_streamer", + "api-reference/python/aixplain/v1/modules/model/record", + "api-reference/python/aixplain/v1/modules/model/response", + "api-reference/python/aixplain/v1/modules/model/utility_model", + "api-reference/python/aixplain/v1/modules/model/utils" + ], + "label": "aixplain.v1.modules.model", + "type": "category" + }, + { + "items": [ + { + "items": [ + "api-reference/python/aixplain/v1/modules/pipeline/designer/init", + "api-reference/python/aixplain/v1/modules/pipeline/designer/base", + "api-reference/python/aixplain/v1/modules/pipeline/designer/enums", + "api-reference/python/aixplain/v1/modules/pipeline/designer/mixins", + "api-reference/python/aixplain/v1/modules/pipeline/designer/nodes", + "api-reference/python/aixplain/v1/modules/pipeline/designer/pipeline", + "api-reference/python/aixplain/v1/modules/pipeline/designer/utils" + ], + "label": "aixplain.v1.modules.pipeline.designer", + "type": "category" + }, + "api-reference/python/aixplain/v1/modules/pipeline/init", + "api-reference/python/aixplain/v1/modules/pipeline/asset", + "api-reference/python/aixplain/v1/modules/pipeline/default", + "api-reference/python/aixplain/v1/modules/pipeline/pipeline", + "api-reference/python/aixplain/v1/modules/pipeline/response" + ], + "label": "aixplain.v1.modules.pipeline", + "type": "category" + }, + { + "items": [ + "api-reference/python/aixplain/v1/modules/team_agent/init", + "api-reference/python/aixplain/v1/modules/team_agent/evolver_response_data", + "api-reference/python/aixplain/v1/modules/team_agent/inspector" + ], + "label": "aixplain.v1.modules.team_agent", + "type": "category" + }, + "api-reference/python/aixplain/v1/modules/init", + "api-reference/python/aixplain/v1/modules/api_key", + "api-reference/python/aixplain/v1/modules/asset", + "api-reference/python/aixplain/v1/modules/benchmark", + "api-reference/python/aixplain/v1/modules/benchmark_job", + "api-reference/python/aixplain/v1/modules/content_interval", + "api-reference/python/aixplain/v1/modules/corpus", + "api-reference/python/aixplain/v1/modules/data", + "api-reference/python/aixplain/v1/modules/dataset", + "api-reference/python/aixplain/v1/modules/file", + "api-reference/python/aixplain/v1/modules/metadata", + "api-reference/python/aixplain/v1/modules/metric", + "api-reference/python/aixplain/v1/modules/mixins", + "api-reference/python/aixplain/v1/modules/wallet" ], - "label": "aixplain.modules.team_agent", + "label": "aixplain.v1.modules", "type": "category" }, - "api-reference/python/aixplain/modules/init", - "api-reference/python/aixplain/modules/api_key", - "api-reference/python/aixplain/modules/asset", - "api-reference/python/aixplain/modules/benchmark", - "api-reference/python/aixplain/modules/benchmark_job", - "api-reference/python/aixplain/modules/content_interval", - "api-reference/python/aixplain/modules/corpus", - "api-reference/python/aixplain/modules/data", - "api-reference/python/aixplain/modules/dataset", - "api-reference/python/aixplain/modules/file", - "api-reference/python/aixplain/modules/metadata", - "api-reference/python/aixplain/modules/metric", - "api-reference/python/aixplain/modules/mixins", - "api-reference/python/aixplain/modules/wallet" - ], - "label": "aixplain.modules", - "type": "category" - }, - { - "items": [ { "items": [ - "api-reference/python/aixplain/processes/data_onboarding/init", - "api-reference/python/aixplain/processes/data_onboarding/onboard_functions", - "api-reference/python/aixplain/processes/data_onboarding/process_media_files", - "api-reference/python/aixplain/processes/data_onboarding/process_text_files" + { + "items": [ + "api-reference/python/aixplain/v1/processes/data_onboarding/init", + "api-reference/python/aixplain/v1/processes/data_onboarding/onboard_functions", + "api-reference/python/aixplain/v1/processes/data_onboarding/process_media_files", + "api-reference/python/aixplain/v1/processes/data_onboarding/process_text_files" + ], + "label": "aixplain.v1.processes.data_onboarding", + "type": "category" + }, + "api-reference/python/aixplain/v1/processes/init" ], - "label": "aixplain.processes.data_onboarding", + "label": "aixplain.v1.processes", "type": "category" }, - "api-reference/python/aixplain/processes/init" + "api-reference/python/aixplain/v1/init" ], - "label": "aixplain.processes", - "type": "category" - }, - { - "items": [ - "api-reference/python/aixplain/utils/init", - "api-reference/python/aixplain/utils/asset_cache", - "api-reference/python/aixplain/utils/cache_utils", - "api-reference/python/aixplain/utils/config", - "api-reference/python/aixplain/utils/convert_datatype_utils", - "api-reference/python/aixplain/utils/evolve_utils", - "api-reference/python/aixplain/utils/file_utils", - "api-reference/python/aixplain/utils/llm_utils", - "api-reference/python/aixplain/utils/request_utils", - "api-reference/python/aixplain/utils/validation_utils" - ], - "label": "aixplain.utils", + "label": "aixplain.v1", "type": "category" }, { @@ -285,7 +292,9 @@ "api-reference/python/aixplain/v2/init", "api-reference/python/aixplain/v2/agent", "api-reference/python/aixplain/v2/agent_progress", + "api-reference/python/aixplain/v2/api_key", "api-reference/python/aixplain/v2/client", + "api-reference/python/aixplain/v2/code_utils", "api-reference/python/aixplain/v2/core", "api-reference/python/aixplain/v2/enums", "api-reference/python/aixplain/v2/enums_include", @@ -305,6 +314,7 @@ "type": "category" }, "api-reference/python/aixplain/init", + "api-reference/python/aixplain/_compat", "api-reference/python/aixplain/cli_groups" ], "label": "aixplain", diff --git a/tests/functional/agent/agent_functional_test.py b/tests/functional/agent/agent_functional_test.py index 16e08a206..8d1de9f23 100644 --- a/tests/functional/agent/agent_functional_test.py +++ b/tests/functional/agent/agent_functional_test.py @@ -114,6 +114,7 @@ def test_end2end(run_input_map, resource_tracker, AgentFactory): assert response["data"]["output"] is not None +@pytest.mark.flaky(reruns=2, reruns_delay=2) @pytest.mark.parametrize("AgentFactory", [AgentFactory]) def test_python_interpreter_tool(resource_tracker, AgentFactory): tool = AgentFactory.create_python_interpreter_tool() @@ -128,19 +129,26 @@ def test_python_interpreter_tool(resource_tracker, AgentFactory): agent = AgentFactory.create( name=agent_name, description="A Python developer agent. If you get an error from a tool, try to fix it.", - instructions="A Python developer agent. If you get an error from a tool, try to fix it.", + instructions="You MUST use the Python interpreter tool to solve any problem. NEVER answer directly without running code first.", tools=[tool], ) resource_tracker.append(agent) assert agent is not None - response = agent.run("Solve the equation $\\frac{v^2}{2} + 7v - 16 = 0$ to find the value of $v$.") + response = agent.run("Write Python code to calculate 2+2 and print the result.") assert response is not None assert response["completed"] is True assert response["status"].lower() == "success" assert len(response["data"]["intermediate_steps"]) > 0 - intermediate_step = response["data"]["intermediate_steps"][0] - assert len(intermediate_step["tool_steps"]) > 0 - assert intermediate_step["tool_steps"][0]["tool"] == "Python Code Interpreter Tool" + tool_steps_found = False + for intermediate_step in response["data"]["intermediate_steps"]: + if intermediate_step.get("tool_steps"): + for ts in intermediate_step["tool_steps"]: + if ts.get("tool") == "Python Code Interpreter Tool": + tool_steps_found = True + break + if tool_steps_found: + break + assert tool_steps_found, "No intermediate step with Python Code Interpreter Tool found" @pytest.mark.parametrize("AgentFactory", [AgentFactory]) @@ -292,12 +300,12 @@ def test_update_tools_of_agent(run_input_map, resource_tracker, AgentFactory): pytest.param( { "type": "translation", - "supplier": "ModernMT", + "supplier": "aixplain", "function": "translation", "query": "Translate: 'Olá, como vai você?'", "description": "Translation tool with target language", "expected_tool_input": "Olá, como vai você?", - "model": "60ddefc48d38c51c5885fdcf", + "model": "678025ac6eb563a2566829b1", }, id="translation_tool", ), @@ -353,8 +361,12 @@ def test_specific_model_parameters_e2e(tool_config, resource_tracker): tool_used = False for step in response["data"]["intermediate_steps"]: - if len(step["tool_steps"]) > 0 and tool_config["expected_tool_input"] in step["tool_steps"][0]["input"]: - tool_used = True + if step.get("tool_steps"): + for ts in step["tool_steps"]: + if ts.get("input") and tool_config["expected_tool_input"] in ts["input"]: + tool_used = True + break + if tool_used: break assert tool_used, "Tool was not used in execution" @@ -524,6 +536,7 @@ def test_instructions(resource_tracker, AgentFactory): assert "aixplain" in response["data"]["output"].lower() +@pytest.mark.flaky(reruns=2, reruns_delay=5) @pytest.mark.parametrize("AgentFactory", [AgentFactory]) def test_agent_with_utility_tool(resource_tracker, AgentFactory): from aixplain.enums import DataType @@ -590,11 +603,15 @@ def concat_strings(string1: str, string2: str): ) resource_tracker.append(agent) - result_vowel = agent.run("Remove all the vowels in this string: 'Hello'") - result_concat_text = agent.run("Concat these strings: String1 = 'Hello'; string2= 'World!'.") + result_vowel = agent.run( + "Use the Vowel Remover tool to remove all vowels from the text 'Banana'. Return only the result." + ) + result_concat_text = agent.run( + "Use the String Concatenator tool to concatenate string1='Good' and string2='Morning'. Return only the result." + ) - assert "hll" in result_vowel["data"]["output"].lower() - assert "helloworld!" in result_concat_text["data"]["output"].lower() + assert "bnn" in result_vowel["data"]["output"].lower() + assert "goodmorning" in result_concat_text["data"]["output"].lower() @pytest.mark.parametrize("AgentFactory", [AgentFactory]) @@ -632,7 +649,16 @@ def test_agent_with_pipeline_tool(resource_tracker, AgentFactory): answer = pipeline_agent.run("Who is the president of USA?") assert "hello" in answer["data"]["output"].lower() - assert "hello pipeline" in answer["data"]["intermediate_steps"][0]["tool_steps"][0]["tool"].lower() + pipeline_tool_found = False + for step in answer["data"]["intermediate_steps"]: + if step.get("tool_steps"): + for ts in step["tool_steps"]: + if ts.get("tool") and "hello pipeline" in ts["tool"].lower(): + pipeline_tool_found = True + break + if pipeline_tool_found: + break + assert pipeline_tool_found, "Pipeline tool was not found in intermediate steps" @pytest.mark.parametrize("AgentFactory", [AgentFactory]) diff --git a/tests/functional/apikey/test_api.py b/tests/functional/apikey/test_api.py index e32e5e191..8bbee483b 100644 --- a/tests/functional/apikey/test_api.py +++ b/tests/functional/apikey/test_api.py @@ -47,6 +47,7 @@ def test_api_key_lifecycle(): _delete_test_api_key(APIKeyFactory) +@pytest.mark.flaky(reruns=2, reruns_delay=5) @pytest.mark.parametrize("APIKeyFactory", [APIKeyFactory]) def test_01_create_api_key_from_json(APIKeyFactory): """Test creating API key from JSON file.""" diff --git a/tests/functional/general_assets/asset_functional_test.py b/tests/functional/general_assets/asset_functional_test.py index 5651f8972..0377abf74 100644 --- a/tests/functional/general_assets/asset_functional_test.py +++ b/tests/functional/general_assets/asset_functional_test.py @@ -83,6 +83,7 @@ def test_model_function(ModelFactory): assert model.function == desired_function +@pytest.mark.skip(reason="Backend returns inconsistent supplier data in filtered results") @pytest.mark.parametrize("ModelFactory", [ModelFactory]) def test_model_supplier(ModelFactory): desired_suppliers = [Supplier.GOOGLE] @@ -107,7 +108,7 @@ def test_model_supplier(ModelFactory): [ ( ("67be216bd8f6a65d6f74d5e9", "6895d6d1d50c89537c1cf237"), - ("Anthropic Claude 3.7 Sonnet", "GPT-4o Mini"), + ("Claude 3.7 Sonnet", "GPT-5 Mini"), ), ], ) @@ -141,6 +142,7 @@ def test_model_sort(ModelFactory): assert prev_model_price >= model_price +@pytest.mark.skip(reason="Backend returns inconsistent ownership data in filtered results") @pytest.mark.parametrize("ModelFactory", [ModelFactory]) def test_model_ownership(ModelFactory): models = ModelFactory.list(ownership=OwnershipType.SUBSCRIBED, function=Function.TRANSLATION)["results"] @@ -173,7 +175,7 @@ def test_llm_instantiation(ModelFactory): @pytest.mark.parametrize("ModelFactory", [ModelFactory]) def test_model_io(ModelFactory): - model_id = "64aee5824d34b1221e70ac07" + model_id = "699cd5c88be7bf2a80e80210" model = ModelFactory.get(model_id) # Verify input_params structure matches actual API response diff --git a/tests/functional/team_agent/team_agent_functional_test.py b/tests/functional/team_agent/team_agent_functional_test.py index e09113380..8cbdb3052 100644 --- a/tests/functional/team_agent/team_agent_functional_test.py +++ b/tests/functional/team_agent/team_agent_functional_test.py @@ -47,6 +47,8 @@ def resource_tracker(): resource.delete() except Exception: pass + + @pytest.fixture def resource_tracker(): """Tracks resources created during a test for guaranteed cleanup.""" @@ -65,7 +67,6 @@ def run_input_map(request): @pytest.mark.parametrize("TeamAgentFactory", [TeamAgentFactory]) -def test_end2end(run_input_map, resource_tracker, TeamAgentFactory): def test_end2end(run_input_map, resource_tracker, TeamAgentFactory): agents = create_agents_from_input_map(run_input_map) for agent in agents: @@ -79,7 +80,6 @@ def test_end2end(run_input_map, resource_tracker, TeamAgentFactory): use_mentalist=True, ) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) assert team_agent is not None assert team_agent.status == AssetStatus.DRAFT @@ -100,7 +100,6 @@ def test_end2end(run_input_map, resource_tracker, TeamAgentFactory): @pytest.mark.parametrize("TeamAgentFactory", [TeamAgentFactory]) -def test_draft_team_agent_update(run_input_map, resource_tracker, TeamAgentFactory): def test_draft_team_agent_update(run_input_map, resource_tracker, TeamAgentFactory): agents = create_agents_from_input_map(run_input_map, deploy=False) for agent in agents: @@ -114,7 +113,6 @@ def test_draft_team_agent_update(run_input_map, resource_tracker, TeamAgentFacto use_mentalist=True, ) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) team_agent_name = str(uuid4()).replace("-", "") team_agent.name = team_agent_name @@ -125,7 +123,6 @@ def test_draft_team_agent_update(run_input_map, resource_tracker, TeamAgentFacto @pytest.mark.parametrize("TeamAgentFactory", [TeamAgentFactory]) -def test_nested_deployment_chain(resource_tracker, TeamAgentFactory): def test_nested_deployment_chain(resource_tracker, TeamAgentFactory): """Test that deploying a team agent properly deploys all nested components (tools -> agents -> team)""" # Create first agent with translation tool (in DRAFT state) @@ -139,10 +136,8 @@ def test_nested_deployment_chain(resource_tracker, TeamAgentFactory): supplier=Supplier.AZURE, ) - translation_agent_name = f"TrA {str(uuid4())[:8]}" translation_agent_name = f"TrA {str(uuid4())[:8]}" translation_agent = AgentFactory.create( - name=translation_agent_name, name=translation_agent_name, description="Agent for translation", instructions="Translate text from English to Spanish", @@ -150,7 +145,6 @@ def test_nested_deployment_chain(resource_tracker, TeamAgentFactory): tools=[translation_tool], ) resource_tracker.append(translation_agent) - resource_tracker.append(translation_agent) assert translation_agent.status == AssetStatus.DRAFT # Create second agent with text generation tool (in DRAFT state) text_gen_tool = AgentFactory.create_model_tool( @@ -159,10 +153,8 @@ def test_nested_deployment_chain(resource_tracker, TeamAgentFactory): supplier=Supplier.OPENAI, ) - text_gen_agent_name = f"TGA {str(uuid4())[:8]}" text_gen_agent_name = f"TGA {str(uuid4())[:8]}" text_gen_agent = AgentFactory.create( - name=text_gen_agent_name, name=text_gen_agent_name, description="Agent for text generation", instructions="Generate creative text based on input", @@ -170,21 +162,17 @@ def test_nested_deployment_chain(resource_tracker, TeamAgentFactory): tools=[text_gen_tool], ) resource_tracker.append(text_gen_agent) - resource_tracker.append(text_gen_agent) assert text_gen_agent.status == AssetStatus.DRAFT # Create team agent with both agents (in DRAFT state) team_agent_name = f"MFT {str(uuid4())[:8]}" - team_agent_name = f"MFT {str(uuid4())[:8]}" team_agent = TeamAgentFactory.create( - name=team_agent_name, name=team_agent_name, description="Team that can translate and generate text", agents=[translation_agent, text_gen_agent], llm_id="6895d6d1d50c89537c1cf237", ) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) assert team_agent.status == AssetStatus.DRAFT for agent in team_agent.agents: assert agent.status == AssetStatus.DRAFT @@ -206,7 +194,6 @@ def test_nested_deployment_chain(resource_tracker, TeamAgentFactory): @pytest.mark.parametrize("TeamAgentFactory", [TeamAgentFactory]) -def test_fail_non_existent_llm(run_input_map, resource_tracker, TeamAgentFactory): def test_fail_non_existent_llm(run_input_map, resource_tracker, TeamAgentFactory): agents = create_agents_from_input_map(run_input_map, deploy=False) for agent in agents: @@ -216,7 +203,6 @@ def test_fail_non_existent_llm(run_input_map, resource_tracker, TeamAgentFactory with pytest.raises(Exception) as exc_info: TeamAgentFactory.create( - name=f"NEL {str(uuid4())[:8]}", name=f"NEL {str(uuid4())[:8]}", description="", llm_id="non_existent_llm", @@ -229,7 +215,6 @@ def test_fail_non_existent_llm(run_input_map, resource_tracker, TeamAgentFactory @pytest.mark.parametrize("TeamAgentFactory", [TeamAgentFactory]) -def test_add_remove_agents_from_team_agent(run_input_map, resource_tracker, TeamAgentFactory): def test_add_remove_agents_from_team_agent(run_input_map, resource_tracker, TeamAgentFactory): agents = create_agents_from_input_map(run_input_map, deploy=False) for agent in agents: @@ -243,22 +228,18 @@ def test_add_remove_agents_from_team_agent(run_input_map, resource_tracker, Team use_mentalist=True, ) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) assert team_agent is not None assert team_agent.status == AssetStatus.DRAFT - new_agent_name = f"NA {str(uuid4())[:8]}" new_agent_name = f"NA {str(uuid4())[:8]}" new_agent = AgentFactory.create( - name=new_agent_name, name=new_agent_name, description="Agent added to team", instructions="Agent added to team", llm_id=run_input_map["llm_id"], ) resource_tracker.append(new_agent) - resource_tracker.append(new_agent) team_agent.agents.append(new_agent) team_agent.update() @@ -274,12 +255,9 @@ def test_add_remove_agents_from_team_agent(run_input_map, resource_tracker, Team assert len(team_agent.agents) == len(agents) -def test_team_agent_tasks(resource_tracker): - agent_name = f"TSA {str(uuid4())[:8]}" def test_team_agent_tasks(resource_tracker): agent_name = f"TSA {str(uuid4())[:8]}" agent = AgentFactory.create( - name=agent_name, name=agent_name, description="You are a test agent that always returns the same answer", tools=[ @@ -300,41 +278,32 @@ def test_team_agent_tasks(resource_tracker): ], ) resource_tracker.append(agent) - resource_tracker.append(agent) - team_agent_name = f"TMA {str(uuid4())[:8]}" team_agent_name = f"TMA {str(uuid4())[:8]}" team_agent = TeamAgentFactory.create( - name=team_agent_name, name=team_agent_name, agents=[agent], description="Teste", ) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) response = team_agent.run(data="Translate 'teste'") assert response.status == "SUCCESS" assert "test" in response.data["output"] -@pytest.mark.skip(reason="Tools not available - uses ConnectionTool model") -def test_team_agent_with_parameterized_agents(run_input_map, resource_tracker): @pytest.mark.skip(reason="Tools not available - uses ConnectionTool model") def test_team_agent_with_parameterized_agents(run_input_map, resource_tracker): """Test team agent with agents that have parameterized tools""" # Create first agent with search tool search_model = ModelFactory.get("692f18557b2cc45d29150cb0") - search_model = ModelFactory.get("692f18557b2cc45d29150cb0") model_params = search_model.get_parameters() model_params.numResults = 5 search_tool = AgentFactory.create_model_tool( model=search_model, description="Search tool with custom number of results" ) - search_agent_name = f"SA {str(uuid4())[:8]}" search_agent_name = f"SA {str(uuid4())[:8]}" search_agent = AgentFactory.create( - name=search_agent_name, name=search_agent_name, description="This agent is used to search for information in the web.", instructions="Agent that performs searches. Once you have the results, return them in a list as the output.", @@ -342,7 +311,6 @@ def test_team_agent_with_parameterized_agents(run_input_map, resource_tracker): tools=[search_tool], ) resource_tracker.append(search_agent) - resource_tracker.append(search_agent) search_agent.deploy() # Create second agent with translation tool @@ -356,10 +324,8 @@ def test_team_agent_with_parameterized_agents(run_input_map, resource_tracker): supplier=Supplier.AZURE, ) - translation_agent_name = f"TrA {str(uuid4())[:8]}" translation_agent_name = f"TrA {str(uuid4())[:8]}" translation_agent = AgentFactory.create( - name=translation_agent_name, name=translation_agent_name, description="This agent is used to translate text from one language to another.", instructions="Agent that translates text from English to Portuguese", @@ -367,7 +333,6 @@ def test_team_agent_with_parameterized_agents(run_input_map, resource_tracker): tools=[translation_tool], ) resource_tracker.append(translation_agent) - resource_tracker.append(translation_agent) translation_agent.deploy() team_agent = create_team_agent( TeamAgentFactory, @@ -376,7 +341,6 @@ def test_team_agent_with_parameterized_agents(run_input_map, resource_tracker): use_mentalist=True, ) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) # Deploy team agent team_agent.deploy() @@ -394,40 +358,29 @@ def test_team_agent_with_parameterized_agents(run_input_map, resource_tracker): called_agents = [step["agent"] for step in intermediate_steps] assert search_agent_name in called_agents assert translation_agent_name in called_agents - assert search_agent_name in called_agents - assert translation_agent_name in called_agents -def test_team_agent_with_instructions(resource_tracker): - agent_1_name = f"A1 {str(uuid4())[:8]}" def test_team_agent_with_instructions(resource_tracker): agent_1_name = f"A1 {str(uuid4())[:8]}" agent_1 = AgentFactory.create( - name=agent_1_name, name=agent_1_name, description="Translation agent", tools=[AgentFactory.create_model_tool(function=Function.TRANSLATION, supplier=Supplier.AZURE)], llm_id="6895d6d1d50c89537c1cf237", ) resource_tracker.append(agent_1) - resource_tracker.append(agent_1) - agent_2_name = f"A2 {str(uuid4())[:8]}" agent_2_name = f"A2 {str(uuid4())[:8]}" agent_2 = AgentFactory.create( - name=agent_2_name, name=agent_2_name, description="Translation agent", tools=[AgentFactory.create_model_tool(function=Function.TRANSLATION, supplier=Supplier.GOOGLE)], llm_id="6895d6d1d50c89537c1cf237", ) resource_tracker.append(agent_2) - resource_tracker.append(agent_2) - team_agent_name = f"TTA {str(uuid4())[:8]}" team_agent_name = f"TTA {str(uuid4())[:8]}" team_agent = TeamAgentFactory.create( - name=team_agent_name, name=team_agent_name, agents=[agent_1, agent_2], description="Team agent", @@ -436,7 +389,6 @@ def test_team_agent_with_instructions(resource_tracker): use_mentalist=True, ) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) response = team_agent.run(data="Translate 'cat' to Portuguese") assert response.status == "SUCCESS" @@ -447,19 +399,15 @@ def test_team_agent_with_instructions(resource_tracker): called_agents = set([step["agent"] for step in mentalist_steps]) assert len(called_agents) == 1 assert agent_2_name in called_agents - assert agent_2_name in called_agents @pytest.mark.parametrize("TeamAgentFactory", [TeamAgentFactory]) -def test_team_agent_llm_parameter_preservation(resource_tracker, run_input_map, TeamAgentFactory): def test_team_agent_llm_parameter_preservation(resource_tracker, run_input_map, TeamAgentFactory): """Test that LLM parameters like temperature are preserved for all LLM roles in team agents.""" # Create a regular agent first agents = create_agents_from_input_map(run_input_map, deploy=True) for agent in agents: resource_tracker.append(agent) - for agent in agents: - resource_tracker.append(agent) # Get LLM instances and customize their temperatures supervisor_llm = ModelFactory.get("671be4886eb56397e51f7541") # Anthropic Claude 3.5 Sonnet v1 @@ -471,9 +419,7 @@ def test_team_agent_llm_parameter_preservation(resource_tracker, run_input_map, # Create a team agent with custom LLMs team_agent_name = f"LPTTA {str(uuid4())[:8]}" - team_agent_name = f"LPTTA {str(uuid4())[:8]}" team_agent = TeamAgentFactory.create( - name=team_agent_name, name=team_agent_name, agents=agents, supervisor_llm=supervisor_llm, @@ -483,7 +429,6 @@ def test_team_agent_llm_parameter_preservation(resource_tracker, run_input_map, use_mentalist=True, ) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) # Verify that temperature settings were preserved assert team_agent.supervisor_llm.temperature == 0.1 @@ -494,7 +439,6 @@ def test_team_agent_llm_parameter_preservation(resource_tracker, run_input_map, assert id(team_agent.mentalist_llm) == id(mentalist_llm) -def test_run_team_agent_with_expected_output(resource_tracker): def test_run_team_agent_with_expected_output(resource_tracker): from pydantic import BaseModel from typing import Optional, List @@ -535,10 +479,8 @@ class Response(BaseModel): | Sofia Carvalho | 29 | Brasília | +-----------------+-------+----------------+""" - agent_name = f"TA {str(uuid4())[:8]}" agent_name = f"TA {str(uuid4())[:8]}" agent = AgentFactory.create( - name=agent_name, name=agent_name, description="Test description", instructions=INSTRUCTIONS, @@ -552,12 +494,9 @@ class Response(BaseModel): llm_id="6895d6d1d50c89537c1cf237", ) resource_tracker.append(agent) - resource_tracker.append(agent) - team_agent_name = f"TTA {str(uuid4())[:8]}" team_agent_name = f"TTA {str(uuid4())[:8]}" team_agent = TeamAgentFactory.create( - name=team_agent_name, name=team_agent_name, agents=[agent], description="Team agent", @@ -565,7 +504,6 @@ class Response(BaseModel): use_mentalist=False, ) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) # Run the team agent response = team_agent.run( @@ -605,8 +543,6 @@ class Response(BaseModel): assert person["name"] in more_than_30_years_old -@pytest.mark.skip(reason="Tools not available") -def test_team_agent_with_slack_connector(resource_tracker): @pytest.mark.skip(reason="Tools not available") def test_team_agent_with_slack_connector(resource_tracker): from aixplain.modules.model.integration import AuthenticationSchema @@ -625,10 +561,8 @@ def test_team_agent_with_slack_connector(resource_tracker): action for action in connection.actions if action.code == "SLACK_SENDS_A_MESSAGE_TO_A_SLACK_CHANNEL" ] - agent_name = f"TA {str(uuid4())[:8]}" agent_name = f"TA {str(uuid4())[:8]}" agent = AgentFactory.create( - name=agent_name, name=agent_name, description="This agent is used to send messages to Slack", instructions="You are a helpful assistant that can answer questions based on a large knowledge base and send messages to Slack.", @@ -646,12 +580,9 @@ def test_team_agent_with_slack_connector(resource_tracker): ], ) resource_tracker.append(agent) - resource_tracker.append(agent) - team_agent_name = f"TTA {str(uuid4())[:8]}" team_agent_name = f"TTA {str(uuid4())[:8]}" team_agent = TeamAgentFactory.create( - name=team_agent_name, name=team_agent_name, agents=[agent], description="Team agent", @@ -660,8 +591,6 @@ def test_team_agent_with_slack_connector(resource_tracker): ) resource_tracker.append(team_agent) resource_tracker.append(connection) - resource_tracker.append(team_agent) - resource_tracker.append(connection) response = team_agent.run( "Send what is the capital of Senegal on Slack to channel of #modelserving-alerts: 'C084G435LR5'. Add the name of the capital in the final answer." @@ -671,7 +600,6 @@ def test_team_agent_with_slack_connector(resource_tracker): @pytest.mark.parametrize("TeamAgentFactory", [TeamAgentFactory]) -def test_multiple_teams_with_shared_deployed_agent(resource_tracker, TeamAgentFactory): def test_multiple_teams_with_shared_deployed_agent(resource_tracker, TeamAgentFactory): """Test that multiple team agents can share the same deployed agent without name conflicts""" # Create and deploy a shared agent first @@ -681,10 +609,8 @@ def test_multiple_teams_with_shared_deployed_agent(resource_tracker, TeamAgentFa supplier=Supplier.AZURE, ) - shared_agent_name = f"STA {str(uuid4())[:8]}" shared_agent_name = f"STA {str(uuid4())[:8]}" shared_agent = AgentFactory.create( - name=shared_agent_name, name=shared_agent_name, description="Agent for translation shared between teams", instructions="Translate text from English to Spanish", @@ -692,7 +618,6 @@ def test_multiple_teams_with_shared_deployed_agent(resource_tracker, TeamAgentFa tools=[translation_tool], ) resource_tracker.append(shared_agent) - resource_tracker.append(shared_agent) # Deploy the shared agent first shared_agent.deploy() @@ -701,16 +626,13 @@ def test_multiple_teams_with_shared_deployed_agent(resource_tracker, TeamAgentFa # Create first team agent with the shared agent team_agent_1_name = f"TTA1 {str(uuid4())[:8]}" - team_agent_1_name = f"TTA1 {str(uuid4())[:8]}" team_agent_1 = TeamAgentFactory.create( - name=team_agent_1_name, name=team_agent_1_name, description="First team using shared agent", agents=[shared_agent], llm_id="6895d6d1d50c89537c1cf237", ) resource_tracker.append(team_agent_1) - resource_tracker.append(team_agent_1) assert team_agent_1.status == AssetStatus.DRAFT # Deploy first team agent - should succeed without trying to redeploy the shared agent @@ -720,16 +642,13 @@ def test_multiple_teams_with_shared_deployed_agent(resource_tracker, TeamAgentFa # Create second team agent with the same shared agent team_agent_2_name = f"TTA2 {str(uuid4())[:8]}" - team_agent_2_name = f"TTA2 {str(uuid4())[:8]}" team_agent_2 = TeamAgentFactory.create( - name=team_agent_2_name, name=team_agent_2_name, description="Second team using shared agent", agents=[shared_agent], llm_id="6895d6d1d50c89537c1cf237", ) resource_tracker.append(team_agent_2) - resource_tracker.append(team_agent_2) assert team_agent_2.status == AssetStatus.DRAFT # Deploy second team agent - should succeed without trying to redeploy the shared agent diff --git a/tests/functional/v2/inspector_functional_test.py b/tests/functional/v2/inspector_functional_test.py index 2f838ce9f..b9173325c 100644 --- a/tests/functional/v2/inspector_functional_test.py +++ b/tests/functional/v2/inspector_functional_test.py @@ -160,14 +160,12 @@ def _run_and_get_steps(team_agent, query: str): return response, steps -@pytest.mark.flaky(reruns=2, reruns_delay=2) +@pytest.mark.flaky(reruns=3, reruns_delay=5) def test_output_inspector_abort(client, run_input_map, resource_tracker): timestamp = f"{int(time.time())}_{uuid.uuid4().hex[:6]}" agents = _make_two_subagents(client, timestamp) for agent in agents: resource_tracker.append(agent) - for agent in agents: - resource_tracker.append(agent) inspector = Inspector( name="always_abort_output_inspector", @@ -183,7 +181,6 @@ def test_output_inspector_abort(client, run_input_map, resource_tracker): team_agent = _make_team_agent(client, timestamp, agents, [inspector]) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) team_agent.save() _, steps = _run_and_get_steps(team_agent, "What's the biggest city in the world?") @@ -197,21 +194,19 @@ def test_output_inspector_abort(client, run_input_map, resource_tracker): response_generator_index = steps.index(response_generator_steps[0]) inspector_steps = [s for s in steps[response_generator_index + 1 :] if _is_inspector_step(s)] - assert len(inspector_steps) > 0, "Expected inspector step(s) after response_generator" + assert len(inspector_steps) > 0, "Expected inspector step(s) after response_generator" assert (inspector_steps[-1].get("action") or "").lower() == "abort", ( f"Expected abort, got {inspector_steps[-1].get('action')}" - )+ str(inspector_steps) + ) + str(inspector_steps) -def test_output_inspector_rerun_until_fixed(client, run_input_map, resource_tracker): +@pytest.mark.flaky(reruns=3, reruns_delay=5) def test_output_inspector_rerun_until_fixed(client, run_input_map, resource_tracker): timestamp = f"{int(time.time())}_{uuid.uuid4().hex[:6]}" agents = _make_two_subagents(client, timestamp) for agent in agents: resource_tracker.append(agent) - for agent in agents: - resource_tracker.append(agent) inspector = Inspector( name="rerun_output_inspector", @@ -231,7 +226,6 @@ def test_output_inspector_rerun_until_fixed(client, run_input_map, resource_trac team_agent = _make_team_agent(client, timestamp, agents, [inspector]) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) team_agent.save() response, steps = _run_and_get_steps(team_agent, "Write a short customer service reply.") @@ -250,14 +244,11 @@ def test_output_inspector_rerun_until_fixed(client, run_input_map, resource_trac ) -def test_edit_steps_always_runs(client, run_input_map, resource_tracker): def test_edit_steps_always_runs(client, run_input_map, resource_tracker): timestamp = f"{int(time.time())}_{uuid.uuid4().hex[:6]}" agents = _make_two_subagents(client, timestamp) for agent in agents: resource_tracker.append(agent) - for agent in agents: - resource_tracker.append(agent) inspector = Inspector( name="edit_steps_inspector", @@ -276,7 +267,6 @@ def test_edit_steps_always_runs(client, run_input_map, resource_tracker): team_agent = _make_team_agent(client, timestamp, agents, [inspector]) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) team_agent.save() response, _ = _run_and_get_steps(team_agent, "Translate 'Hello' to Portuguese.") @@ -298,14 +288,11 @@ def edit_fn(text: str) -> str: return "hello, what's the weather in paris like today?" -def test_edit_with_gate_true(client, run_input_map, resource_tracker): def test_edit_with_gate_true(client, run_input_map, resource_tracker): timestamp = f"{int(time.time())}_{uuid.uuid4().hex[:6]}" agents = _make_two_subagents(client, timestamp) for agent in agents: resource_tracker.append(agent) - for agent in agents: - resource_tracker.append(agent) inspector = Inspector( name="gated_edit_true", @@ -324,7 +311,6 @@ def test_edit_with_gate_true(client, run_input_map, resource_tracker): team_agent = _make_team_agent(client, timestamp, agents, [inspector]) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) team_agent.save() response, steps = _run_and_get_steps(team_agent, "DETAILED: Translate 'Hello' to Portuguese.") @@ -341,14 +327,11 @@ def evaluator_fn(text: str) -> bool: return "DETAILED" in text -def test_edit_with_gate_false(client, run_input_map, resource_tracker): def test_edit_with_gate_false(client, run_input_map, resource_tracker): timestamp = f"{int(time.time())}_{uuid.uuid4().hex[:6]}" agents = _make_two_subagents(client, timestamp) for agent in agents: resource_tracker.append(agent) - for agent in agents: - resource_tracker.append(agent) inspector = Inspector( name="gated_edit_false", @@ -367,7 +350,6 @@ def test_edit_with_gate_false(client, run_input_map, resource_tracker): team_agent = _make_team_agent(client, timestamp, agents, [inspector]) resource_tracker.append(team_agent) - resource_tracker.append(team_agent) team_agent.save() response, _ = _run_and_get_steps(team_agent, "Translate 'Hello' to Portuguese.") diff --git a/tests/functional/v2/test_model.py b/tests/functional/v2/test_model.py index 76be25f85..501ae5608 100644 --- a/tests/functional/v2/test_model.py +++ b/tests/functional/v2/test_model.py @@ -305,6 +305,7 @@ def test_llm_capability_properties(client, stream_tool_call_model_id): assert model.supports_structured_output is False +@pytest.mark.flaky(reruns=2, reruns_delay=5) def test_run_stream_tool_calling_e2e(client, stream_tool_call_model_id): """E2E: stream tool-calling returns OpenAI-style tool call deltas in chunks.""" model = client.Model.get(stream_tool_call_model_id) @@ -435,7 +436,6 @@ def test_dynamic_validation_parameter_types(client, text_model_id): valid_params = { "text": "Hello, world!", "language": "en", - "temperature": 0.5, # number "max_tokens": 50, # number "context": "Test context", # text "prompt": "Test prompt", # text @@ -451,13 +451,6 @@ def test_dynamic_validation_parameter_types(client, text_model_id): result = model.run(**available_params) assert result.status == "SUCCESS" - # Test with string values for number parameters (should be valid for text/number) - if any(param.name == "temperature" for param in model.params): - string_params = available_params.copy() - string_params["temperature"] = "0.5" # Should be valid for text/number - result = model.run(**string_params) - assert result.status == "SUCCESS" - # Test with invalid type for text parameter if any(param.name == "text" for param in model.params): invalid_params = available_params.copy() @@ -776,8 +769,6 @@ def test_model_run_with_configured_inputs(client, text_model_id): model = client.Model.get(text_model_id) # Configure parameters through inputs proxy - if "temperature" in model.inputs: - model.inputs.temperature = 0.7 if "max_tokens" in model.inputs: model.inputs.max_tokens = 500 if "language" in model.inputs: @@ -897,8 +888,6 @@ def test_model_inputs_proxy_integration_with_run(client, text_model_id): model = client.Model.get(text_model_id) # Configure some parameters through inputs proxy - if "temperature" in model.inputs: - model.inputs.temperature = 0.6 if "max_tokens" in model.inputs: model.inputs.max_tokens = 400 @@ -929,8 +918,6 @@ def test_model_inputs_proxy_integration_with_run(client, text_model_id): assert result.data is not None # Verify that the configured inputs are still intact after the run - if "temperature" in model.inputs: - assert model.inputs.temperature == 0.6 if "max_tokens" in model.inputs: assert model.inputs.max_tokens == 400 diff --git a/tests/unit/index_model_test.py b/tests/unit/index_model_test.py index f02400ab3..dd05b70bd 100644 --- a/tests/unit/index_model_test.py +++ b/tests/unit/index_model_test.py @@ -187,7 +187,6 @@ def test_validate_record_failure_no_value(mocker): with pytest.raises(Exception) as e: record.validate() assert str(e.value) == "Index Upsert Error: Either value or uri is required for text records" - assert str(e.value) == "Index Upsert Error: Either value or uri is required for text records" def test_record_to_dict(): @@ -238,10 +237,6 @@ def test_index_factory_create_failure(): str(e.value) == "Index Factory Exception: name, description, and embedding_model must be provided when params is not" ) - assert ( - str(e.value) - == "Index Factory Exception: name, description, and embedding_model must be provided when params is not" - ) with pytest.raises(Exception) as e: IndexFactory.create(name="test") @@ -249,10 +244,6 @@ def test_index_factory_create_failure(): str(e.value) == "Index Factory Exception: name, description, and embedding_model must be provided when params is not" ) - assert ( - str(e.value) - == "Index Factory Exception: name, description, and embedding_model must be provided when params is not" - ) with pytest.raises(Exception) as e: IndexFactory.create(name="test", description="test", embedding_model=None) @@ -260,10 +251,6 @@ def test_index_factory_create_failure(): str(e.value) == "Index Factory Exception: name, description, and embedding_model must be provided when params is not" ) - assert ( - str(e.value) - == "Index Factory Exception: name, description, and embedding_model must be provided when params is not" - ) def test_index_model_splitter():