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,178 @@
1
+ from typing import Any, Dict, List, Literal, Optional, Union, overload
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.pipeline_execution import (
5
+ PipelineExecutionAsyncStreamedResponse,
6
+ PipelineExecutionDebugResponse,
7
+ PipelineExecutionResponse,
8
+ )
9
+ from .._request_handler import AsyncRequestHandler
10
+ from .base_pipeline_execution import BasePipelineExecution
11
+
12
+
13
+ class AsyncPipelineExecution(BasePipelineExecution):
14
+ def __init__(self, request_handler: AsyncRequestHandler):
15
+ super().__init__(request_handler)
16
+
17
+ @overload
18
+ async def execute_pipeline(
19
+ self,
20
+ pipeline_id: str,
21
+ user_input: str,
22
+ debug: Literal[False] = False,
23
+ user_id: Optional[str] = None,
24
+ conversation_id: Optional[str] = None,
25
+ async_output: Literal[False] = False,
26
+ include_tools_response: bool = False,
27
+ images: Optional[List[str]] = None,
28
+ files: Optional[List[str]] = None,
29
+ data_source_folders: Optional[Dict[str, Any]] = None,
30
+ data_source_files: Optional[Dict[str, Any]] = None,
31
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
32
+ current_date_time: Optional[str] = None,
33
+ save_history: bool = True,
34
+ additional_info: Optional[List[Any]] = None,
35
+ prompt_variables: Optional[Dict[str, Any]] = None,
36
+ correlation_id: Optional[str] = None,
37
+ ) -> PipelineExecutionResponse: ...
38
+
39
+ @overload
40
+ async def execute_pipeline(
41
+ self,
42
+ pipeline_id: str,
43
+ user_input: str,
44
+ debug: Literal[True] = True,
45
+ user_id: Optional[str] = None,
46
+ conversation_id: Optional[str] = None,
47
+ async_output: Literal[False] = False,
48
+ include_tools_response: bool = False,
49
+ images: Optional[List[str]] = None,
50
+ files: Optional[List[str]] = None,
51
+ data_source_folders: Optional[Dict[str, Any]] = None,
52
+ data_source_files: Optional[Dict[str, Any]] = None,
53
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
54
+ current_date_time: Optional[str] = None,
55
+ save_history: bool = True,
56
+ additional_info: Optional[List[Any]] = None,
57
+ prompt_variables: Optional[Dict[str, Any]] = None,
58
+ correlation_id: Optional[str] = None,
59
+ ) -> PipelineExecutionDebugResponse: ...
60
+
61
+ @overload
62
+ async def execute_pipeline(
63
+ self,
64
+ pipeline_id: str,
65
+ user_input: str,
66
+ debug: bool = False,
67
+ user_id: Optional[str] = None,
68
+ conversation_id: Optional[str] = None,
69
+ async_output: Literal[True] = True,
70
+ include_tools_response: bool = False,
71
+ images: Optional[List[str]] = None,
72
+ files: Optional[List[str]] = None,
73
+ data_source_folders: Optional[Dict[str, Any]] = None,
74
+ data_source_files: Optional[Dict[str, Any]] = None,
75
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
76
+ current_date_time: Optional[str] = None,
77
+ save_history: bool = True,
78
+ additional_info: Optional[List[Any]] = None,
79
+ prompt_variables: Optional[Dict[str, Any]] = None,
80
+ correlation_id: Optional[str] = None,
81
+ ) -> PipelineExecutionAsyncStreamedResponse: ...
82
+
83
+ async def execute_pipeline(
84
+ self,
85
+ pipeline_id: str,
86
+ user_input: str,
87
+ debug: bool = False,
88
+ user_id: Optional[str] = None,
89
+ conversation_id: Optional[str] = None,
90
+ async_output: bool = False,
91
+ include_tools_response: bool = False,
92
+ images: Optional[List[str]] = None,
93
+ files: Optional[List[str]] = None,
94
+ data_source_folders: Optional[Dict[str, Any]] = None,
95
+ data_source_files: Optional[Dict[str, Any]] = None,
96
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
97
+ current_date_time: Optional[str] = None,
98
+ save_history: bool = True,
99
+ additional_info: Optional[List[Any]] = None,
100
+ prompt_variables: Optional[Dict[str, Any]] = None,
101
+ correlation_id: Optional[str] = None,
102
+ ) -> Union[
103
+ PipelineExecutionDebugResponse,
104
+ PipelineExecutionResponse,
105
+ PipelineExecutionAsyncStreamedResponse,
106
+ ]:
107
+ """
108
+ Execute a pipeline with the provided input asynchronously.
109
+
110
+ Args:
111
+ pipeline_id: The ID of the pipeline to execute.
112
+ user_input: input text to process.
113
+ debug: Whether debug mode execution is enabled. Default is False.
114
+ user_id: Optional ID of the user making the request (guid).
115
+ conversation_id: Optional conversation ID (guid).
116
+ async_output: Whether to stream the response. Default is False.
117
+ include_tools_response: Whether to return the initial LLM tool result. Default is False.
118
+ images: Optional list of images formatted as base64 strings.
119
+ files: Optional list of files formatted as base64 strings.
120
+ data_source_folders: Optional data source folders information.
121
+ data_source_files: Optional data source files information.
122
+ in_memory_messages: Optional list of in-memory messages, each with a role and message.
123
+ current_date_time: Optional current date and time in ISO format.
124
+ save_history: Whether to save the userInput and output to conversation history. Default is True.
125
+ additional_info: Optional additional information.
126
+ prompt_variables: Optional variables to be used in the prompt.
127
+ correlation_id: Optional correlation ID for request tracing. If not provided,
128
+ one will be generated automatically.
129
+
130
+ Returns:
131
+ Response containing the result of the execution.
132
+
133
+ Raises:
134
+ AiriaAPIError: If the API request fails with details about the error.
135
+ aiohttp.ClientError: For other request-related errors.
136
+
137
+ Example:
138
+ ```python
139
+ client = AiriaAsyncClient(api_key="your_api_key")
140
+ response = await client.pipeline_execution.execute_pipeline(
141
+ pipeline_id="pipeline_123",
142
+ user_input="Tell me about quantum computing"
143
+ )
144
+ print(response.result)
145
+ ```
146
+ """
147
+ request_data = self._pre_execute_pipeline(
148
+ pipeline_id=pipeline_id,
149
+ user_input=user_input,
150
+ debug=debug,
151
+ user_id=user_id,
152
+ conversation_id=conversation_id,
153
+ async_output=async_output,
154
+ include_tools_response=include_tools_response,
155
+ images=images,
156
+ files=files,
157
+ data_source_folders=data_source_folders,
158
+ data_source_files=data_source_files,
159
+ in_memory_messages=in_memory_messages,
160
+ current_date_time=current_date_time,
161
+ save_history=save_history,
162
+ additional_info=additional_info,
163
+ prompt_variables=prompt_variables,
164
+ correlation_id=correlation_id,
165
+ api_version=ApiVersion.V2.value,
166
+ )
167
+ resp = (
168
+ self._request_handler.make_request_stream("POST", request_data)
169
+ if async_output
170
+ else await self._request_handler.make_request("POST", request_data)
171
+ )
172
+
173
+ if not async_output:
174
+ if not debug:
175
+ return PipelineExecutionResponse(**resp)
176
+ return PipelineExecutionDebugResponse(**resp)
177
+
178
+ return PipelineExecutionAsyncStreamedResponse(stream=resp)
@@ -0,0 +1,96 @@
1
+ from typing import Any, Dict, 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 BasePipelineExecution:
9
+ def __init__(self, request_handler: Union[RequestHandler, AsyncRequestHandler]):
10
+ self._request_handler = request_handler
11
+
12
+ def _pre_execute_pipeline(
13
+ self,
14
+ pipeline_id: str,
15
+ user_input: str,
16
+ debug: bool = False,
17
+ user_id: Optional[str] = None,
18
+ conversation_id: Optional[str] = None,
19
+ async_output: bool = False,
20
+ include_tools_response: bool = False,
21
+ images: Optional[List[str]] = None,
22
+ files: Optional[List[str]] = None,
23
+ data_source_folders: Optional[Dict[str, Any]] = None,
24
+ data_source_files: Optional[Dict[str, Any]] = None,
25
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
26
+ current_date_time: Optional[str] = None,
27
+ save_history: bool = True,
28
+ additional_info: Optional[List[Any]] = None,
29
+ prompt_variables: Optional[Dict[str, Any]] = None,
30
+ correlation_id: Optional[str] = None,
31
+ api_version: str = ApiVersion.V2.value,
32
+ ):
33
+ """
34
+ Prepare request data for pipeline execution endpoint.
35
+
36
+ This internal method constructs the URL and payload for pipeline execution
37
+ requests, validating the API version and preparing all request components.
38
+
39
+ Args:
40
+ pipeline_id: ID of the pipeline to execute
41
+ user_input: Input text to process
42
+ debug: Whether to enable debug mode
43
+ user_id: Optional user identifier
44
+ conversation_id: Optional conversation identifier
45
+ async_output: Whether to enable streaming output
46
+ include_tools_response: Whether to include tool responses
47
+ images: Optional list of base64-encoded images
48
+ files: Optional list of base64-encoded files
49
+ data_source_folders: Optional data source folder configuration
50
+ data_source_files: Optional data source files configuration
51
+ in_memory_messages: Optional list of in-memory messages
52
+ current_date_time: Optional current date/time in ISO format
53
+ save_history: Whether to save to conversation history
54
+ additional_info: Optional additional information
55
+ prompt_variables: Optional prompt variables
56
+ correlation_id: Optional correlation ID for tracing
57
+ api_version: API version to use for the request
58
+
59
+ Returns:
60
+ RequestData: Prepared request data for the pipeline execution endpoint
61
+
62
+ Raises:
63
+ ValueError: If an invalid API version is provided
64
+ """
65
+ if api_version not in ApiVersion.as_list():
66
+ raise ValueError(
67
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
68
+ )
69
+ url = urljoin(
70
+ self._request_handler.base_url,
71
+ f"{api_version}/PipelineExecution/{pipeline_id}",
72
+ )
73
+
74
+ payload = {
75
+ "userInput": user_input,
76
+ "debug": debug,
77
+ "userId": user_id,
78
+ "conversationId": conversation_id,
79
+ "asyncOutput": async_output,
80
+ "includeToolsResponse": include_tools_response,
81
+ "images": images,
82
+ "files": files,
83
+ "dataSourceFolders": data_source_folders,
84
+ "dataSourceFiles": data_source_files,
85
+ "inMemoryMessages": in_memory_messages,
86
+ "currentDateTime": current_date_time,
87
+ "saveHistory": save_history,
88
+ "additionalInfo": additional_info,
89
+ "promptVariables": prompt_variables,
90
+ }
91
+
92
+ request_data = self._request_handler.prepare_request(
93
+ url=url, payload=payload, correlation_id=correlation_id
94
+ )
95
+
96
+ return request_data
@@ -0,0 +1,178 @@
1
+ from typing import Any, Dict, List, Literal, Optional, Union, overload
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.pipeline_execution import (
5
+ PipelineExecutionDebugResponse,
6
+ PipelineExecutionResponse,
7
+ PipelineExecutionStreamedResponse,
8
+ )
9
+ from .._request_handler import RequestHandler
10
+ from .base_pipeline_execution import BasePipelineExecution
11
+
12
+
13
+ class PipelineExecution(BasePipelineExecution):
14
+ def __init__(self, request_handler: RequestHandler):
15
+ super().__init__(request_handler)
16
+
17
+ @overload
18
+ def execute_pipeline(
19
+ self,
20
+ pipeline_id: str,
21
+ user_input: str,
22
+ debug: Literal[False] = False,
23
+ user_id: Optional[str] = None,
24
+ conversation_id: Optional[str] = None,
25
+ async_output: Literal[False] = False,
26
+ include_tools_response: bool = False,
27
+ images: Optional[List[str]] = None,
28
+ files: Optional[List[str]] = None,
29
+ data_source_folders: Optional[Dict[str, Any]] = None,
30
+ data_source_files: Optional[Dict[str, Any]] = None,
31
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
32
+ current_date_time: Optional[str] = None,
33
+ save_history: bool = True,
34
+ additional_info: Optional[List[Any]] = None,
35
+ prompt_variables: Optional[Dict[str, Any]] = None,
36
+ correlation_id: Optional[str] = None,
37
+ ) -> PipelineExecutionResponse: ...
38
+
39
+ @overload
40
+ def execute_pipeline(
41
+ self,
42
+ pipeline_id: str,
43
+ user_input: str,
44
+ debug: Literal[True] = True,
45
+ user_id: Optional[str] = None,
46
+ conversation_id: Optional[str] = None,
47
+ async_output: Literal[False] = False,
48
+ include_tools_response: bool = False,
49
+ images: Optional[List[str]] = None,
50
+ files: Optional[List[str]] = None,
51
+ data_source_folders: Optional[Dict[str, Any]] = None,
52
+ data_source_files: Optional[Dict[str, Any]] = None,
53
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
54
+ current_date_time: Optional[str] = None,
55
+ save_history: bool = True,
56
+ additional_info: Optional[List[Any]] = None,
57
+ prompt_variables: Optional[Dict[str, Any]] = None,
58
+ correlation_id: Optional[str] = None,
59
+ ) -> PipelineExecutionDebugResponse: ...
60
+
61
+ @overload
62
+ def execute_pipeline(
63
+ self,
64
+ pipeline_id: str,
65
+ user_input: str,
66
+ debug: bool = False,
67
+ user_id: Optional[str] = None,
68
+ conversation_id: Optional[str] = None,
69
+ async_output: Literal[True] = True,
70
+ include_tools_response: bool = False,
71
+ images: Optional[List[str]] = None,
72
+ files: Optional[List[str]] = None,
73
+ data_source_folders: Optional[Dict[str, Any]] = None,
74
+ data_source_files: Optional[Dict[str, Any]] = None,
75
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
76
+ current_date_time: Optional[str] = None,
77
+ save_history: bool = True,
78
+ additional_info: Optional[List[Any]] = None,
79
+ prompt_variables: Optional[Dict[str, Any]] = None,
80
+ correlation_id: Optional[str] = None,
81
+ ) -> PipelineExecutionStreamedResponse: ...
82
+
83
+ def execute_pipeline(
84
+ self,
85
+ pipeline_id: str,
86
+ user_input: str,
87
+ debug: bool = False,
88
+ user_id: Optional[str] = None,
89
+ conversation_id: Optional[str] = None,
90
+ async_output: bool = False,
91
+ include_tools_response: bool = False,
92
+ images: Optional[List[str]] = None,
93
+ files: Optional[List[str]] = None,
94
+ data_source_folders: Optional[Dict[str, Any]] = None,
95
+ data_source_files: Optional[Dict[str, Any]] = None,
96
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
97
+ current_date_time: Optional[str] = None,
98
+ save_history: bool = True,
99
+ additional_info: Optional[List[Any]] = None,
100
+ prompt_variables: Optional[Dict[str, Any]] = None,
101
+ correlation_id: Optional[str] = None,
102
+ ) -> Union[
103
+ PipelineExecutionDebugResponse,
104
+ PipelineExecutionResponse,
105
+ PipelineExecutionStreamedResponse,
106
+ ]:
107
+ """
108
+ Execute a pipeline with the provided input.
109
+
110
+ Args:
111
+ pipeline_id: The ID of the pipeline to execute.
112
+ user_input: input text to process.
113
+ debug: Whether debug mode execution is enabled. Default is False.
114
+ user_id: Optional ID of the user making the request (guid).
115
+ conversation_id: Optional conversation ID (guid).
116
+ async_output: Whether to stream the response. Default is False.
117
+ include_tools_response: Whether to return the initial LLM tool result. Default is False.
118
+ images: Optional list of images formatted as base64 strings.
119
+ files: Optional list of files formatted as base64 strings.
120
+ data_source_folders: Optional data source folders information.
121
+ data_source_files: Optional data source files information.
122
+ in_memory_messages: Optional list of in-memory messages, each with a role and message.
123
+ current_date_time: Optional current date and time in ISO format.
124
+ save_history: Whether to save the userInput and output to conversation history. Default is True.
125
+ additional_info: Optional additional information.
126
+ prompt_variables: Optional variables to be used in the prompt.
127
+ correlation_id: Optional correlation ID for request tracing. If not provided,
128
+ one will be generated automatically.
129
+
130
+ Returns:
131
+ Response containing the result of the execution.
132
+
133
+ Raises:
134
+ AiriaAPIError: If the API request fails with details about the error.
135
+ requests.RequestException: For other request-related errors.
136
+
137
+ Example:
138
+ ```python
139
+ client = AiriaClient(api_key="your_api_key")
140
+ response = client.pipeline_execution.execute_pipeline(
141
+ pipeline_id="pipeline_123",
142
+ user_input="Tell me about quantum computing"
143
+ )
144
+ print(response.result)
145
+ ```
146
+ """
147
+ request_data = self._pre_execute_pipeline(
148
+ pipeline_id=pipeline_id,
149
+ user_input=user_input,
150
+ debug=debug,
151
+ user_id=user_id,
152
+ conversation_id=conversation_id,
153
+ async_output=async_output,
154
+ include_tools_response=include_tools_response,
155
+ images=images,
156
+ files=files,
157
+ data_source_folders=data_source_folders,
158
+ data_source_files=data_source_files,
159
+ in_memory_messages=in_memory_messages,
160
+ current_date_time=current_date_time,
161
+ save_history=save_history,
162
+ additional_info=additional_info,
163
+ prompt_variables=prompt_variables,
164
+ correlation_id=correlation_id,
165
+ api_version=ApiVersion.V2.value,
166
+ )
167
+ resp = (
168
+ self._request_handler.make_request_stream("POST", request_data)
169
+ if async_output
170
+ else self._request_handler.make_request("POST", request_data)
171
+ )
172
+
173
+ if not async_output:
174
+ if not debug:
175
+ return PipelineExecutionResponse(**resp)
176
+ return PipelineExecutionDebugResponse(**resp)
177
+
178
+ return PipelineExecutionStreamedResponse(stream=resp)
@@ -0,0 +1,4 @@
1
+ from .sync_pipelines_config import PipelinesConfig
2
+ from .async_pipelines_config import AsyncPipelinesConfig
3
+
4
+ __all__ = ["PipelinesConfig", "AsyncPipelinesConfig"]
@@ -0,0 +1,65 @@
1
+ from typing import Optional
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.pipelines_config import PipelineConfigResponse
5
+ from .._request_handler import AsyncRequestHandler
6
+ from .base_pipelines_config import BasePipelinesConfig
7
+
8
+
9
+ class AsyncPipelinesConfig(BasePipelinesConfig):
10
+ def __init__(self, request_handler: AsyncRequestHandler):
11
+ super().__init__(request_handler)
12
+
13
+ async def get_pipeline_config(
14
+ self, pipeline_id: str, correlation_id: Optional[str] = None
15
+ ) -> PipelineConfigResponse:
16
+ """
17
+ Retrieve configuration details for a specific pipeline.
18
+
19
+ This method fetches comprehensive information about a pipeline including its
20
+ deployment details, execution statistics, version information, and metadata.
21
+
22
+ Args:
23
+ pipeline_id (str): The unique identifier of the pipeline to retrieve
24
+ configuration for.
25
+ correlation_id (str, optional): A unique identifier for request tracing
26
+ and logging. If not provided, one will be automatically generated.
27
+
28
+ Returns:
29
+ PipelineConfigResponse: A response object containing the pipeline
30
+ configuration.
31
+
32
+ Raises:
33
+ AiriaAPIError: If the API request fails, including cases where:
34
+ - The pipeline_id doesn't exist (404)
35
+ - Authentication fails (401)
36
+ - Access is forbidden (403)
37
+ - Server errors (5xx)
38
+
39
+ Example:
40
+ ```python
41
+ from airia import AiriaAsyncClient
42
+
43
+ client = AiriaAsyncClient(api_key="your_api_key")
44
+
45
+ # Get pipeline configuration
46
+ config = await client.pipelines_config.get_pipeline_config(
47
+ pipeline_id="your_pipeline_id"
48
+ )
49
+
50
+ print(f"Pipeline: {config.agent.name}")
51
+ print(f"Description: {config.agent.agent_description}")
52
+ ```
53
+
54
+ Note:
55
+ This method only retrieves configuration information and does not
56
+ execute the pipeline. Use execute_pipeline() to run the pipeline.
57
+ """
58
+ request_data = self._pre_get_pipeline_config(
59
+ pipeline_id=pipeline_id,
60
+ correlation_id=correlation_id,
61
+ api_version=ApiVersion.V1.value,
62
+ )
63
+ resp = await self._request_handler.make_request("GET", request_data)
64
+
65
+ return PipelineConfigResponse(**resp)
@@ -0,0 +1,44 @@
1
+ from typing import 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 BasePipelinesConfig:
9
+ def __init__(self, request_handler: Union[RequestHandler, AsyncRequestHandler]):
10
+ self._request_handler = request_handler
11
+
12
+ def _pre_get_pipeline_config(
13
+ self,
14
+ pipeline_id: str,
15
+ correlation_id: Optional[str] = None,
16
+ api_version: str = ApiVersion.V1.value,
17
+ ):
18
+ """
19
+ Prepare request data for getting pipeline configuration endpoint.
20
+
21
+ Args:
22
+ pipeline_id: ID of the pipeline to get configuration for
23
+ correlation_id: Optional correlation ID for tracing
24
+ api_version: API version to use for the request
25
+
26
+ Returns:
27
+ RequestData: Prepared request data for the pipeline config endpoint
28
+
29
+ Raises:
30
+ ValueError: If an invalid API version is provided
31
+ """
32
+ if api_version not in ApiVersion.as_list():
33
+ raise ValueError(
34
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
35
+ )
36
+ url = urljoin(
37
+ self._request_handler.base_url,
38
+ f"{api_version}/PipelinesConfig/{pipeline_id}",
39
+ )
40
+ request_data = self._request_handler.prepare_request(
41
+ url, correlation_id=correlation_id
42
+ )
43
+
44
+ return request_data
@@ -0,0 +1,65 @@
1
+ from typing import Optional
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.pipelines_config import PipelineConfigResponse
5
+ from .._request_handler import RequestHandler
6
+ from .base_pipelines_config import BasePipelinesConfig
7
+
8
+
9
+ class PipelinesConfig(BasePipelinesConfig):
10
+ def __init__(self, request_handler: RequestHandler):
11
+ super().__init__(request_handler)
12
+
13
+ def get_pipeline_config(
14
+ self, pipeline_id: str, correlation_id: Optional[str] = None
15
+ ) -> PipelineConfigResponse:
16
+ """
17
+ Retrieve configuration details for a specific pipeline.
18
+
19
+ This method fetches comprehensive information about a pipeline including its
20
+ deployment details, execution statistics, version information, and metadata.
21
+
22
+ Args:
23
+ pipeline_id (str): The unique identifier of the pipeline to retrieve
24
+ configuration for.
25
+ correlation_id (str, optional): A unique identifier for request tracing
26
+ and logging. If not provided, one will be automatically generated.
27
+
28
+ Returns:
29
+ PipelineConfigResponse: A response object containing the pipeline
30
+ configuration.
31
+
32
+ Raises:
33
+ AiriaAPIError: If the API request fails, including cases where:
34
+ - The pipeline_id doesn't exist (404)
35
+ - Authentication fails (401)
36
+ - Access is forbidden (403)
37
+ - Server errors (5xx)
38
+
39
+ Example:
40
+ ```python
41
+ from airia import AiriaClient
42
+
43
+ client = AiriaClient(api_key="your_api_key")
44
+
45
+ # Get pipeline configuration
46
+ config = client.pipelines_config.get_pipeline_config(
47
+ pipeline_id="your_pipeline_id"
48
+ )
49
+
50
+ print(f"Pipeline: {config.agent.name}")
51
+ print(f"Description: {config.agent.agent_description}")
52
+ ```
53
+
54
+ Note:
55
+ This method only retrieves configuration information and does not
56
+ execute the pipeline. Use execute_pipeline() to run the pipeline.
57
+ """
58
+ request_data = self._pre_get_pipeline_config(
59
+ pipeline_id=pipeline_id,
60
+ correlation_id=correlation_id,
61
+ api_version=ApiVersion.V1.value,
62
+ )
63
+ resp = self._request_handler.make_request("GET", request_data)
64
+
65
+ return PipelineConfigResponse(**resp)
@@ -0,0 +1,4 @@
1
+ from .sync_project import Project
2
+ from .async_project import AsyncProject
3
+
4
+ __all__ = ["Project", "AsyncProject"]