airia 0.1.13__py3-none-any.whl → 0.1.15__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.
Files changed (60) hide show
  1. airia/client/_request_handler/__init__.py +4 -0
  2. airia/client/_request_handler/async_request_handler.py +272 -0
  3. airia/client/_request_handler/base_request_handler.py +108 -0
  4. airia/client/_request_handler/sync_request_handler.py +255 -0
  5. airia/client/async_client.py +27 -678
  6. airia/client/base_client.py +2 -368
  7. airia/client/conversations/__init__.py +4 -0
  8. airia/client/conversations/async_conversations.py +187 -0
  9. airia/client/conversations/base_conversations.py +135 -0
  10. airia/client/conversations/sync_conversations.py +182 -0
  11. airia/client/deployments/__init__.py +11 -0
  12. airia/client/deployments/async_deployments.py +112 -0
  13. airia/client/deployments/base_deployments.py +95 -0
  14. airia/client/deployments/sync_deployments.py +112 -0
  15. airia/client/pipeline_execution/__init__.py +4 -0
  16. airia/client/pipeline_execution/async_pipeline_execution.py +178 -0
  17. airia/client/pipeline_execution/base_pipeline_execution.py +96 -0
  18. airia/client/pipeline_execution/sync_pipeline_execution.py +178 -0
  19. airia/client/pipelines_config/__init__.py +4 -0
  20. airia/client/pipelines_config/async_pipelines_config.py +65 -0
  21. airia/client/pipelines_config/base_pipelines_config.py +44 -0
  22. airia/client/pipelines_config/sync_pipelines_config.py +65 -0
  23. airia/client/project/__init__.py +4 -0
  24. airia/client/project/async_project.py +122 -0
  25. airia/client/project/base_project.py +74 -0
  26. airia/client/project/sync_project.py +120 -0
  27. airia/client/store/__init__.py +4 -0
  28. airia/client/store/async_store.py +377 -0
  29. airia/client/store/base_store.py +243 -0
  30. airia/client/store/sync_store.py +352 -0
  31. airia/client/sync_client.py +27 -656
  32. airia/constants.py +1 -1
  33. airia/exceptions.py +8 -8
  34. airia/logs.py +9 -9
  35. airia/types/_request_data.py +11 -4
  36. airia/types/api/__init__.py +0 -27
  37. airia/types/api/conversations/__init__.py +13 -0
  38. airia/types/api/{conversations.py → conversations/_conversations.py} +49 -12
  39. airia/types/api/deployments/__init__.py +26 -0
  40. airia/types/api/deployments/get_deployment.py +106 -0
  41. airia/types/api/deployments/get_deployments.py +224 -0
  42. airia/types/api/pipeline_execution/__init__.py +13 -0
  43. airia/types/api/{pipeline_execution.py → pipeline_execution/_pipeline_execution.py} +30 -13
  44. airia/types/api/pipelines_config/__init__.py +35 -0
  45. airia/types/api/pipelines_config/get_pipeline_config.py +554 -0
  46. airia/types/api/project/__init__.py +3 -0
  47. airia/types/api/{get_projects.py → project/get_projects.py} +16 -4
  48. airia/types/api/store/__init__.py +19 -0
  49. airia/types/api/store/get_file.py +145 -0
  50. airia/types/api/store/get_files.py +21 -0
  51. airia/types/sse/__init__.py +1 -0
  52. airia/types/sse/sse_messages.py +364 -48
  53. airia/utils/sse_parser.py +5 -4
  54. {airia-0.1.13.dist-info → airia-0.1.15.dist-info}/METADATA +4 -2
  55. airia-0.1.15.dist-info/RECORD +62 -0
  56. airia/types/api/get_pipeline_config.py +0 -214
  57. airia-0.1.13.dist-info/RECORD +0 -24
  58. {airia-0.1.13.dist-info → airia-0.1.15.dist-info}/WHEEL +0 -0
  59. {airia-0.1.13.dist-info → airia-0.1.15.dist-info}/licenses/LICENSE +0 -0
  60. {airia-0.1.13.dist-info → airia-0.1.15.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,135 @@
1
+ from typing import Any, Dict, 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 BaseConversations:
9
+ def __init__(self, request_handler: Union[RequestHandler, AsyncRequestHandler]):
10
+ self._request_handler = request_handler
11
+
12
+ def _pre_create_conversation(
13
+ self,
14
+ user_id: str,
15
+ title: Optional[str] = None,
16
+ deployment_id: Optional[str] = None,
17
+ data_source_files: Dict[str, Any] = {},
18
+ is_bookmarked: bool = False,
19
+ correlation_id: Optional[str] = None,
20
+ api_version: str = ApiVersion.V1.value,
21
+ ):
22
+ """
23
+ Prepare request data for creating a new conversation.
24
+
25
+ This internal method constructs the URL and payload for conversation creation
26
+ requests, including all conversation metadata and settings.
27
+
28
+ Args:
29
+ user_id: ID of the user creating the conversation
30
+ title: Optional title for the conversation
31
+ deployment_id: Optional deployment to associate with the conversation
32
+ data_source_files: Optional data source files configuration
33
+ is_bookmarked: Whether the conversation should be bookmarked
34
+ correlation_id: Optional correlation ID for tracing
35
+ api_version: API version to use for the request
36
+
37
+ Returns:
38
+ RequestData: Prepared request data for the conversation creation endpoint
39
+
40
+ Raises:
41
+ ValueError: If an invalid API version is provided
42
+ """
43
+ if api_version not in ApiVersion.as_list():
44
+ raise ValueError(
45
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
46
+ )
47
+ url = urljoin(self._request_handler.base_url, f"{api_version}/Conversations")
48
+
49
+ payload = {
50
+ "userId": user_id,
51
+ "title": title,
52
+ "deploymentId": deployment_id,
53
+ "dataSourceFiles": data_source_files,
54
+ "isBookmarked": is_bookmarked,
55
+ }
56
+
57
+ request_data = self._request_handler.prepare_request(
58
+ url=url, payload=payload, correlation_id=correlation_id
59
+ )
60
+
61
+ return request_data
62
+
63
+ def _pre_get_conversation(
64
+ self,
65
+ conversation_id: str,
66
+ correlation_id: Optional[str] = None,
67
+ api_version: str = ApiVersion.V1.value,
68
+ ):
69
+ """
70
+ Prepare request data for retrieving a conversation by ID.
71
+
72
+ This internal method constructs the URL for conversation retrieval
73
+ requests using the provided conversation identifier.
74
+
75
+ Args:
76
+ conversation_id: ID of the conversation to retrieve
77
+ correlation_id: Optional correlation ID for tracing
78
+ api_version: API version to use for the request
79
+
80
+ Returns:
81
+ RequestData: Prepared request data for the conversation retrieval endpoint
82
+
83
+ Raises:
84
+ ValueError: If an invalid API version is provided
85
+ """
86
+ if api_version not in ApiVersion.as_list():
87
+ raise ValueError(
88
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
89
+ )
90
+ url = urljoin(
91
+ self._request_handler.base_url,
92
+ f"{api_version}/Conversations/{conversation_id}",
93
+ )
94
+ request_data = self._request_handler.prepare_request(
95
+ url, correlation_id=correlation_id
96
+ )
97
+
98
+ return request_data
99
+
100
+ def _pre_delete_conversation(
101
+ self,
102
+ conversation_id: str,
103
+ correlation_id: Optional[str] = None,
104
+ api_version: str = ApiVersion.V1.value,
105
+ ):
106
+ """
107
+ Prepare request data for deleting a conversation by ID.
108
+
109
+ This internal method constructs the URL for conversation deletion
110
+ requests using the provided conversation identifier.
111
+
112
+ Args:
113
+ conversation_id: ID of the conversation to delete
114
+ correlation_id: Optional correlation ID for tracing
115
+ api_version: API version to use for the request
116
+
117
+ Returns:
118
+ RequestData: Prepared request data for the conversation deletion endpoint
119
+
120
+ Raises:
121
+ ValueError: If an invalid API version is provided
122
+ """
123
+ if api_version not in ApiVersion.as_list():
124
+ raise ValueError(
125
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
126
+ )
127
+ url = urljoin(
128
+ self._request_handler.base_url,
129
+ f"{api_version}/Conversations/{conversation_id}",
130
+ )
131
+ request_data = self._request_handler.prepare_request(
132
+ url, correlation_id=correlation_id
133
+ )
134
+
135
+ return request_data
@@ -0,0 +1,182 @@
1
+ from typing import Any, Dict, Optional
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.conversations import (
5
+ CreateConversationResponse,
6
+ GetConversationResponse,
7
+ )
8
+ from .._request_handler import RequestHandler
9
+ from .base_conversations import BaseConversations
10
+
11
+
12
+ class Conversations(BaseConversations):
13
+ def __init__(self, request_handler: RequestHandler):
14
+ super().__init__(request_handler)
15
+
16
+ def create_conversation(
17
+ self,
18
+ user_id: str,
19
+ title: Optional[str] = None,
20
+ deployment_id: Optional[str] = None,
21
+ data_source_files: Dict[str, Any] = {},
22
+ is_bookmarked: bool = False,
23
+ correlation_id: Optional[str] = None,
24
+ ) -> CreateConversationResponse:
25
+ """
26
+ Create a new conversation.
27
+
28
+ Args:
29
+ user_id (str): The unique identifier of the user creating the conversation.
30
+ title (str, optional): The title for the conversation. If not provided,
31
+ the conversation will be created without a title.
32
+ deployment_id (str, optional): The unique identifier of the deployment
33
+ to associate with the conversation. If not provided, the conversation
34
+ will not be associated with any specific deployment.
35
+ data_source_files (dict): Configuration for data source files
36
+ to be associated with the conversation. If not provided, no data
37
+ source files will be associated.
38
+ is_bookmarked (bool): Whether the conversation should be bookmarked.
39
+ Defaults to False.
40
+ correlation_id (str, optional): A unique identifier for request tracing
41
+ and logging. If not provided, one will be automatically generated.
42
+
43
+ Returns:
44
+ CreateConversationResponse: A response object containing the created
45
+ conversation details including its ID, creation timestamp, and
46
+ all provided parameters.
47
+
48
+ Raises:
49
+ AiriaAPIError: If the API request fails, including cases where:
50
+ - The user_id doesn't exist (404)
51
+ - The deployment_id is invalid (404)
52
+ - Authentication fails (401)
53
+ - Access is forbidden (403)
54
+ - Server errors (5xx)
55
+
56
+ Example:
57
+ ```python
58
+ from airia import AiriaClient
59
+
60
+ client = AiriaClient(api_key="your_api_key")
61
+
62
+ # Create a basic conversation
63
+ conversation = client.conversations.create_conversation(
64
+ user_id="user_123"
65
+ )
66
+ print(f"Created conversation: {conversation.id}")
67
+
68
+ # Create a conversation with all options
69
+ conversation = client.conversations.create_conversation(
70
+ user_id="user_123",
71
+ title="My Research Session",
72
+ deployment_id="deployment_456",
73
+ data_source_files={"documents": ["doc1.pdf", "doc2.txt"]},
74
+ is_bookmarked=True
75
+ )
76
+ print(f"Created bookmarked conversation: {conversation.id}")
77
+ ```
78
+
79
+ Note:
80
+ The user_id is required and must correspond to a valid user in the system.
81
+ All other parameters are optional and can be set to None or their default values.
82
+ """
83
+ request_data = self._pre_create_conversation(
84
+ user_id=user_id,
85
+ title=title,
86
+ deployment_id=deployment_id,
87
+ data_source_files=data_source_files,
88
+ is_bookmarked=is_bookmarked,
89
+ correlation_id=correlation_id,
90
+ api_version=ApiVersion.V1.value,
91
+ )
92
+ resp = self._request_handler.make_request("POST", request_data)
93
+
94
+ return CreateConversationResponse(**resp)
95
+
96
+ def get_conversation(
97
+ self, conversation_id: str, correlation_id: Optional[str] = None
98
+ ) -> GetConversationResponse:
99
+ """
100
+ Retrieve detailed information about a specific conversation by its ID.
101
+
102
+ This method fetches comprehensive information about a conversation including
103
+ all messages, metadata, policy redactions, and execution status.
104
+
105
+ Args:
106
+ conversation_id (str): The unique identifier of the conversation to retrieve.
107
+ correlation_id (str, optional): A unique identifier for request tracing
108
+ and logging. If not provided, one will be automatically generated.
109
+
110
+ Returns:
111
+ GetConversationResponse: A response object containing the conversation
112
+ details including user ID, messages, title, deployment information,
113
+ data source files, bookmark status, policy redactions, and execution status.
114
+
115
+ Raises:
116
+ AiriaAPIError: If the API request fails, including cases where:
117
+ - The conversation_id doesn't exist (404)
118
+ - Authentication fails (401)
119
+ - Access is forbidden (403)
120
+ - Server errors (5xx)
121
+
122
+ Example:
123
+ ```python
124
+ from airia import AiriaClient
125
+
126
+ client = AiriaClient(api_key="your_api_key")
127
+
128
+ # Get conversation details
129
+ conversation = client.conversations.get_conversation(
130
+ conversation_id="conversation_123"
131
+ )
132
+
133
+ print(f"Conversation: {conversation.title}")
134
+ print(f"User: {conversation.user_id}")
135
+ print(f"Messages: {len(conversation.messages)}")
136
+ print(f"Bookmarked: {conversation.is_bookmarked}")
137
+
138
+ # Access individual messages
139
+ for message in conversation.messages:
140
+ print(f"[{message.role}]: {message.message}")
141
+ ```
142
+
143
+ Note:
144
+ This method only retrieves conversation information and does not
145
+ modify or execute any operations on the conversation.
146
+ """
147
+ request_data = self._pre_get_conversation(
148
+ conversation_id=conversation_id,
149
+ correlation_id=correlation_id,
150
+ api_version=ApiVersion.V1.value,
151
+ )
152
+ resp = self._request_handler.make_request("GET", request_data)
153
+
154
+ return GetConversationResponse(**resp)
155
+
156
+ def delete_conversation(
157
+ self,
158
+ conversation_id: str,
159
+ correlation_id: Optional[str] = None,
160
+ ) -> None:
161
+ """
162
+ Delete a conversation by its ID.
163
+
164
+ This method permanently removes a conversation and all associated data
165
+ from the Airia platform. This action cannot be undone.
166
+
167
+ Args:
168
+ conversation_id: The unique identifier of the conversation to delete
169
+ correlation_id: Optional correlation ID for request tracing
170
+
171
+ Returns:
172
+ None: This method returns nothing upon successful deletion
173
+
174
+ Raises:
175
+ AiriaAPIError: If the API request fails or the conversation doesn't exist
176
+ """
177
+ request_data = self._pre_delete_conversation(
178
+ conversation_id=conversation_id,
179
+ correlation_id=correlation_id,
180
+ api_version=ApiVersion.V1.value,
181
+ )
182
+ self._request_handler.make_request("DELETE", request_data, return_json=False)
@@ -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)
@@ -0,0 +1,4 @@
1
+ from .sync_pipeline_execution import PipelineExecution
2
+ from .async_pipeline_execution import AsyncPipelineExecution
3
+
4
+ __all__ = ["PipelineExecution", "AsyncPipelineExecution"]