airia 0.1.12__tar.gz → 0.1.13__tar.gz

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 (47) hide show
  1. airia-0.1.13/PKG-INFO +219 -0
  2. airia-0.1.13/README.md +189 -0
  3. {airia-0.1.12 → airia-0.1.13}/airia/client/async_client.py +97 -3
  4. {airia-0.1.12 → airia-0.1.13}/airia/client/base_client.py +161 -2
  5. {airia-0.1.12 → airia-0.1.13}/airia/client/sync_client.py +95 -2
  6. airia-0.1.13/airia/constants.py +20 -0
  7. {airia-0.1.12 → airia-0.1.13}/airia/logs.py +1 -23
  8. airia-0.1.13/airia/types/__init__.py +0 -0
  9. airia-0.1.13/airia/types/_request_data.py +31 -0
  10. {airia-0.1.12 → airia-0.1.13}/airia/types/api/__init__.py +9 -1
  11. airia-0.1.13/airia/types/api/conversations.py +78 -0
  12. {airia-0.1.12 → airia-0.1.13}/airia/types/api/get_pipeline_config.py +31 -0
  13. airia-0.1.13/airia/types/api/get_projects.py +79 -0
  14. airia-0.1.13/airia/types/api/pipeline_execution.py +59 -0
  15. {airia-0.1.12 → airia-0.1.13}/airia/types/sse/__init__.py +7 -0
  16. {airia-0.1.12 → airia-0.1.13}/airia/types/sse/sse_messages.py +175 -0
  17. {airia-0.1.12 → airia-0.1.13}/airia/utils/sse_parser.py +39 -7
  18. airia-0.1.13/airia.egg-info/PKG-INFO +219 -0
  19. {airia-0.1.12 → airia-0.1.13}/airia.egg-info/SOURCES.txt +3 -0
  20. {airia-0.1.12 → airia-0.1.13}/pyproject.toml +10 -2
  21. {airia-0.1.12 → airia-0.1.13}/tests/test_create_conversation.py +22 -0
  22. airia-0.1.13/tests/test_delete_conversation.py +133 -0
  23. {airia-0.1.12 → airia-0.1.13}/tests/test_execute_pipeline.py +2 -4
  24. airia-0.1.13/tests/test_get_conversation.py +91 -0
  25. airia-0.1.12/PKG-INFO +0 -705
  26. airia-0.1.12/README.md +0 -675
  27. airia-0.1.12/airia/constants.py +0 -9
  28. airia-0.1.12/airia/types/_request_data.py +0 -11
  29. airia-0.1.12/airia/types/api/conversations.py +0 -14
  30. airia-0.1.12/airia/types/api/get_projects.py +0 -35
  31. airia-0.1.12/airia/types/api/pipeline_execution.py +0 -29
  32. airia-0.1.12/airia.egg-info/PKG-INFO +0 -705
  33. {airia-0.1.12 → airia-0.1.13}/LICENSE +0 -0
  34. {airia-0.1.12 → airia-0.1.13}/airia/__init__.py +0 -0
  35. {airia-0.1.12 → airia-0.1.13}/airia/client/__init__.py +0 -0
  36. {airia-0.1.12 → airia-0.1.13}/airia/exceptions.py +0 -0
  37. {airia-0.1.12 → airia-0.1.13}/airia/types/_api_version.py +0 -0
  38. {airia-0.1.12 → airia-0.1.13}/airia.egg-info/dependency_links.txt +0 -0
  39. {airia-0.1.12 → airia-0.1.13}/airia.egg-info/requires.txt +0 -0
  40. {airia-0.1.12 → airia-0.1.13}/airia.egg-info/top_level.txt +0 -0
  41. {airia-0.1.12 → airia-0.1.13}/setup.cfg +0 -0
  42. {airia-0.1.12 → airia-0.1.13}/tests/test_anthropic_gateway.py +0 -0
  43. {airia-0.1.12 → airia-0.1.13}/tests/test_bearer_token_auth.py +0 -0
  44. {airia-0.1.12 → airia-0.1.13}/tests/test_get_active_pipelines_ids.py +0 -0
  45. {airia-0.1.12 → airia-0.1.13}/tests/test_get_pipeline_config.py +0 -0
  46. {airia-0.1.12 → airia-0.1.13}/tests/test_get_projects.py +0 -0
  47. {airia-0.1.12 → airia-0.1.13}/tests/test_openai_gateway.py +0 -0
