airia 0.1.25__py3-none-any.whl → 0.1.27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airia/client/_request_handler/async_request_handler.py +29 -8
- airia/client/_request_handler/sync_request_handler.py +25 -8
- airia/client/async_client.py +6 -0
- airia/client/models/__init__.py +4 -0
- airia/client/models/async_models.py +96 -0
- airia/client/models/base_models.py +68 -0
- airia/client/models/sync_models.py +96 -0
- airia/client/pipeline_execution/async_pipeline_execution.py +3 -3
- airia/client/pipeline_execution/base_pipeline_execution.py +1 -1
- airia/client/pipeline_execution/sync_pipeline_execution.py +3 -3
- airia/client/pipeline_import/__init__.py +4 -0
- airia/client/pipeline_import/async_pipeline_import.py +147 -0
- airia/client/pipeline_import/base_pipeline_import.py +95 -0
- airia/client/pipeline_import/sync_pipeline_import.py +143 -0
- airia/client/pipelines_config/async_pipelines_config.py +50 -0
- airia/client/pipelines_config/base_pipelines_config.py +37 -0
- airia/client/pipelines_config/sync_pipelines_config.py +50 -0
- airia/client/sync_client.py +6 -0
- airia/client/tools/__init__.py +4 -0
- airia/client/tools/async_tools.py +259 -0
- airia/client/tools/base_tools.py +153 -0
- airia/client/tools/sync_tools.py +245 -0
- airia/exceptions.py +4 -3
- airia/types/api/__init__.py +3 -0
- airia/types/api/models/__init__.py +13 -0
- airia/types/api/models/list_models.py +129 -0
- airia/types/api/pipeline_import/__init__.py +11 -0
- airia/types/api/pipeline_import/create_agent_from_pipeline_definition.py +108 -0
- airia/types/api/tools/__init__.py +7 -0
- airia/types/api/tools/_tools.py +223 -0
- {airia-0.1.25.dist-info → airia-0.1.27.dist-info}/METADATA +1 -1
- {airia-0.1.25.dist-info → airia-0.1.27.dist-info}/RECORD +35 -17
- {airia-0.1.25.dist-info → airia-0.1.27.dist-info}/WHEEL +0 -0
- {airia-0.1.25.dist-info → airia-0.1.27.dist-info}/licenses/LICENSE +0 -0
- {airia-0.1.25.dist-info → airia-0.1.27.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
from typing import Any, Dict, Literal, Optional
|
|
2
|
+
|
|
3
|
+
from ...types._api_version import ApiVersion
|
|
4
|
+
from ...types.api.pipeline_import import CreateAgentFromPipelineDefinitionResponse
|
|
5
|
+
from .._request_handler import AsyncRequestHandler
|
|
6
|
+
from .base_pipeline_import import BasePipelineImport
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AsyncPipelineImport(BasePipelineImport):
|
|
10
|
+
def __init__(self, request_handler: AsyncRequestHandler):
|
|
11
|
+
super().__init__(request_handler)
|
|
12
|
+
|
|
13
|
+
async def create_agent_from_pipeline_definition(
|
|
14
|
+
self,
|
|
15
|
+
pipeline_definition: Dict[str, Any],
|
|
16
|
+
agent_import_source: Optional[
|
|
17
|
+
Literal[
|
|
18
|
+
"PlatformApi",
|
|
19
|
+
"ChatCommunity",
|
|
20
|
+
"PlatformCommunity",
|
|
21
|
+
"PlatformJson",
|
|
22
|
+
"Marketplace",
|
|
23
|
+
]
|
|
24
|
+
] = None,
|
|
25
|
+
conflict_resolution_strategy: Literal[
|
|
26
|
+
"SkipConflictingEntities",
|
|
27
|
+
"RecreateExistingEntities",
|
|
28
|
+
"SeededAgent",
|
|
29
|
+
] = "SkipConflictingEntities",
|
|
30
|
+
credential_mappings: Optional[Dict[str, str]] = None,
|
|
31
|
+
default_project_behavior: Optional[
|
|
32
|
+
Literal["Library", "BrainFreezeThenDefault", "DefaultProject"]
|
|
33
|
+
] = None,
|
|
34
|
+
project_id: Optional[str] = None,
|
|
35
|
+
correlation_id: Optional[str] = None,
|
|
36
|
+
) -> CreateAgentFromPipelineDefinitionResponse:
|
|
37
|
+
"""
|
|
38
|
+
Create an agent from a pipeline definition (async).
|
|
39
|
+
|
|
40
|
+
This method imports a complete pipeline from a definition dictionary,
|
|
41
|
+
creating all necessary components including data sources, prompts, tools,
|
|
42
|
+
models, and pipeline steps. The definition structure should match the
|
|
43
|
+
format returned by export_pipeline_definition(), but use JSON-compatible
|
|
44
|
+
types (no enums or Pydantic classes).
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
pipeline_definition (dict): The pipeline definition to import. This should
|
|
48
|
+
be a dictionary with the same structure as the response from
|
|
49
|
+
pipelines_config.export_pipeline_definition(), but using only
|
|
50
|
+
JSON-compatible types (strings, numbers, dicts, lists).
|
|
51
|
+
agent_import_source (str, optional): The source of the agent import.
|
|
52
|
+
Valid values: "PlatformApi", "ChatCommunity", "PlatformCommunity",
|
|
53
|
+
"PlatformJson", "Marketplace". If not provided, the import source
|
|
54
|
+
will not be specified.
|
|
55
|
+
conflict_resolution_strategy (str): Strategy for handling conflicting entities.
|
|
56
|
+
Valid values:
|
|
57
|
+
- "SkipConflictingEntities" (default): Skip entities that already exist
|
|
58
|
+
- "RecreateExistingEntities": Recreate entities that already exist
|
|
59
|
+
- "SeededAgent": Use seeded agent strategy
|
|
60
|
+
credential_mappings (dict, optional): Mapping of exported credential IDs
|
|
61
|
+
to existing credential GUIDs in the database. Key: Exported credential
|
|
62
|
+
ID from agent definition. Value: Existing credential GUID in database
|
|
63
|
+
(must belong to tenant/project).
|
|
64
|
+
default_project_behavior (str, optional): The default project behavior
|
|
65
|
+
if project_id is null. Valid values: "Library", "BrainFreezeThenDefault",
|
|
66
|
+
"DefaultProject".
|
|
67
|
+
project_id (str, optional): The project ID where the pipeline should be
|
|
68
|
+
imported. If null, the provision will happen in a library project
|
|
69
|
+
according to default_project_behavior.
|
|
70
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
71
|
+
and logging. If not provided, one will be automatically generated.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
CreateAgentFromPipelineDefinitionResponse: A response object containing the
|
|
75
|
+
import result, including pipeline ID, department ID, pipeline name,
|
|
76
|
+
deployment ID (if deployed), and lists of created, updated, and
|
|
77
|
+
skipped entities. If the import failed, error_message and error_details
|
|
78
|
+
will contain information about what went wrong.
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
82
|
+
- The pipeline definition is invalid (400)
|
|
83
|
+
- A referenced project_id doesn't exist (404)
|
|
84
|
+
- Credential mappings are invalid (400)
|
|
85
|
+
- Authentication fails (401)
|
|
86
|
+
- Access is forbidden (403)
|
|
87
|
+
- Server errors (5xx)
|
|
88
|
+
|
|
89
|
+
Example:
|
|
90
|
+
```python
|
|
91
|
+
from airia import AiriaAsyncClient
|
|
92
|
+
import asyncio
|
|
93
|
+
|
|
94
|
+
async def main():
|
|
95
|
+
client = AiriaAsyncClient(api_key="your_api_key")
|
|
96
|
+
|
|
97
|
+
# First, export a pipeline definition
|
|
98
|
+
exported = await client.pipelines_config.export_pipeline_definition(
|
|
99
|
+
pipeline_id="source_pipeline_id"
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
# Convert the exported definition to a JSON-compatible dictionary
|
|
103
|
+
# (Pydantic models have a .model_dump() method for this)
|
|
104
|
+
pipeline_def = exported.model_dump(by_alias=True, exclude_none=True)
|
|
105
|
+
|
|
106
|
+
# Import the pipeline into a new project
|
|
107
|
+
result = await client.pipeline_import.create_agent_from_pipeline_definition(
|
|
108
|
+
pipeline_definition=pipeline_def,
|
|
109
|
+
project_id="target_project_id",
|
|
110
|
+
conflict_resolution_strategy="SkipConflictingEntities"
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
if result.error_message:
|
|
114
|
+
print(f"Import failed: {result.error_message}")
|
|
115
|
+
if result.error_details:
|
|
116
|
+
for detail in result.error_details:
|
|
117
|
+
print(f" - {detail}")
|
|
118
|
+
else:
|
|
119
|
+
print(f"Pipeline imported successfully!")
|
|
120
|
+
print(f"Pipeline ID: {result.pipeline_id}")
|
|
121
|
+
print(f"Pipeline Name: {result.pipeline_name}")
|
|
122
|
+
print(f"Created {len(result.created_entities or [])} entities")
|
|
123
|
+
print(f"Updated {len(result.updated_entities or [])} entities")
|
|
124
|
+
print(f"Skipped {len(result.skipped_entities or [])} entities")
|
|
125
|
+
|
|
126
|
+
asyncio.run(main())
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Note:
|
|
130
|
+
- The pipeline_definition must use JSON-compatible types only
|
|
131
|
+
- Use model_dump(by_alias=True) on Pydantic models to get the correct format
|
|
132
|
+
- Credential mappings must reference existing credentials in the target system
|
|
133
|
+
- The import process will create new GUIDs for most entities
|
|
134
|
+
"""
|
|
135
|
+
request_data = self._pre_create_agent_from_pipeline_definition(
|
|
136
|
+
pipeline_definition=pipeline_definition,
|
|
137
|
+
agent_import_source=agent_import_source,
|
|
138
|
+
conflict_resolution_strategy=conflict_resolution_strategy,
|
|
139
|
+
credential_mappings=credential_mappings,
|
|
140
|
+
default_project_behavior=default_project_behavior,
|
|
141
|
+
project_id=project_id,
|
|
142
|
+
correlation_id=correlation_id,
|
|
143
|
+
api_version=ApiVersion.V1.value,
|
|
144
|
+
)
|
|
145
|
+
resp = await self._request_handler.make_request("POST", request_data)
|
|
146
|
+
|
|
147
|
+
return CreateAgentFromPipelineDefinitionResponse(**resp)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
from typing import Any, Dict, Literal, Optional, Union
|
|
2
|
+
from urllib.parse import urljoin
|
|
3
|
+
|
|
4
|
+
from ...types._api_version import ApiVersion
|
|
5
|
+
from .._request_handler import AsyncRequestHandler, RequestHandler
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class BasePipelineImport:
|
|
9
|
+
def __init__(self, request_handler: Union[RequestHandler, AsyncRequestHandler]):
|
|
10
|
+
self._request_handler = request_handler
|
|
11
|
+
|
|
12
|
+
def _pre_create_agent_from_pipeline_definition(
|
|
13
|
+
self,
|
|
14
|
+
pipeline_definition: Dict[str, Any],
|
|
15
|
+
agent_import_source: Optional[
|
|
16
|
+
Literal[
|
|
17
|
+
"PlatformApi",
|
|
18
|
+
"ChatCommunity",
|
|
19
|
+
"PlatformCommunity",
|
|
20
|
+
"PlatformJson",
|
|
21
|
+
"Marketplace",
|
|
22
|
+
]
|
|
23
|
+
] = None,
|
|
24
|
+
conflict_resolution_strategy: Literal[
|
|
25
|
+
"SkipConflictingEntities",
|
|
26
|
+
"RecreateExistingEntities",
|
|
27
|
+
"SeededAgent",
|
|
28
|
+
] = "SkipConflictingEntities",
|
|
29
|
+
credential_mappings: Optional[Dict[str, str]] = None,
|
|
30
|
+
default_project_behavior: Optional[
|
|
31
|
+
Literal["Library", "BrainFreezeThenDefault", "DefaultProject"]
|
|
32
|
+
] = None,
|
|
33
|
+
project_id: Optional[str] = None,
|
|
34
|
+
correlation_id: Optional[str] = None,
|
|
35
|
+
api_version: str = ApiVersion.V1.value,
|
|
36
|
+
):
|
|
37
|
+
"""
|
|
38
|
+
Prepare request data for creating an agent from a pipeline definition.
|
|
39
|
+
|
|
40
|
+
This internal method constructs the URL and payload for importing
|
|
41
|
+
a pipeline from a definition.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
pipeline_definition: The pipeline definition to import (dictionary structure
|
|
45
|
+
matching ExportPipelineDefinitionResponse format, but using JSON-compatible types)
|
|
46
|
+
agent_import_source: The source of the agent import (PlatformApi, ChatCommunity,
|
|
47
|
+
PlatformCommunity, PlatformJson, or Marketplace)
|
|
48
|
+
conflict_resolution_strategy: Strategy for handling conflicting entities
|
|
49
|
+
(SkipConflictingEntities, RecreateExistingEntities, or SeededAgent)
|
|
50
|
+
credential_mappings: Optional mapping of exported credential IDs to existing
|
|
51
|
+
credential GUIDs in the database
|
|
52
|
+
default_project_behavior: The default project behavior if project_id is null
|
|
53
|
+
(Library, BrainFreezeThenDefault, or DefaultProject)
|
|
54
|
+
project_id: Optional project ID. If null, provision happens in a library project
|
|
55
|
+
correlation_id: Optional correlation ID for tracing
|
|
56
|
+
api_version: API version to use for the request
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
RequestData: Prepared request data for the pipeline import endpoint
|
|
60
|
+
|
|
61
|
+
Raises:
|
|
62
|
+
ValueError: If an invalid API version is provided
|
|
63
|
+
"""
|
|
64
|
+
if api_version not in ApiVersion.as_list():
|
|
65
|
+
raise ValueError(
|
|
66
|
+
f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
|
|
67
|
+
)
|
|
68
|
+
url = urljoin(
|
|
69
|
+
self._request_handler.base_url,
|
|
70
|
+
f"{api_version}/PipelineImport/definition",
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
payload = {
|
|
74
|
+
"pipelineDefinition": pipeline_definition,
|
|
75
|
+
"conflictResolutionStrategy": conflict_resolution_strategy,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# Add optional fields only if they are not None
|
|
79
|
+
if agent_import_source is not None:
|
|
80
|
+
payload["agentImportSource"] = agent_import_source
|
|
81
|
+
|
|
82
|
+
if credential_mappings is not None:
|
|
83
|
+
payload["credentialMappings"] = credential_mappings
|
|
84
|
+
|
|
85
|
+
if default_project_behavior is not None:
|
|
86
|
+
payload["defaultProjectBehavior"] = default_project_behavior
|
|
87
|
+
|
|
88
|
+
if project_id is not None:
|
|
89
|
+
payload["projectId"] = project_id
|
|
90
|
+
|
|
91
|
+
request_data = self._request_handler.prepare_request(
|
|
92
|
+
url=url, payload=payload, correlation_id=correlation_id
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return request_data
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
from typing import Any, Dict, Literal, Optional
|
|
2
|
+
|
|
3
|
+
from ...types._api_version import ApiVersion
|
|
4
|
+
from ...types.api.pipeline_import import CreateAgentFromPipelineDefinitionResponse
|
|
5
|
+
from .._request_handler import RequestHandler
|
|
6
|
+
from .base_pipeline_import import BasePipelineImport
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PipelineImport(BasePipelineImport):
|
|
10
|
+
def __init__(self, request_handler: RequestHandler):
|
|
11
|
+
super().__init__(request_handler)
|
|
12
|
+
|
|
13
|
+
def create_agent_from_pipeline_definition(
|
|
14
|
+
self,
|
|
15
|
+
pipeline_definition: Dict[str, Any],
|
|
16
|
+
agent_import_source: Optional[
|
|
17
|
+
Literal[
|
|
18
|
+
"PlatformApi",
|
|
19
|
+
"ChatCommunity",
|
|
20
|
+
"PlatformCommunity",
|
|
21
|
+
"PlatformJson",
|
|
22
|
+
"Marketplace",
|
|
23
|
+
]
|
|
24
|
+
] = None,
|
|
25
|
+
conflict_resolution_strategy: Literal[
|
|
26
|
+
"SkipConflictingEntities",
|
|
27
|
+
"RecreateExistingEntities",
|
|
28
|
+
"SeededAgent",
|
|
29
|
+
] = "SkipConflictingEntities",
|
|
30
|
+
credential_mappings: Optional[Dict[str, str]] = None,
|
|
31
|
+
default_project_behavior: Optional[
|
|
32
|
+
Literal["Library", "BrainFreezeThenDefault", "DefaultProject"]
|
|
33
|
+
] = None,
|
|
34
|
+
project_id: Optional[str] = None,
|
|
35
|
+
correlation_id: Optional[str] = None,
|
|
36
|
+
) -> CreateAgentFromPipelineDefinitionResponse:
|
|
37
|
+
"""
|
|
38
|
+
Create an agent from a pipeline definition.
|
|
39
|
+
|
|
40
|
+
This method imports a complete pipeline from a definition dictionary,
|
|
41
|
+
creating all necessary components including data sources, prompts, tools,
|
|
42
|
+
models, and pipeline steps. The definition structure should match the
|
|
43
|
+
format returned by export_pipeline_definition(), but use JSON-compatible
|
|
44
|
+
types (no enums or Pydantic classes).
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
pipeline_definition (dict): The pipeline definition to import. This should
|
|
48
|
+
be a dictionary with the same structure as the response from
|
|
49
|
+
pipelines_config.export_pipeline_definition(), but using only
|
|
50
|
+
JSON-compatible types (strings, numbers, dicts, lists).
|
|
51
|
+
agent_import_source (str, optional): The source of the agent import.
|
|
52
|
+
Valid values: "PlatformApi", "ChatCommunity", "PlatformCommunity",
|
|
53
|
+
"PlatformJson", "Marketplace". If not provided, the import source
|
|
54
|
+
will not be specified.
|
|
55
|
+
conflict_resolution_strategy (str): Strategy for handling conflicting entities.
|
|
56
|
+
Valid values:
|
|
57
|
+
- "SkipConflictingEntities" (default): Skip entities that already exist
|
|
58
|
+
- "RecreateExistingEntities": Recreate entities that already exist
|
|
59
|
+
- "SeededAgent": Use seeded agent strategy
|
|
60
|
+
credential_mappings (dict, optional): Mapping of exported credential IDs
|
|
61
|
+
to existing credential GUIDs in the database. Key: Exported credential
|
|
62
|
+
ID from agent definition. Value: Existing credential GUID in database
|
|
63
|
+
(must belong to tenant/project).
|
|
64
|
+
default_project_behavior (str, optional): The default project behavior
|
|
65
|
+
if project_id is null. Valid values: "Library", "BrainFreezeThenDefault",
|
|
66
|
+
"DefaultProject".
|
|
67
|
+
project_id (str, optional): The project ID where the pipeline should be
|
|
68
|
+
imported. If null, the provision will happen in a library project
|
|
69
|
+
according to default_project_behavior.
|
|
70
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
71
|
+
and logging. If not provided, one will be automatically generated.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
CreateAgentFromPipelineDefinitionResponse: A response object containing the
|
|
75
|
+
import result, including pipeline ID, department ID, pipeline name,
|
|
76
|
+
deployment ID (if deployed), and lists of created, updated, and
|
|
77
|
+
skipped entities. If the import failed, error_message and error_details
|
|
78
|
+
will contain information about what went wrong.
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
82
|
+
- The pipeline definition is invalid (400)
|
|
83
|
+
- A referenced project_id doesn't exist (404)
|
|
84
|
+
- Credential mappings are invalid (400)
|
|
85
|
+
- Authentication fails (401)
|
|
86
|
+
- Access is forbidden (403)
|
|
87
|
+
- Server errors (5xx)
|
|
88
|
+
|
|
89
|
+
Example:
|
|
90
|
+
```python
|
|
91
|
+
from airia import AiriaClient
|
|
92
|
+
|
|
93
|
+
client = AiriaClient(api_key="your_api_key")
|
|
94
|
+
|
|
95
|
+
# First, export a pipeline definition
|
|
96
|
+
exported = client.pipelines_config.export_pipeline_definition(
|
|
97
|
+
pipeline_id="source_pipeline_id"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# Convert the exported definition to a JSON-compatible dictionary
|
|
101
|
+
# (Pydantic models have a .model_dump() method for this)
|
|
102
|
+
pipeline_def = exported.model_dump(by_alias=True, exclude_none=True)
|
|
103
|
+
|
|
104
|
+
# Import the pipeline into a new project
|
|
105
|
+
result = client.pipeline_import.create_agent_from_pipeline_definition(
|
|
106
|
+
pipeline_definition=pipeline_def,
|
|
107
|
+
project_id="target_project_id",
|
|
108
|
+
conflict_resolution_strategy="SkipConflictingEntities"
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
if result.error_message:
|
|
112
|
+
print(f"Import failed: {result.error_message}")
|
|
113
|
+
if result.error_details:
|
|
114
|
+
for detail in result.error_details:
|
|
115
|
+
print(f" - {detail}")
|
|
116
|
+
else:
|
|
117
|
+
print(f"Pipeline imported successfully!")
|
|
118
|
+
print(f"Pipeline ID: {result.pipeline_id}")
|
|
119
|
+
print(f"Pipeline Name: {result.pipeline_name}")
|
|
120
|
+
print(f"Created {len(result.created_entities or [])} entities")
|
|
121
|
+
print(f"Updated {len(result.updated_entities or [])} entities")
|
|
122
|
+
print(f"Skipped {len(result.skipped_entities or [])} entities")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Note:
|
|
126
|
+
- The pipeline_definition must use JSON-compatible types only
|
|
127
|
+
- Use model_dump(by_alias=True) on Pydantic models to get the correct format
|
|
128
|
+
- Credential mappings must reference existing credentials in the target system
|
|
129
|
+
- The import process will create new GUIDs for most entities
|
|
130
|
+
"""
|
|
131
|
+
request_data = self._pre_create_agent_from_pipeline_definition(
|
|
132
|
+
pipeline_definition=pipeline_definition,
|
|
133
|
+
agent_import_source=agent_import_source,
|
|
134
|
+
conflict_resolution_strategy=conflict_resolution_strategy,
|
|
135
|
+
credential_mappings=credential_mappings,
|
|
136
|
+
default_project_behavior=default_project_behavior,
|
|
137
|
+
project_id=project_id,
|
|
138
|
+
correlation_id=correlation_id,
|
|
139
|
+
api_version=ApiVersion.V1.value,
|
|
140
|
+
)
|
|
141
|
+
resp = self._request_handler.make_request("POST", request_data)
|
|
142
|
+
|
|
143
|
+
return CreateAgentFromPipelineDefinitionResponse(**resp)
|
|
@@ -188,3 +188,53 @@ class AsyncPipelinesConfig(BasePipelinesConfig):
|
|
|
188
188
|
resp = await self._request_handler.make_request("GET", request_data)
|
|
189
189
|
|
|
190
190
|
return GetPipelinesConfigResponse(**resp)
|
|
191
|
+
|
|
192
|
+
async def delete_pipeline(
|
|
193
|
+
self,
|
|
194
|
+
pipeline_id: str,
|
|
195
|
+
correlation_id: Optional[str] = None,
|
|
196
|
+
) -> None:
|
|
197
|
+
"""
|
|
198
|
+
Delete a pipeline by its ID.
|
|
199
|
+
|
|
200
|
+
This method permanently removes a pipeline and all its configuration
|
|
201
|
+
from the Airia platform. This action cannot be undone.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
pipeline_id (str): The unique identifier of the pipeline to delete.
|
|
205
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
206
|
+
and logging. If not provided, one will be automatically generated.
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
None: This method returns nothing upon successful deletion (204 No Content).
|
|
210
|
+
|
|
211
|
+
Raises:
|
|
212
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
213
|
+
- The pipeline_id doesn't exist (404)
|
|
214
|
+
- Authentication fails (401)
|
|
215
|
+
- Access is forbidden (403)
|
|
216
|
+
- Server errors (5xx)
|
|
217
|
+
|
|
218
|
+
Example:
|
|
219
|
+
```python
|
|
220
|
+
from airia import AiriaAsyncClient
|
|
221
|
+
|
|
222
|
+
client = AiriaAsyncClient(api_key="your_api_key")
|
|
223
|
+
|
|
224
|
+
# Delete a pipeline
|
|
225
|
+
await client.pipelines_config.delete_pipeline(
|
|
226
|
+
pipeline_id="your_pipeline_id"
|
|
227
|
+
)
|
|
228
|
+
print("Pipeline deleted successfully")
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Warning:
|
|
232
|
+
This operation is permanent and cannot be reversed. Ensure you have
|
|
233
|
+
the correct pipeline_id before calling this method.
|
|
234
|
+
"""
|
|
235
|
+
request_data = self._pre_delete_pipeline(
|
|
236
|
+
pipeline_id=pipeline_id,
|
|
237
|
+
correlation_id=correlation_id,
|
|
238
|
+
api_version=ApiVersion.V1.value,
|
|
239
|
+
)
|
|
240
|
+
await self._request_handler.make_request("DELETE", request_data, return_json=False)
|
|
@@ -114,3 +114,40 @@ class BasePipelinesConfig:
|
|
|
114
114
|
)
|
|
115
115
|
|
|
116
116
|
return request_data
|
|
117
|
+
|
|
118
|
+
def _pre_delete_pipeline(
|
|
119
|
+
self,
|
|
120
|
+
pipeline_id: str,
|
|
121
|
+
correlation_id: Optional[str] = None,
|
|
122
|
+
api_version: str = ApiVersion.V1.value,
|
|
123
|
+
):
|
|
124
|
+
"""
|
|
125
|
+
Prepare request data for deleting a pipeline by ID.
|
|
126
|
+
|
|
127
|
+
This internal method constructs the URL for pipeline deletion
|
|
128
|
+
requests using the provided pipeline identifier.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
pipeline_id: ID of the pipeline to delete
|
|
132
|
+
correlation_id: Optional correlation ID for tracing
|
|
133
|
+
api_version: API version to use for the request
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
RequestData: Prepared request data for the pipeline deletion endpoint
|
|
137
|
+
|
|
138
|
+
Raises:
|
|
139
|
+
ValueError: If an invalid API version is provided
|
|
140
|
+
"""
|
|
141
|
+
if api_version not in ApiVersion.as_list():
|
|
142
|
+
raise ValueError(
|
|
143
|
+
f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
|
|
144
|
+
)
|
|
145
|
+
url = urljoin(
|
|
146
|
+
self._request_handler.base_url,
|
|
147
|
+
f"{api_version}/PipelinesConfig/{pipeline_id}",
|
|
148
|
+
)
|
|
149
|
+
request_data = self._request_handler.prepare_request(
|
|
150
|
+
url, correlation_id=correlation_id
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
return request_data
|
|
@@ -188,3 +188,53 @@ class PipelinesConfig(BasePipelinesConfig):
|
|
|
188
188
|
resp = self._request_handler.make_request("GET", request_data)
|
|
189
189
|
|
|
190
190
|
return GetPipelinesConfigResponse(**resp)
|
|
191
|
+
|
|
192
|
+
def delete_pipeline(
|
|
193
|
+
self,
|
|
194
|
+
pipeline_id: str,
|
|
195
|
+
correlation_id: Optional[str] = None,
|
|
196
|
+
) -> None:
|
|
197
|
+
"""
|
|
198
|
+
Delete a pipeline by its ID.
|
|
199
|
+
|
|
200
|
+
This method permanently removes a pipeline and all its configuration
|
|
201
|
+
from the Airia platform. This action cannot be undone.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
pipeline_id (str): The unique identifier of the pipeline to delete.
|
|
205
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
206
|
+
and logging. If not provided, one will be automatically generated.
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
None: This method returns nothing upon successful deletion (204 No Content).
|
|
210
|
+
|
|
211
|
+
Raises:
|
|
212
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
213
|
+
- The pipeline_id doesn't exist (404)
|
|
214
|
+
- Authentication fails (401)
|
|
215
|
+
- Access is forbidden (403)
|
|
216
|
+
- Server errors (5xx)
|
|
217
|
+
|
|
218
|
+
Example:
|
|
219
|
+
```python
|
|
220
|
+
from airia import AiriaClient
|
|
221
|
+
|
|
222
|
+
client = AiriaClient(api_key="your_api_key")
|
|
223
|
+
|
|
224
|
+
# Delete a pipeline
|
|
225
|
+
client.pipelines_config.delete_pipeline(
|
|
226
|
+
pipeline_id="your_pipeline_id"
|
|
227
|
+
)
|
|
228
|
+
print("Pipeline deleted successfully")
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Warning:
|
|
232
|
+
This operation is permanent and cannot be reversed. Ensure you have
|
|
233
|
+
the correct pipeline_id before calling this method.
|
|
234
|
+
"""
|
|
235
|
+
request_data = self._pre_delete_pipeline(
|
|
236
|
+
pipeline_id=pipeline_id,
|
|
237
|
+
correlation_id=correlation_id,
|
|
238
|
+
api_version=ApiVersion.V1.value,
|
|
239
|
+
)
|
|
240
|
+
self._request_handler.make_request("DELETE", request_data, return_json=False)
|
airia/client/sync_client.py
CHANGED
|
@@ -15,10 +15,13 @@ from .conversations import Conversations
|
|
|
15
15
|
from .data_vector_search import DataVectorSearch
|
|
16
16
|
from .deployments import Deployments
|
|
17
17
|
from .library import Library
|
|
18
|
+
from .models import Models
|
|
18
19
|
from .pipeline_execution import PipelineExecution
|
|
20
|
+
from .pipeline_import import PipelineImport
|
|
19
21
|
from .pipelines_config import PipelinesConfig
|
|
20
22
|
from .project import Project
|
|
21
23
|
from .store import Store
|
|
24
|
+
from .tools import Tools
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
class AiriaClient(AiriaBaseClient):
|
|
@@ -63,6 +66,7 @@ class AiriaClient(AiriaBaseClient):
|
|
|
63
66
|
)
|
|
64
67
|
self.attachments = Attachments(self._request_handler)
|
|
65
68
|
self.pipeline_execution = PipelineExecution(self._request_handler)
|
|
69
|
+
self.pipeline_import = PipelineImport(self._request_handler)
|
|
66
70
|
self.pipelines_config = PipelinesConfig(self._request_handler)
|
|
67
71
|
self.project = Project(self._request_handler)
|
|
68
72
|
self.conversations = Conversations(self._request_handler)
|
|
@@ -70,6 +74,8 @@ class AiriaClient(AiriaBaseClient):
|
|
|
70
74
|
self.deployments = Deployments(self._request_handler)
|
|
71
75
|
self.data_vector_search = DataVectorSearch(self._request_handler)
|
|
72
76
|
self.library = Library(self._request_handler)
|
|
77
|
+
self.models = Models(self._request_handler)
|
|
78
|
+
self.tools = Tools(self._request_handler)
|
|
73
79
|
|
|
74
80
|
@classmethod
|
|
75
81
|
def with_openai_gateway(
|