Skip to content
Merged

Main #861

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion aixplain/v1/modules/model/record.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Record module for index operations."""

from aixplain.enums import DataType, StorageType
from typing import Optional
from uuid import uuid4
Expand Down Expand Up @@ -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
4 changes: 0 additions & 4 deletions aixplain/v1/modules/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
25 changes: 25 additions & 0 deletions docs/api-reference/python/aixplain/compat.md
Original file line number Diff line number Diff line change
@@ -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).

1 change: 1 addition & 0 deletions docs/api-reference/python/aixplain/decorators/init.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
draft: true
draft: true
sidebar_label: decorators
title: aixplain.decorators
---
Expand Down
1 change: 1 addition & 0 deletions docs/api-reference/python/aixplain/enums/init.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
draft: true
draft: true
sidebar_label: enums
title: aixplain.enums
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
draft: true
draft: true
sidebar_label: mixins
title: aixplain.factories.model_factory.mixins
---
Expand Down
1 change: 0 additions & 1 deletion docs/api-reference/python/aixplain/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ title: aixplain
---

aiXplain SDK Library.
---

aiXplain SDK enables python programmers to add AI functions
to their software.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
draft: true
draft: true
sidebar_label: designer
title: aixplain.modules.pipeline.designer
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
draft: true
draft: true
sidebar_label: pipeline
title: aixplain.modules.pipeline
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
draft: true
draft: true
sidebar_label: data_onboarding
title: aixplain.processes.data_onboarding
---
Expand Down
1 change: 1 addition & 0 deletions docs/api-reference/python/aixplain/processes/init.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
draft: true
draft: true
sidebar_label: processes
title: aixplain.processes
---
Expand Down
4 changes: 3 additions & 1 deletion docs/api-reference/python/aixplain/utils/llm_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ sidebar_label: llm_utils
title: aixplain.utils.llm_utils
---

Utils for LLM operations.

#### get\_llm\_instance

```python
Expand All @@ -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.

Expand Down
186 changes: 186 additions & 0 deletions docs/api-reference/python/aixplain/v1/base/parameters.md
Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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

6 changes: 6 additions & 0 deletions docs/api-reference/python/aixplain/v1/decorators/init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
draft: true
sidebar_label: decorators
title: aixplain.v1.decorators
---

Loading
Loading