airia 0.1.8__tar.gz → 0.1.10__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 (33) hide show
  1. {airia-0.1.8 → airia-0.1.10}/PKG-INFO +99 -7
  2. {airia-0.1.8 → airia-0.1.10}/README.md +98 -6
  3. {airia-0.1.8 → airia-0.1.10}/airia/client/async_client.py +172 -55
  4. {airia-0.1.8 → airia-0.1.10}/airia/client/base_client.py +92 -51
  5. {airia-0.1.8 → airia-0.1.10}/airia/client/sync_client.py +158 -41
  6. airia-0.1.10/airia/constants.py +9 -0
  7. {airia-0.1.8 → airia-0.1.10}/airia/types/__init__.py +2 -0
  8. {airia-0.1.8 → airia-0.1.10}/airia/types/api/get_pipeline_config.py +35 -2
  9. airia-0.1.10/airia/types/api/get_projects.py +35 -0
  10. {airia-0.1.8 → airia-0.1.10}/airia/types/request_data.py +1 -0
  11. {airia-0.1.8 → airia-0.1.10}/airia.egg-info/PKG-INFO +99 -7
  12. {airia-0.1.8 → airia-0.1.10}/airia.egg-info/SOURCES.txt +4 -0
  13. {airia-0.1.8 → airia-0.1.10}/pyproject.toml +1 -1
  14. {airia-0.1.8 → airia-0.1.10}/tests/test_anthropic_gateway.py +1 -1
  15. airia-0.1.10/tests/test_bearer_token_auth.py +90 -0
  16. {airia-0.1.8 → airia-0.1.10}/tests/test_execute_pipeline.py +1 -1
  17. {airia-0.1.8 → airia-0.1.10}/tests/test_get_active_pipelines_ids.py +29 -12
  18. {airia-0.1.8 → airia-0.1.10}/tests/test_get_pipeline_config.py +1 -1
  19. airia-0.1.10/tests/test_get_projects.py +203 -0
  20. {airia-0.1.8 → airia-0.1.10}/tests/test_openai_gateway.py +1 -1
  21. {airia-0.1.8 → airia-0.1.10}/LICENSE +0 -0
  22. {airia-0.1.8 → airia-0.1.10}/airia/__init__.py +0 -0
  23. {airia-0.1.8 → airia-0.1.10}/airia/client/__init__.py +0 -0
  24. {airia-0.1.8 → airia-0.1.10}/airia/exceptions.py +0 -0
  25. {airia-0.1.8 → airia-0.1.10}/airia/logs.py +0 -0
  26. {airia-0.1.8 → airia-0.1.10}/airia/types/api/pipeline_execution.py +0 -0
  27. {airia-0.1.8 → airia-0.1.10}/airia/types/api_version.py +0 -0
  28. {airia-0.1.8 → airia-0.1.10}/airia/types/sse_messages.py +0 -0
  29. {airia-0.1.8 → airia-0.1.10}/airia/utils/sse_parser.py +0 -0
  30. {airia-0.1.8 → airia-0.1.10}/airia.egg-info/dependency_links.txt +0 -0
  31. {airia-0.1.8 → airia-0.1.10}/airia.egg-info/requires.txt +0 -0
  32. {airia-0.1.8 → airia-0.1.10}/airia.egg-info/top_level.txt +0 -0
  33. {airia-0.1.8 → airia-0.1.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airia
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: Python SDK for Airia API
5
5
  Author-email: Airia LLC <support@airia.com>
6
6
  License: MIT
@@ -43,7 +43,9 @@ Airia Python API Library that provides a clean and intuitive interface to intera
43
43
  - **Gateway Support**: Seamlessly integrate with OpenAI and Anthropic services through Airia gateways
44
44
  - **Error Handling**: Comprehensive error handling with custom exceptions
45
45
  - **Logging**: Built-in configurable logging with correlation ID support for request tracing
46
- - **API Key Management**: Flexible API key configuration via parameters or environment variables
46
+ - **Flexible Authentication**: Support for both API keys and bearer tokens with flexible configuration
47
+ - **API Key Management**: API key configuration via parameters or environment variables
48
+ - **Bearer Token Support**: Bearer token authentication for ephemeral, short-lived credentials
47
49
 
48
50
  ## Installation
49
51
 
@@ -181,17 +183,38 @@ This will create both wheel and source distribution in the `dist/` directory.
181
183
  ```python
182
184
  from airia import AiriaClient
183
185
 
186
+ # API Key Authentication
184
187
  client = AiriaClient(
185
188
  base_url="https://api.airia.ai", # Default: "https://api.airia.ai"
186
- api_key=None, # Or set AIRIA_API_KEY environment variable
187
- timeout=30.0, # Request timeout in seconds (default: 30.0)
188
- log_requests=False, # Enable request/response logging (default: False)
189
- custom_logger=None # Use custom logger (default: None - uses built-in)
189
+ api_key=None, # Or set AIRIA_API_KEY environment variable
190
+ timeout=30.0, # Request timeout in seconds (default: 30.0)
191
+ log_requests=False, # Enable request/response logging (default: False)
192
+ custom_logger=None # Use custom logger (default: None - uses built-in)
193
+ )
194
+
195
+ # Bearer Token Authentication
196
+ client = AiriaClient(
197
+ base_url="https://api.airia.ai", # Default: "https://api.airia.ai"
198
+ bearer_token="your_bearer_token", # Must be provided explicitly (no env var fallback)
199
+ timeout=30.0, # Request timeout in seconds (default: 30.0)
200
+ log_requests=False, # Enable request/response logging (default: False)
201
+ custom_logger=None # Use custom logger (default: None - uses built-in)
202
+ )
203
+
204
+ # Convenience method for bearer token
205
+ client = AiriaClient.with_bearer_token(
206
+ bearer_token="your_bearer_token",
207
+ base_url="https://api.airia.ai", # Optional, uses default if not provided
208
+ timeout=30.0, # Optional, uses default if not provided
209
+ log_requests=False, # Optional, uses default if not provided
210
+ custom_logger=None # Optional, uses default if not provided
190
211
  )
191
212
  ```
192
213
 
193
214
  ### Synchronous Usage
194
215
 
216
+ #### With API Key
217
+
195
218
  ```python
196
219
  from airia import AiriaClient
197
220
 
@@ -207,6 +230,23 @@ response = client.execute_pipeline(
207
230
  print(response.result)
208
231
  ```
209
232
 
233
+ #### With Bearer Token
234
+
235
+ ```python
236
+ from airia import AiriaClient
237
+
238
+ # Initialize client with bearer token
239
+ client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
240
+
241
+ # Execute a pipeline
242
+ response = client.execute_pipeline(
243
+ pipeline_id="your_pipeline_id",
244
+ user_input="Tell me about quantum computing"
245
+ )
246
+
247
+ print(response.result)
248
+ ```
249
+
210
250
  #### Synchronous Streaming
211
251
 
212
252
  ```python
@@ -214,6 +254,7 @@ from airia import AiriaClient
214
254
 
215
255
  # Initialize client (API key can be passed directly or via AIRIA_API_KEY environment variable)
216
256
  client = AiriaClient(api_key="your_api_key")
257
+ # Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
217
258
 
218
259
  # Execute a pipeline
219
260
  response = client.execute_pipeline(
@@ -228,6 +269,8 @@ for c in response.stream:
228
269
 
229
270
  ### Asynchronous Usage
230
271
 
272
+ #### With API Key
273
+
231
274
  ```python
232
275
  import asyncio
233
276
  from airia import AiriaAsyncClient
@@ -243,6 +286,23 @@ async def main():
243
286
  asyncio.run(main())
244
287
  ```
245
288
 
289
+ #### With Bearer Token
290
+
291
+ ```python
292
+ import asyncio
293
+ from airia import AiriaAsyncClient
294
+
295
+ async def main():
296
+ client = AiriaAsyncClient.with_bearer_token(bearer_token="your_bearer_token")
297
+ response = await client.execute_pipeline(
298
+ pipeline_id="your_pipeline_id",
299
+ user_input="Tell me about quantum computing"
300
+ )
301
+ print(response.result)
302
+
303
+ asyncio.run(main())
304
+ ```
305
+
246
306
  #### Asynchronous Streaming
247
307
 
248
308
  ```python
@@ -251,6 +311,7 @@ from airia import AiriaAsyncClient
251
311
 
252
312
  async def main():
253
313
  client = AiriaAsyncClient(api_key="your_api_key")
314
+ # Or with bearer token: client = AiriaAsyncClient.with_bearer_token(bearer_token="your_bearer_token")
254
315
  response = await client.execute_pipeline(
255
316
  pipeline_id="your_pipeline_id",
256
317
  user_input="Tell me about quantum computing",
@@ -320,6 +381,7 @@ from airia import AiriaClient
320
381
  from airia.types import AgentModelStreamFragmentMessage
321
382
 
322
383
  client = AiriaClient(api_key="your_api_key")
384
+ # Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
323
385
 
324
386
  response = client.execute_pipeline(
325
387
  pipeline_id="your_pipeline_id",
@@ -343,6 +405,7 @@ You can retrieve detailed configuration information about a pipeline using the `
343
405
  from airia import AiriaClient
344
406
 
345
407
  client = AiriaClient(api_key="your_api_key")
408
+ # Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
346
409
 
347
410
  # Get pipeline configuration
348
411
  config = client.get_pipeline_config(pipeline_id="your_pipeline_id")
@@ -351,10 +414,35 @@ config = client.get_pipeline_config(pipeline_id="your_pipeline_id")
351
414
  print(f"Pipeline Name: {config.agent.name}")
352
415
  ```
353
416
 
417
+ ## Authentication Methods
418
+
419
+ Airia supports two authentication methods:
420
+
421
+ ### API Keys
422
+ - Can be passed as a parameter or via `AIRIA_API_KEY` environment variable
423
+ - Support gateway functionality (OpenAI and Anthropic gateways)
424
+ - Suitable for long-term, persistent authentication
425
+
426
+ ### Bearer Tokens
427
+ - Must be provided explicitly (no environment variable fallback)
428
+ - **Important**: Bearer tokens cannot be used with gateway functionality
429
+ - Suitable for ephemeral, short-lived authentication scenarios
430
+ - Ideal for temporary access or programmatic token generation
431
+
432
+ ```python
433
+ # ✅ API key with gateway support
434
+ client = AiriaClient.with_openai_gateway(api_key="your_api_key")
435
+
436
+ # ❌ Bearer token with gateway - NOT SUPPORTED
437
+ # client = AiriaClient.with_openai_gateway(bearer_token="token") # This won't work
438
+ ```
439
+
354
440
  ## Gateway Usage
355
441
 
356
442
  Airia provides gateway capabilities for popular AI services like OpenAI and Anthropic, allowing you to use your Airia API key with these services.
357
443
 
444
+ > **Note**: Gateway functionality requires API key authentication. Bearer tokens are not supported for gateway usage.
445
+
358
446
  ### OpenAI Gateway
359
447
 
360
448
  ```python
@@ -482,7 +570,11 @@ console_logger = configure_logging(
482
570
  The SDK uses custom exceptions to provide clear error messages:
483
571
 
484
572
  ```python
485
- from airia import AiriaAPIError
573
+ from airia import AiriaAPIError, AiriaClient
574
+
575
+ # Works with both API keys and bearer tokens
576
+ client = AiriaClient(api_key="your_api_key")
577
+ # Or: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
486
578
 
487
579
  try:
488
580
  response = client.execute_pipeline(
@@ -13,7 +13,9 @@ Airia Python API Library that provides a clean and intuitive interface to intera
13
13
  - **Gateway Support**: Seamlessly integrate with OpenAI and Anthropic services through Airia gateways
14
14
  - **Error Handling**: Comprehensive error handling with custom exceptions
15
15
  - **Logging**: Built-in configurable logging with correlation ID support for request tracing
16
- - **API Key Management**: Flexible API key configuration via parameters or environment variables
16
+ - **Flexible Authentication**: Support for both API keys and bearer tokens with flexible configuration
17
+ - **API Key Management**: API key configuration via parameters or environment variables
18
+ - **Bearer Token Support**: Bearer token authentication for ephemeral, short-lived credentials
17
19
 
18
20
  ## Installation
19
21
 
@@ -151,17 +153,38 @@ This will create both wheel and source distribution in the `dist/` directory.
151
153
  ```python
152
154
  from airia import AiriaClient
153
155
 
156
+ # API Key Authentication
154
157
  client = AiriaClient(
155
158
  base_url="https://api.airia.ai", # Default: "https://api.airia.ai"
156
- api_key=None, # Or set AIRIA_API_KEY environment variable
157
- timeout=30.0, # Request timeout in seconds (default: 30.0)
158
- log_requests=False, # Enable request/response logging (default: False)
159
- custom_logger=None # Use custom logger (default: None - uses built-in)
159
+ api_key=None, # Or set AIRIA_API_KEY environment variable
160
+ timeout=30.0, # Request timeout in seconds (default: 30.0)
161
+ log_requests=False, # Enable request/response logging (default: False)
162
+ custom_logger=None # Use custom logger (default: None - uses built-in)
163
+ )
164
+
165
+ # Bearer Token Authentication
166
+ client = AiriaClient(
167
+ base_url="https://api.airia.ai", # Default: "https://api.airia.ai"
168
+ bearer_token="your_bearer_token", # Must be provided explicitly (no env var fallback)
169
+ timeout=30.0, # Request timeout in seconds (default: 30.0)
170
+ log_requests=False, # Enable request/response logging (default: False)
171
+ custom_logger=None # Use custom logger (default: None - uses built-in)
172
+ )
173
+
174
+ # Convenience method for bearer token
175
+ client = AiriaClient.with_bearer_token(
176
+ bearer_token="your_bearer_token",
177
+ base_url="https://api.airia.ai", # Optional, uses default if not provided
178
+ timeout=30.0, # Optional, uses default if not provided
179
+ log_requests=False, # Optional, uses default if not provided
180
+ custom_logger=None # Optional, uses default if not provided
160
181
  )
161
182
  ```
162
183
 
163
184
  ### Synchronous Usage
164
185
 
186
+ #### With API Key
187
+
165
188
  ```python
166
189
  from airia import AiriaClient
167
190
 
@@ -177,6 +200,23 @@ response = client.execute_pipeline(
177
200
  print(response.result)
178
201
  ```
179
202
 
203
+ #### With Bearer Token
204
+
205
+ ```python
206
+ from airia import AiriaClient
207
+
208
+ # Initialize client with bearer token
209
+ client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
210
+
211
+ # Execute a pipeline
212
+ response = client.execute_pipeline(
213
+ pipeline_id="your_pipeline_id",
214
+ user_input="Tell me about quantum computing"
215
+ )
216
+
217
+ print(response.result)
218
+ ```
219
+
180
220
  #### Synchronous Streaming
181
221
 
182
222
  ```python
@@ -184,6 +224,7 @@ from airia import AiriaClient
184
224
 
185
225
  # Initialize client (API key can be passed directly or via AIRIA_API_KEY environment variable)
186
226
  client = AiriaClient(api_key="your_api_key")
227
+ # Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
187
228
 
188
229
  # Execute a pipeline
189
230
  response = client.execute_pipeline(
@@ -198,6 +239,8 @@ for c in response.stream:
198
239
 
199
240
  ### Asynchronous Usage
200
241
 
242
+ #### With API Key
243
+
201
244
  ```python
202
245
  import asyncio
203
246
  from airia import AiriaAsyncClient
@@ -213,6 +256,23 @@ async def main():
213
256
  asyncio.run(main())
214
257
  ```
215
258
 
259
+ #### With Bearer Token
260
+
261
+ ```python
262
+ import asyncio
263
+ from airia import AiriaAsyncClient
264
+
265
+ async def main():
266
+ client = AiriaAsyncClient.with_bearer_token(bearer_token="your_bearer_token")
267
+ response = await client.execute_pipeline(
268
+ pipeline_id="your_pipeline_id",
269
+ user_input="Tell me about quantum computing"
270
+ )
271
+ print(response.result)
272
+
273
+ asyncio.run(main())
274
+ ```
275
+
216
276
  #### Asynchronous Streaming
217
277
 
218
278
  ```python
@@ -221,6 +281,7 @@ from airia import AiriaAsyncClient
221
281
 
222
282
  async def main():
223
283
  client = AiriaAsyncClient(api_key="your_api_key")
284
+ # Or with bearer token: client = AiriaAsyncClient.with_bearer_token(bearer_token="your_bearer_token")
224
285
  response = await client.execute_pipeline(
225
286
  pipeline_id="your_pipeline_id",
226
287
  user_input="Tell me about quantum computing",
@@ -290,6 +351,7 @@ from airia import AiriaClient
290
351
  from airia.types import AgentModelStreamFragmentMessage
291
352
 
292
353
  client = AiriaClient(api_key="your_api_key")
354
+ # Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
293
355
 
294
356
  response = client.execute_pipeline(
295
357
  pipeline_id="your_pipeline_id",
@@ -313,6 +375,7 @@ You can retrieve detailed configuration information about a pipeline using the `
313
375
  from airia import AiriaClient
314
376
 
315
377
  client = AiriaClient(api_key="your_api_key")
378
+ # Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
316
379
 
317
380
  # Get pipeline configuration
318
381
  config = client.get_pipeline_config(pipeline_id="your_pipeline_id")
@@ -321,10 +384,35 @@ config = client.get_pipeline_config(pipeline_id="your_pipeline_id")
321
384
  print(f"Pipeline Name: {config.agent.name}")
322
385
  ```
323
386
 
387
+ ## Authentication Methods
388
+
389
+ Airia supports two authentication methods:
390
+
391
+ ### API Keys
392
+ - Can be passed as a parameter or via `AIRIA_API_KEY` environment variable
393
+ - Support gateway functionality (OpenAI and Anthropic gateways)
394
+ - Suitable for long-term, persistent authentication
395
+
396
+ ### Bearer Tokens
397
+ - Must be provided explicitly (no environment variable fallback)
398
+ - **Important**: Bearer tokens cannot be used with gateway functionality
399
+ - Suitable for ephemeral, short-lived authentication scenarios
400
+ - Ideal for temporary access or programmatic token generation
401
+
402
+ ```python
403
+ # ✅ API key with gateway support
404
+ client = AiriaClient.with_openai_gateway(api_key="your_api_key")
405
+
406
+ # ❌ Bearer token with gateway - NOT SUPPORTED
407
+ # client = AiriaClient.with_openai_gateway(bearer_token="token") # This won't work
408
+ ```
409
+
324
410
  ## Gateway Usage
325
411
 
326
412
  Airia provides gateway capabilities for popular AI services like OpenAI and Anthropic, allowing you to use your Airia API key with these services.
327
413
 
414
+ > **Note**: Gateway functionality requires API key authentication. Bearer tokens are not supported for gateway usage.
415
+
328
416
  ### OpenAI Gateway
329
417
 
330
418
  ```python
@@ -452,7 +540,11 @@ console_logger = configure_logging(
452
540
  The SDK uses custom exceptions to provide clear error messages:
453
541
 
454
542
  ```python
455
- from airia import AiriaAPIError
543
+ from airia import AiriaAPIError, AiriaClient
544
+
545
+ # Works with both API keys and bearer tokens
546
+ client = AiriaClient(api_key="your_api_key")
547
+ # Or: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
456
548
 
457
549
  try:
458
550
  response = client.execute_pipeline(