airia 0.1.14__py3-none-any.whl → 0.1.16__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.
@@ -11,6 +11,7 @@ from ..constants import (
11
11
  from ._request_handler import AsyncRequestHandler
12
12
  from .base_client import AiriaBaseClient
13
13
  from .conversations import AsyncConversations
14
+ from .deployments import AsyncDeployments
14
15
  from .pipeline_execution import AsyncPipelineExecution
15
16
  from .pipelines_config import AsyncPipelinesConfig
16
17
  from .project import AsyncProject
@@ -62,6 +63,7 @@ class AiriaAsyncClient(AiriaBaseClient):
62
63
  self.project = AsyncProject(self._request_handler)
63
64
  self.conversations = AsyncConversations(self._request_handler)
64
65
  self.store = AsyncStore(self._request_handler)
66
+ self.deployments = AsyncDeployments(self._request_handler)
65
67
 
66
68
  @classmethod
67
69
  def with_openai_gateway(
@@ -0,0 +1,11 @@
1
+ """
2
+ Deployment management client modules.
3
+
4
+ This module provides synchronous and asynchronous client interfaces for
5
+ deployment-related operations in the Airia platform.
6
+ """
7
+
8
+ from .async_deployments import AsyncDeployments
9
+ from .sync_deployments import Deployments
10
+
11
+ __all__ = ["AsyncDeployments", "Deployments"]
@@ -0,0 +1,112 @@
1
+ from typing import List, Optional
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.deployments import GetDeploymentResponse, GetDeploymentsResponse
5
+ from .._request_handler import AsyncRequestHandler
6
+ from .base_deployments import BaseDeployments
7
+
8
+
9
+ class AsyncDeployments(BaseDeployments):
10
+ def __init__(self, request_handler: AsyncRequestHandler):
11
+ super().__init__(request_handler)
12
+
13
+ async def get_deployments(
14
+ self,
15
+ tags: Optional[List[str]] = None,
16
+ is_recommended: Optional[bool] = None,
17
+ project_id: Optional[str] = None,
18
+ correlation_id: Optional[str] = None,
19
+ api_version: str = ApiVersion.V2.value,
20
+ ) -> GetDeploymentsResponse:
21
+ """
22
+ Retrieve a paged list of deployments asynchronously.
23
+
24
+ This method fetches deployments from the Airia platform with optional filtering
25
+ by tags and recommendation status. The response includes detailed information
26
+ about each deployment including associated pipelines, data sources, and user prompts.
27
+
28
+ Args:
29
+ tags: Optional list of tags to filter deployments by
30
+ is_recommended: Optional filter by recommended status
31
+ project_id: Optional filter by project id
32
+ correlation_id: Optional correlation ID for request tracing
33
+ api_version: API version to use (defaults to V2)
34
+
35
+ Returns:
36
+ GetDeploymentsResponse: Paged response containing deployment items and total count
37
+
38
+ Raises:
39
+ AiriaAPIError: If the API request fails
40
+ ValueError: If an invalid API version is provided
41
+
42
+ Example:
43
+ ```python
44
+ client = AiriaAsyncClient(api_key="your-api-key")
45
+ deployments = await client.deployments.get_deployments(
46
+ tags=["production", "nlp"],
47
+ is_recommended=True
48
+ )
49
+ print(f"Found {deployments.total_count} deployments")
50
+ for deployment in deployments.items:
51
+ print(f"- {deployment.deployment_name}")
52
+ ```
53
+ """
54
+ request_data = self._pre_get_deployments(
55
+ tags=tags,
56
+ is_recommended=is_recommended,
57
+ correlation_id=correlation_id,
58
+ api_version=api_version,
59
+ )
60
+
61
+ response = await self._request_handler.make_request("GET", request_data)
62
+
63
+ if project_id is not None:
64
+ response["items"] = [
65
+ item for item in response["items"] if item["projectId"] == project_id
66
+ ]
67
+
68
+ return GetDeploymentsResponse(**response)
69
+
70
+ async def get_deployment(
71
+ self,
72
+ deployment_id: str,
73
+ correlation_id: Optional[str] = None,
74
+ api_version: str = ApiVersion.V1.value,
75
+ ) -> GetDeploymentResponse:
76
+ """
77
+ Retrieve a single deployment by ID asynchronously.
78
+
79
+ This method fetches a specific deployment from the Airia platform using its
80
+ unique identifier. The response includes complete information about the deployment
81
+ including associated pipelines, data sources, user prompts, and configuration settings.
82
+
83
+ Args:
84
+ deployment_id: The unique identifier of the deployment to retrieve
85
+ correlation_id: Optional correlation ID for request tracing
86
+ api_version: API version to use (defaults to V1)
87
+
88
+ Returns:
89
+ GetDeploymentResponse: Complete deployment information
90
+
91
+ Raises:
92
+ AiriaAPIError: If the API request fails or deployment is not found
93
+ ValueError: If an invalid API version is provided
94
+
95
+ Example:
96
+ ```python
97
+ client = AiriaAsyncClient(api_key="your-api-key")
98
+ deployment = await client.deployments.get_deployment("deployment-id-123")
99
+ print(f"Deployment: {deployment.deployment_name}")
100
+ print(f"Description: {deployment.description}")
101
+ print(f"Project: {deployment.project_id}")
102
+ ```
103
+ """
104
+ request_data = self._pre_get_deployment(
105
+ deployment_id=deployment_id,
106
+ correlation_id=correlation_id,
107
+ api_version=api_version,
108
+ )
109
+
110
+ response = await self._request_handler.make_request("GET", request_data)
111
+
112
+ return GetDeploymentResponse(**response)
@@ -0,0 +1,95 @@
1
+ from typing import List, 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 BaseDeployments:
9
+ def __init__(self, request_handler: Union[RequestHandler, AsyncRequestHandler]):
10
+ self._request_handler = request_handler
11
+
12
+ def _pre_get_deployments(
13
+ self,
14
+ tags: Optional[List[str]] = None,
15
+ is_recommended: Optional[bool] = None,
16
+ correlation_id: Optional[str] = None,
17
+ api_version: str = ApiVersion.V2.value,
18
+ ):
19
+ """
20
+ Prepare request data for retrieving deployments.
21
+
22
+ This internal method constructs the URL and query parameters for deployment
23
+ retrieval requests, including optional filtering by tags and recommendation status.
24
+
25
+ Args:
26
+ tags: Optional list of tags to filter deployments by
27
+ is_recommended: Optional filter by recommended status
28
+ correlation_id: Optional correlation ID for tracing
29
+ api_version: API version to use for the request
30
+
31
+ Returns:
32
+ RequestData: Prepared request data for the deployments endpoint
33
+
34
+ Raises:
35
+ ValueError: If an invalid API version is provided
36
+ """
37
+ if api_version not in ApiVersion.as_list():
38
+ raise ValueError(
39
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
40
+ )
41
+
42
+ url = urljoin(
43
+ self._request_handler.base_url, f"{api_version}/Deployments/paged"
44
+ )
45
+
46
+ # Build query parameters
47
+ params = {}
48
+ if tags is not None:
49
+ params["tags"] = tags
50
+ if is_recommended is not None:
51
+ params["isRecommended"] = is_recommended
52
+
53
+ request_data = self._request_handler.prepare_request(
54
+ url=url, params=params, correlation_id=correlation_id
55
+ )
56
+
57
+ return request_data
58
+
59
+ def _pre_get_deployment(
60
+ self,
61
+ deployment_id: str,
62
+ correlation_id: Optional[str] = None,
63
+ api_version: str = ApiVersion.V1.value,
64
+ ):
65
+ """
66
+ Prepare request data for retrieving a single deployment.
67
+
68
+ This internal method constructs the URL for deployment retrieval
69
+ by ID using the specified API version.
70
+
71
+ Args:
72
+ deployment_id: The unique identifier of the deployment to retrieve
73
+ correlation_id: Optional correlation ID for tracing
74
+ api_version: API version to use for the request
75
+
76
+ Returns:
77
+ RequestData: Prepared request data for the deployment endpoint
78
+
79
+ Raises:
80
+ ValueError: If an invalid API version is provided
81
+ """
82
+ if api_version not in ApiVersion.as_list():
83
+ raise ValueError(
84
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
85
+ )
86
+
87
+ url = urljoin(
88
+ self._request_handler.base_url, f"{api_version}/Deployments/{deployment_id}"
89
+ )
90
+
91
+ request_data = self._request_handler.prepare_request(
92
+ url=url, correlation_id=correlation_id
93
+ )
94
+
95
+ return request_data
@@ -0,0 +1,112 @@
1
+ from typing import List, Optional
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.deployments import GetDeploymentResponse, GetDeploymentsResponse
5
+ from .._request_handler import RequestHandler
6
+ from .base_deployments import BaseDeployments
7
+
8
+
9
+ class Deployments(BaseDeployments):
10
+ def __init__(self, request_handler: RequestHandler):
11
+ super().__init__(request_handler)
12
+
13
+ def get_deployments(
14
+ self,
15
+ tags: Optional[List[str]] = None,
16
+ is_recommended: Optional[bool] = None,
17
+ project_id: Optional[str] = None,
18
+ correlation_id: Optional[str] = None,
19
+ api_version: str = ApiVersion.V2.value,
20
+ ) -> GetDeploymentsResponse:
21
+ """
22
+ Retrieve a paged list of deployments.
23
+
24
+ This method fetches deployments from the Airia platform with optional filtering
25
+ by tags and recommendation status. The response includes detailed information
26
+ about each deployment including associated pipelines, data sources, and user prompts.
27
+
28
+ Args:
29
+ tags: Optional list of tags to filter deployments by
30
+ is_recommended: Optional filter by recommended status
31
+ project_id: Optional filter by project id
32
+ correlation_id: Optional correlation ID for request tracing
33
+ api_version: API version to use (defaults to V2)
34
+
35
+ Returns:
36
+ GetDeploymentsResponse: Paged response containing deployment items and total count
37
+
38
+ Raises:
39
+ AiriaAPIError: If the API request fails
40
+ ValueError: If an invalid API version is provided
41
+
42
+ Example:
43
+ ```python
44
+ client = AiriaClient(api_key="your-api-key")
45
+ deployments = client.deployments.get_deployments(
46
+ tags=["production", "nlp"],
47
+ is_recommended=True
48
+ )
49
+ print(f"Found {deployments.total_count} deployments")
50
+ for deployment in deployments.items:
51
+ print(f"- {deployment.deployment_name}")
52
+ ```
53
+ """
54
+ request_data = self._pre_get_deployments(
55
+ tags=tags,
56
+ is_recommended=is_recommended,
57
+ correlation_id=correlation_id,
58
+ api_version=api_version,
59
+ )
60
+
61
+ response = self._request_handler.make_request("GET", request_data)
62
+
63
+ if project_id is not None:
64
+ response["items"] = [
65
+ item for item in response["items"] if item["projectId"] == project_id
66
+ ]
67
+
68
+ return GetDeploymentsResponse(**response)
69
+
70
+ def get_deployment(
71
+ self,
72
+ deployment_id: str,
73
+ correlation_id: Optional[str] = None,
74
+ api_version: str = ApiVersion.V1.value,
75
+ ) -> GetDeploymentResponse:
76
+ """
77
+ Retrieve a single deployment by ID.
78
+
79
+ This method fetches a specific deployment from the Airia platform using its
80
+ unique identifier. The response includes complete information about the deployment
81
+ including associated pipelines, data sources, user prompts, and configuration settings.
82
+
83
+ Args:
84
+ deployment_id: The unique identifier of the deployment to retrieve
85
+ correlation_id: Optional correlation ID for request tracing
86
+ api_version: API version to use (defaults to V1)
87
+
88
+ Returns:
89
+ GetDeploymentResponse: Complete deployment information
90
+
91
+ Raises:
92
+ AiriaAPIError: If the API request fails or deployment is not found
93
+ ValueError: If an invalid API version is provided
94
+
95
+ Example:
96
+ ```python
97
+ client = AiriaClient(api_key="your-api-key")
98
+ deployment = client.deployments.get_deployment("deployment-id-123")
99
+ print(f"Deployment: {deployment.deployment_name}")
100
+ print(f"Description: {deployment.description}")
101
+ print(f"Project: {deployment.project_id}")
102
+ ```
103
+ """
104
+ request_data = self._pre_get_deployment(
105
+ deployment_id=deployment_id,
106
+ correlation_id=correlation_id,
107
+ api_version=api_version,
108
+ )
109
+
110
+ response = self._request_handler.make_request("GET", request_data)
111
+
112
+ return GetDeploymentResponse(**response)
@@ -1,7 +1,10 @@
1
- from typing import List, Optional
1
+ from typing import Optional
2
2
 
3
3
  from ...types._api_version import ApiVersion
4
- from ...types.api.pipelines_config import GetPipelineConfigResponse
4
+ from ...types.api.pipelines_config import (
5
+ PipelineConfigResponse,
6
+ ExportPipelineDefinitionResponse,
7
+ )
5
8
  from .._request_handler import AsyncRequestHandler
6
9
  from .base_pipelines_config import BasePipelinesConfig
7
10
 
@@ -10,29 +13,28 @@ class AsyncPipelinesConfig(BasePipelinesConfig):
10
13
  def __init__(self, request_handler: AsyncRequestHandler):
11
14
  super().__init__(request_handler)
12
15
 
13
- async def get_active_pipelines_ids(
14
- self, project_id: Optional[str] = None, correlation_id: Optional[str] = None
15
- ) -> List[str]:
16
+ async def get_pipeline_config(
17
+ self, pipeline_id: str, correlation_id: Optional[str] = None
18
+ ) -> PipelineConfigResponse:
16
19
  """
17
- Retrieve a list of active pipeline IDs.
20
+ Retrieve configuration details for a specific pipeline.
18
21
 
19
- This method fetches the IDs of all active pipelines, optionally filtered by project.
20
- Active pipelines are those that are currently deployed and available for execution.
22
+ This method fetches comprehensive information about a pipeline including its
23
+ deployment details, execution statistics, version information, and metadata.
21
24
 
22
25
  Args:
23
- project_id (str, optional): The unique identifier of the project to filter
24
- pipelines by. If not provided, returns active pipelines from all projects
25
- accessible to the authenticated user.
26
+ pipeline_id (str): The unique identifier of the pipeline to retrieve
27
+ configuration for.
26
28
  correlation_id (str, optional): A unique identifier for request tracing
27
29
  and logging. If not provided, one will be automatically generated.
28
30
 
29
31
  Returns:
30
- List[str]: A list of pipeline IDs that are currently active. Returns an
31
- empty list if no active pipelines are found.
32
+ PipelineConfigResponse: A response object containing the pipeline
33
+ configuration.
32
34
 
33
35
  Raises:
34
36
  AiriaAPIError: If the API request fails, including cases where:
35
- - The project_id doesn't exist (404)
37
+ - The pipeline_id doesn't exist (404)
36
38
  - Authentication fails (401)
37
39
  - Access is forbidden (403)
38
40
  - Server errors (5xx)
@@ -43,53 +45,47 @@ class AsyncPipelinesConfig(BasePipelinesConfig):
43
45
 
44
46
  client = AiriaAsyncClient(api_key="your_api_key")
45
47
 
46
- # Get all active pipeline IDs
47
- pipeline_ids = await client.pipelines_config.get_active_pipelines_ids()
48
- print(f"Found {len(pipeline_ids)} active pipelines")
49
-
50
- # Get active pipeline IDs for a specific project
51
- project_pipelines = await client.pipelines_config.get_active_pipelines_ids(
52
- project_id="your_project_id"
48
+ # Get pipeline configuration
49
+ config = await client.pipelines_config.get_pipeline_config(
50
+ pipeline_id="your_pipeline_id"
53
51
  )
54
- print(f"Project has {len(project_pipelines)} active pipelines")
52
+
53
+ print(f"Pipeline: {config.agent.name}")
54
+ print(f"Description: {config.agent.agent_description}")
55
55
  ```
56
56
 
57
57
  Note:
58
- Only pipelines with active versions are returned. Inactive or archived
59
- pipelines are not included in the results.
58
+ This method only retrieves configuration information and does not
59
+ execute the pipeline. Use execute_pipeline() to run the pipeline.
60
60
  """
61
- request_data = self._pre_get_active_pipelines_ids(
62
- project_id=project_id,
61
+ request_data = self._pre_get_pipeline_config(
62
+ pipeline_id=pipeline_id,
63
63
  correlation_id=correlation_id,
64
64
  api_version=ApiVersion.V1.value,
65
65
  )
66
66
  resp = await self._request_handler.make_request("GET", request_data)
67
67
 
68
- if "items" not in resp or len(resp["items"]) == 0:
69
- return []
70
-
71
- pipeline_ids = [r["activeVersion"]["pipelineId"] for r in resp["items"]]
68
+ return PipelineConfigResponse(**resp)
72
69
 
73
- return pipeline_ids
74
-
75
- async def get_pipeline_config(
70
+ async def export_pipeline_definition(
76
71
  self, pipeline_id: str, correlation_id: Optional[str] = None
77
- ) -> GetPipelineConfigResponse:
72
+ ) -> ExportPipelineDefinitionResponse:
78
73
  """
79
- Retrieve configuration details for a specific pipeline.
74
+ Export the complete definition of a pipeline including all its components.
80
75
 
81
- This method fetches comprehensive information about a pipeline including its
82
- deployment details, execution statistics, version information, and metadata.
76
+ This method retrieves a comprehensive export of a pipeline definition including
77
+ metadata, agent configuration, data sources, prompts, tools, models, memories,
78
+ Python code blocks, routers, and deployment information.
83
79
 
84
80
  Args:
85
- pipeline_id (str): The unique identifier of the pipeline to retrieve
86
- configuration for.
81
+ pipeline_id (str): The unique identifier of the pipeline to export
82
+ definition for.
87
83
  correlation_id (str, optional): A unique identifier for request tracing
88
84
  and logging. If not provided, one will be automatically generated.
89
85
 
90
86
  Returns:
91
- GetPipelineConfigResponse: A response object containing the pipeline
92
- configuration.
87
+ ExportPipelineDefinitionResponse: A response object containing the complete
88
+ pipeline definition export.
93
89
 
94
90
  Raises:
95
91
  AiriaAPIError: If the API request fails, including cases where:
@@ -104,24 +100,26 @@ class AsyncPipelinesConfig(BasePipelinesConfig):
104
100
 
105
101
  client = AiriaAsyncClient(api_key="your_api_key")
106
102
 
107
- # Get pipeline configuration
108
- config = await client.pipelines_config.get_pipeline_config(
103
+ # Export pipeline definition
104
+ export = await client.pipelines_config.export_pipeline_definition(
109
105
  pipeline_id="your_pipeline_id"
110
106
  )
111
107
 
112
- print(f"Pipeline: {config.agent.name}")
113
- print(f"Description: {config.agent.agent_description}")
108
+ print(f"Pipeline: {export.agent.name}")
109
+ print(f"Export version: {export.metadata.export_version}")
110
+ print(f"Data sources: {len(export.data_sources or [])}")
111
+ print(f"Tools: {len(export.tools or [])}")
114
112
  ```
115
113
 
116
114
  Note:
117
- This method only retrieves configuration information and does not
118
- execute the pipeline. Use execute_pipeline() to run the pipeline.
115
+ This method exports the complete pipeline definition which can be used
116
+ for backup, version control, or importing into other environments.
119
117
  """
120
- request_data = self._pre_get_pipeline_config(
118
+ request_data = self._pre_export_pipeline_definition(
121
119
  pipeline_id=pipeline_id,
122
120
  correlation_id=correlation_id,
123
121
  api_version=ApiVersion.V1.value,
124
122
  )
125
123
  resp = await self._request_handler.make_request("GET", request_data)
126
124
 
127
- return GetPipelineConfigResponse(**resp)
125
+ return ExportPipelineDefinitionResponse(**resp)
@@ -9,17 +9,17 @@ class BasePipelinesConfig:
9
9
  def __init__(self, request_handler: Union[RequestHandler, AsyncRequestHandler]):
10
10
  self._request_handler = request_handler
11
11
 
12
- def _pre_get_active_pipelines_ids(
12
+ def _pre_get_pipeline_config(
13
13
  self,
14
- project_id: Optional[str] = None,
14
+ pipeline_id: str,
15
15
  correlation_id: Optional[str] = None,
16
16
  api_version: str = ApiVersion.V1.value,
17
17
  ):
18
18
  """
19
- Prepare request data for getting active pipelines IDs.
19
+ Prepare request data for getting pipeline configuration endpoint.
20
20
 
21
21
  Args:
22
- project_id: ID of the project to get configuration for
22
+ pipeline_id: ID of the pipeline to get configuration for
23
23
  correlation_id: Optional correlation ID for tracing
24
24
  api_version: API version to use for the request
25
25
 
@@ -33,30 +33,32 @@ class BasePipelinesConfig:
33
33
  raise ValueError(
34
34
  f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
35
35
  )
36
- url = urljoin(self._request_handler.base_url, f"{api_version}/PipelinesConfig")
37
- params = {"projectId": project_id} if project_id is not None else None
36
+ url = urljoin(
37
+ self._request_handler.base_url,
38
+ f"{api_version}/PipelinesConfig/{pipeline_id}",
39
+ )
38
40
  request_data = self._request_handler.prepare_request(
39
- url, params=params, correlation_id=correlation_id
41
+ url, correlation_id=correlation_id
40
42
  )
41
43
 
42
44
  return request_data
43
45
 
44
- def _pre_get_pipeline_config(
46
+ def _pre_export_pipeline_definition(
45
47
  self,
46
48
  pipeline_id: str,
47
49
  correlation_id: Optional[str] = None,
48
50
  api_version: str = ApiVersion.V1.value,
49
51
  ):
50
52
  """
51
- Prepare request data for getting pipeline configuration endpoint.
53
+ Prepare request data for exporting pipeline definition endpoint.
52
54
 
53
55
  Args:
54
- pipeline_id: ID of the pipeline to get configuration for
56
+ pipeline_id: ID of the pipeline to export definition for
55
57
  correlation_id: Optional correlation ID for tracing
56
58
  api_version: API version to use for the request
57
59
 
58
60
  Returns:
59
- RequestData: Prepared request data for the pipeline config endpoint
61
+ RequestData: Prepared request data for the export pipeline definition endpoint
60
62
 
61
63
  Raises:
62
64
  ValueError: If an invalid API version is provided