airia-0.1.13/PKG-INFO ADDED
@@ -0,0 +1,219 @@
1
+ Metadata-Version: 2.4
2
+ Name: airia
3
+ Version: 0.1.13
4
+ Summary: Python SDK for Airia API
5
+ Author-email: Airia LLC <support@airia.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.9
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: requests>=2.32.3
19
+ Requires-Dist: aiohttp>=3.11.14
20
+ Requires-Dist: loguru>=0.7.3
21
+ Requires-Dist: pydantic>=2.11.0
22
+ Provides-Extra: anthropic
23
+ Requires-Dist: anthropic>=0.49.0; extra == "anthropic"
24
+ Provides-Extra: openai
25
+ Requires-Dist: openai>=1.74.0; extra == "openai"
26
+ Provides-Extra: all
27
+ Requires-Dist: anthropic>=0.49.0; extra == "all"
28
+ Requires-Dist: openai>=1.74.0; extra == "all"
29
+ Dynamic: license-file
30
+
31
+ # Airia Python API Library
32
+
33
+ [![PyPI version](https://badge.fury.io/py/airia.svg)](https://badge.fury.io/py/airia)
34
+ [![Python versions](https://img.shields.io/pypi/pyversions/airia.svg)](https://pypi.org/project/airia/)
35
+ [![License](https://img.shields.io/pypi/l/airia.svg)](https://pypi.org/project/airia/)
36
+
37
+ The Airia Python library provides a clean and intuitive interface to interact with Airia API. The library offers both synchronous and asynchronous clients for maximum flexibility in your applications.
38
+
39
+ ## Features
40
+
41
+ - **Dual Client Support**: Choose between synchronous (`AiriaClient`) and asynchronous (`AiriaAsyncClient`) implementations
42
+ - **Pipeline Execution**: Easily run AI pipelines with customizable parameters
43
+ - **Gateway Support**: Seamlessly integrate with OpenAI and Anthropic services through Airia gateways
44
+ - **Error Handling**: Comprehensive error handling with custom exceptions
45
+ - **Logging**: Built-in configurable logging with correlation ID support for request tracing
46
+ - **Flexible Authentication**: Support for both API keys and bearer tokens with flexible configuration
47
+
48
+ ## Documentation and Quick Start Guides
49
+
50
+ Run locally with `mkdocs`:
51
+
52
+ 1. [Install development dependencies](#install-with-development-dependencies)
53
+ 2. Run `mkdocs serve` to start the local server
54
+
55
+ ## Installation
56
+
57
+ You can install the package using pip or uv:
58
+
59
+ <table>
60
+ <tr>
61
+ <th>pip</th>
62
+ <th>uv</th>
63
+ </tr>
64
+ <tr>
65
+ <td>
66
+
67
+ ```bash
68
+ pip install airia
69
+ ```
70
+
71
+ </td>
72
+ <td>
73
+
74
+ ```bash
75
+ uv add airia
76
+ ```
77
+
78
+ </td>
79
+ </tr>
80
+ </table>
81
+
82
+ ### Install with optional dependencies
83
+
84
+ The package supports optional dependencies for gateway functionality:
85
+
86
+ <table>
87
+ <tr>
88
+ <th>OpenAI Gateway</th>
89
+ <th>Anthropic Gateway</th>
90
+ <th>All Gateways</th>
91
+ </tr>
92
+ <tr>
93
+ <td>
94
+
95
+ ```bash
96
+ pip install "airia[openai]"
97
+ ```
98
+
99
+ </td>
100
+ <td>
101
+
102
+ ```bash
103
+ pip install "airia[anthropic]"
104
+ ```
105
+
106
+ </td>
107
+ <td>
108
+
109
+ ```bash
110
+ pip install "airia[all]"
111
+ ```
112
+
113
+ </td>
114
+ </tr>
115
+ </table>
116
+
117
+ ### Install with development dependencies
118
+
119
+ Clone the repository:
120
+
121
+ ```bash
122
+ git clone https://github.com/AiriaLLC/airia-python.git
123
+ cd airia-python
124
+ ```
125
+
126
+ Then, run one of the following commands:
127
+
128
+ <table>
129
+ <tr>
130
+ <th>pip</th>
131
+ <th>uv</th>
132
+ </tr>
133
+ <tr>
134
+ <td>
135
+
136
+ ```bash
137
+ pip install dependency-groups
138
+ dev=$(python -m dependency_groups dev)
139
+ pip install -e .
140
+ pip install $dev
141
+ ```
142
+
143
+ </td>
144
+ <td>
145
+
146
+ ```bash
147
+ uv sync --frozen --group dev
148
+ ```
149
+
150
+ </td>
151
+ </tr>
152
+ </table>
153
+
154
+ ## Building from Source
155
+
156
+ First make sure you have already cloned the repository, then run one of the following commands:
157
+
158
+ <table>
159
+ <tr>
160
+ <th>pip</th>
161
+ <th>uv</th>
162
+ </tr>
163
+ <tr>
164
+ <td>
165
+
166
+ ```bash
167
+ pip install build
168
+ python -m build
169
+ ```
170
+
171
+ </td>
172
+ <td>
173
+
174
+ ```bash
175
+ uv build
176
+ ```
177
+
178
+ </td>
179
+ </tr>
180
+ </table>
181
+
182
+ This will create both wheel and source distribution in the `dist/` directory.
183
+
184
+ ## Requirements
185
+
186
+ - Python 3.9 or higher
187
+ - Core dependencies:
188
+ - requests
189
+ - aiohttp
190
+ - loguru
191
+ - pydantic
192
+
193
+ - Optional dependencies:
194
+ - OpenAI gateway: `openai>=1.74.0`
195
+ - Anthropic gateway: `anthropic>=0.49.0`
196
+
197
+ ## Development
198
+
199
+ To run tests (make sure you have development dependencies installed):
200
+
201
+ ```bash
202
+ pytest
203
+ ```
204
+
205
+ For testing gateway functionality, install the optional dependencies:
206
+
207
+ ```bash
208
+ # For OpenAI gateway tests
209
+ pip install -e .[openai]
210
+ pytest tests/test_openai_gateway.py
211
+
212
+ # For Anthropic gateway tests
213
+ pip install -e .[anthropic]
214
+ pytest tests/test_anthropic_gateway.py
215
+
216
+ # For all tests
217
+ pip install -e .[all]
218
+ pytest
219
+ ```
airia-0.1.13/README.md ADDED
@@ -0,0 +1,189 @@
1
+ # Airia Python API Library
2
+
3
+ [![PyPI version](https://badge.fury.io/py/airia.svg)](https://badge.fury.io/py/airia)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/airia.svg)](https://pypi.org/project/airia/)
5
+ [![License](https://img.shields.io/pypi/l/airia.svg)](https://pypi.org/project/airia/)
6
+
7
+ The Airia Python library provides a clean and intuitive interface to interact with Airia API. The library offers both synchronous and asynchronous clients for maximum flexibility in your applications.
8
+
9
+ ## Features
10
+
11
+ - **Dual Client Support**: Choose between synchronous (`AiriaClient`) and asynchronous (`AiriaAsyncClient`) implementations
12
+ - **Pipeline Execution**: Easily run AI pipelines with customizable parameters
13
+ - **Gateway Support**: Seamlessly integrate with OpenAI and Anthropic services through Airia gateways
14
+ - **Error Handling**: Comprehensive error handling with custom exceptions
15
+ - **Logging**: Built-in configurable logging with correlation ID support for request tracing
16
+ - **Flexible Authentication**: Support for both API keys and bearer tokens with flexible configuration
17
+
18
+ ## Documentation and Quick Start Guides
19
+
20
+ Run locally with `mkdocs`:
21
+
22
+ 1. [Install development dependencies](#install-with-development-dependencies)
23
+ 2. Run `mkdocs serve` to start the local server
24
+
25
+ ## Installation
26
+
27
+ You can install the package using pip or uv:
28
+
29
+ <table>
30
+ <tr>
31
+ <th>pip</th>
32
+ <th>uv</th>
33
+ </tr>
34
+ <tr>
35
+ <td>
36
+
37
+ ```bash
38
+ pip install airia
39
+ ```
40
+
41
+ </td>
42
+ <td>
43
+
44
+ ```bash
45
+ uv add airia
46
+ ```
47
+
48
+ </td>
49
+ </tr>
50
+ </table>
51
+
52
+ ### Install with optional dependencies
53
+
54
+ The package supports optional dependencies for gateway functionality:
55
+
56
+ <table>
57
+ <tr>
58
+ <th>OpenAI Gateway</th>
59
+ <th>Anthropic Gateway</th>
60
+ <th>All Gateways</th>
61
+ </tr>
62
+ <tr>
63
+ <td>
64
+
65
+ ```bash
66
+ pip install "airia[openai]"
67
+ ```
68
+
69
+ </td>
70
+ <td>
71
+
72
+ ```bash
73
+ pip install "airia[anthropic]"
74
+ ```
75
+
76
+ </td>
77
+ <td>
78
+
79
+ ```bash
80
+ pip install "airia[all]"
81
+ ```
82
+
83
+ </td>
84
+ </tr>
85
+ </table>
86
+
87
+ ### Install with development dependencies
88
+
89
+ Clone the repository:
90
+
91
+ ```bash
92
+ git clone https://github.com/AiriaLLC/airia-python.git
93
+ cd airia-python
94
+ ```
95
+
96
+ Then, run one of the following commands:
97
+
98
+ <table>
99
+ <tr>
100
+ <th>pip</th>
101
+ <th>uv</th>
102
+ </tr>
103
+ <tr>
104
+ <td>
105
+
106
+ ```bash
107
+ pip install dependency-groups
108
+ dev=$(python -m dependency_groups dev)
109
+ pip install -e .
110
+ pip install $dev
111
+ ```
112
+
113
+ </td>
114
+ <td>
115
+
116
+ ```bash
117
+ uv sync --frozen --group dev
118
+ ```
119
+
120
+ </td>
121
+ </tr>
122
+ </table>
123
+
124
+ ## Building from Source
125
+
126
+ First make sure you have already cloned the repository, then run one of the following commands:
127
+
128
+ <table>
129
+ <tr>
130
+ <th>pip</th>
131
+ <th>uv</th>
132
+ </tr>
133
+ <tr>
134
+ <td>
135
+
136
+ ```bash
137
+ pip install build
138
+ python -m build
139
+ ```
140
+
141
+ </td>
142
+ <td>
143
+
144
+ ```bash
145
+ uv build
146
+ ```
147
+
148
+ </td>
149
+ </tr>
150
+ </table>
151
+
152
+ This will create both wheel and source distribution in the `dist/` directory.
153
+
154
+ ## Requirements
155
+
156
+ - Python 3.9 or higher
157
+ - Core dependencies:
158
+ - requests
159
+ - aiohttp
160
+ - loguru
161
+ - pydantic
162
+
163
+ - Optional dependencies:
164
+ - OpenAI gateway: `openai>=1.74.0`
165
+ - Anthropic gateway: `anthropic>=0.49.0`
166
+
167
+ ## Development
168
+
169
+ To run tests (make sure you have development dependencies installed):
170
+
171
+ ```bash
172
+ pytest
173
+ ```
174
+
175
+ For testing gateway functionality, install the optional dependencies:
176
+
177
+ ```bash
178
+ # For OpenAI gateway tests
179
+ pip install -e .[openai]
180
+ pytest tests/test_openai_gateway.py
181
+
182
+ # For Anthropic gateway tests
183
+ pip install -e .[anthropic]
184
+ pytest tests/test_anthropic_gateway.py
185
+
186
+ # For all tests
187
+ pip install -e .[all]
188
+ pytest
189
+ ```
@@ -16,6 +16,7 @@ from ..types._api_version import ApiVersion
16
16
  from ..types._request_data import RequestData
17
17
  from ..types.api import (
18
18
  CreateConversationResponse,
19
+ GetConversationResponse,
19
20
  GetPipelineConfigResponse,
20
21
  PipelineExecutionAsyncStreamedResponse,
21
22
  PipelineExecutionDebugResponse,
@@ -219,8 +220,8 @@ class AiriaAsyncClient(AiriaBaseClient):
219
220
  raise AiriaAPIError(status_code=e.status, message=sanitized_message) from e
220
221
 
221
222
  async def _make_request(
222
- self, method: str, request_data: RequestData
223
- ) -> Dict[str, Any]:
223
+ self, method: str, request_data: RequestData, return_json: bool = True
224
+ ) -> Optional[Dict[str, Any]]:
224
225
  """
225
226
  Makes an asynchronous HTTP request to the Airia API.
226
227
 
@@ -231,6 +232,7 @@ class AiriaAsyncClient(AiriaBaseClient):
231
232
  - headers: HTTP headers to include in the request
232
233
  - payload: The JSON payload/body for the request
233
234
  - correlation_id: Unique identifier for request tracing
235
+ return_json (bool): Whether to return the response as JSON. Default is True.
234
236
 
235
237
  Returns:
236
238
  resp ([Dict[str, Any]): The JSON response from the API as a dictionary.
@@ -265,7 +267,8 @@ class AiriaAsyncClient(AiriaBaseClient):
265
267
  response.raise_for_status()
266
268
 
267
269
  # Return the response as a dictionary
268
- return await response.json()
270
+ if return_json:
271
+ return await response.json()
269
272
 
270
273
  except aiohttp.ClientResponseError as e:
271
274
  self._handle_exception(e, request_data.url, request_data.correlation_id)
@@ -737,3 +740,94 @@ class AiriaAsyncClient(AiriaBaseClient):
737
740
  resp = await self._make_request("POST", request_data)
738
741
 
739
742
  return CreateConversationResponse(**resp)
743
+
744
+ async def get_conversation(
745
+ self, conversation_id: str, correlation_id: Optional[str] = None
746
+ ) -> GetConversationResponse:
747
+ """
748
+ Retrieve detailed information about a specific conversation by its ID.
749
+
750
+ This method fetches comprehensive information about a conversation including
751
+ all messages, metadata, policy redactions, and execution status.
752
+
753
+ Args:
754
+ conversation_id (str): The unique identifier of the conversation to retrieve.
755
+ correlation_id (str, optional): A unique identifier for request tracing
756
+ and logging. If not provided, one will be automatically generated.
757
+
758
+ Returns:
759
+ GetConversationResponse: A response object containing the conversation
760
+ details including user ID, messages, title, deployment information,
761
+ data source files, bookmark status, policy redactions, and execution status.
762
+
763
+ Raises:
764
+ AiriaAPIError: If the API request fails, including cases where:
765
+ - The conversation_id doesn't exist (404)
766
+ - Authentication fails (401)
767
+ - Access is forbidden (403)
768
+ - Server errors (5xx)
769
+
770
+ Example:
771
+ ```python
772
+ from airia import AiriaAsyncClient
773
+
774
+ async def main():
775
+ client = AiriaAsyncClient(api_key="your_api_key")
776
+
777
+ # Get conversation details
778
+ conversation = await client.get_conversation(
779
+ conversation_id="conversation_123"
780
+ )
781
+
782
+ print(f"Conversation: {conversation.title}")
783
+ print(f"User: {conversation.user_id}")
784
+ print(f"Messages: {len(conversation.messages)}")
785
+ print(f"Bookmarked: {conversation.is_bookmarked}")
786
+
787
+ # Access individual messages
788
+ for message in conversation.messages:
789
+ print(f"[{message.role}]: {message.message}")
790
+
791
+ asyncio.run(main())
792
+ ```
793
+
794
+ Note:
795
+ This method only retrieves conversation information and does not
796
+ modify or execute any operations on the conversation.
797
+ """
798
+ request_data = self._pre_get_conversation(
799
+ conversation_id=conversation_id,
800
+ correlation_id=correlation_id,
801
+ api_version=ApiVersion.V1.value,
802
+ )
803
+ resp = await self._make_request("GET", request_data)
804
+
805
+ return GetConversationResponse(**resp)
806
+
807
+ async def delete_conversation(
808
+ self,
809
+ conversation_id: str,
810
+ correlation_id: Optional[str] = None,
811
+ ) -> None:
812
+ """
813
+ Delete a conversation by its ID.
814
+
815
+ This method permanently removes a conversation and all associated data
816
+ from the Airia platform. This action cannot be undone.
817
+
818
+ Args:
819
+ conversation_id: The unique identifier of the conversation to delete
820
+ correlation_id: Optional correlation ID for request tracing
821
+
822
+ Returns:
823
+ None: This method returns nothing upon successful deletion
824
+
825
+ Raises:
826
+ AiriaAPIError: If the API request fails or the conversation doesn't exist
827
+ """
828
+ request_data = self._pre_delete_conversation(
829
+ conversation_id=conversation_id,
830
+ correlation_id=correlation_id,
831
+ api_version=ApiVersion.V1.value,
832
+ )
833
+ await self._make_request("DELETE", request_data, return_json=False)