airia 0.1.9__py3-none-any.whl → 0.1.11__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airia
3
- Version: 0.1.9
3
+ Version: 0.1.11
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",
@@ -268,7 +329,7 @@ When using streaming mode (`async_output=True`), the API returns Server-Sent Eve
268
329
 
269
330
  ### Available Message Types
270
331
 
271
- The streaming response includes various message types defined in `airia.types`. Here are the key ones:
332
+ The streaming response includes various message types defined in `airia.types.sse`. Here are the key ones:
272
333
 
273
334
  - `AgentModelStreamFragmentMessage` - Contains actual LLM output chunks
274
335
  - `AgentModelStreamStartMessage` - Indicates LLM streaming has started
@@ -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,117 @@ config = client.get_pipeline_config(pipeline_id="your_pipeline_id")
351
414
  print(f"Pipeline Name: {config.agent.name}")
352
415
  ```
353
416
 
417
+ ## Conversation Management
418
+
419
+ You can create and manage conversations using the `create_conversation` method. Conversations allow you to organize and persist interactions within the Airia platform.
420
+
421
+ ### Creating Conversations
422
+
423
+ #### Synchronous Usage
424
+
425
+ ```python
426
+ from airia import AiriaClient
427
+
428
+ client = AiriaClient(api_key="your_api_key")
429
+ # Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
430
+
431
+ # Create a basic conversation
432
+ conversation = client.create_conversation(
433
+ user_id="user_123"
434
+ )
435
+ print(f"Created conversation: {conversation.conversation_id}")
436
+ print(f"WebSocket URL: {conversation.websocket_url}")
437
+
438
+ # Create a conversation with all options
439
+ conversation = client.create_conversation(
440
+ user_id="user_123",
441
+ title="My Research Session",
442
+ deployment_id="deployment_456",
443
+ data_source_files={"documents": ["doc1.pdf", "doc2.txt"]},
444
+ is_bookmarked=True
445
+ )
446
+ print(f"Created bookmarked conversation: {conversation.conversation_id}")
447
+ ```
448
+
449
+ #### Asynchronous Usage
450
+
451
+ ```python
452
+ import asyncio
453
+ from airia import AiriaAsyncClient
454
+
455
+ async def main():
456
+ client = AiriaAsyncClient(api_key="your_api_key")
457
+ # Or with bearer token: client = AiriaAsyncClient.with_bearer_token(bearer_token="your_bearer_token")
458
+
459
+ # Create a basic conversation
460
+ conversation = await client.create_conversation(
461
+ user_id="user_123"
462
+ )
463
+ print(f"Created conversation: {conversation.conversation_id}")
464
+
465
+ # Create a conversation with all options
466
+ conversation = await client.create_conversation(
467
+ user_id="user_123",
468
+ title="My Research Session",
469
+ deployment_id="deployment_456",
470
+ data_source_files={"documents": ["doc1.pdf", "doc2.txt"]},
471
+ is_bookmarked=True
472
+ )
473
+ print(f"Created bookmarked conversation: {conversation.conversation_id}")
474
+
475
+ asyncio.run(main())
476
+ ```
477
+
478
+ ### Conversation Parameters
479
+
480
+ - **user_id** (required): The unique identifier of the user creating the conversation
481
+ - **title** (optional): A descriptive title for the conversation
482
+ - **deployment_id** (optional): The unique identifier of the deployment to associate with the conversation
483
+ - **data_source_files** (optional): Configuration for data source files to be associated with the conversation
484
+ - **is_bookmarked** (optional): Whether the conversation should be bookmarked (defaults to False)
485
+ - **correlation_id** (optional): A unique identifier for request tracing and logging
486
+
487
+ ### Response Fields
488
+
489
+ The `create_conversation` method returns a `CreateConversationResponse` object containing:
490
+
491
+ - **conversation_id**: The unique identifier of the created conversation
492
+ - **user_id**: The user ID associated with the conversation
493
+ - **websocket_url**: The WebSocket URL for real-time communication
494
+ - **deployment_id**: The deployment ID associated with the conversation
495
+ - **icon_id** and **icon_url**: Optional conversation icon information
496
+ - **description**: Optional conversation description
497
+ - **space_name**: Optional workspace or space name
498
+
499
+ ## Authentication Methods
500
+
501
+ Airia supports two authentication methods:
502
+
503
+ ### API Keys
504
+ - Can be passed as a parameter or via `AIRIA_API_KEY` environment variable
505
+ - Support gateway functionality (OpenAI and Anthropic gateways)
506
+ - Suitable for long-term, persistent authentication
507
+
508
+ ### Bearer Tokens
509
+ - Must be provided explicitly (no environment variable fallback)
510
+ - **Important**: Bearer tokens cannot be used with gateway functionality
511
+ - Suitable for ephemeral, short-lived authentication scenarios
512
+ - Ideal for temporary access or programmatic token generation
513
+
514
+ ```python
515
+ # ✅ API key with gateway support
516
+ client = AiriaClient.with_openai_gateway(api_key="your_api_key")
517
+
518
+ # ❌ Bearer token with gateway - NOT SUPPORTED
519
+ # client = AiriaClient.with_openai_gateway(bearer_token="token") # This won't work
520
+ ```
521
+
354
522
  ## Gateway Usage
355
523
 
356
524
  Airia provides gateway capabilities for popular AI services like OpenAI and Anthropic, allowing you to use your Airia API key with these services.
357
525
 
526
+ > **Note**: Gateway functionality requires API key authentication. Bearer tokens are not supported for gateway usage.
527
+
358
528
  ### OpenAI Gateway
359
529
 
360
530
  ```python
@@ -482,7 +652,11 @@ console_logger = configure_logging(
482
652
  The SDK uses custom exceptions to provide clear error messages:
483
653
 
484
654
  ```python
485
- from airia import AiriaAPIError
655
+ from airia import AiriaAPIError, AiriaClient
656
+
657
+ # Works with both API keys and bearer tokens
658
+ client = AiriaClient(api_key="your_api_key")
659
+ # Or: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
486
660
 
487
661
  try:
488
662
  response = client.execute_pipeline(
@@ -0,0 +1,23 @@
1
+ airia/__init__.py,sha256=T39gO8E5T5zxlw-JP78ruxOu7-LeKOJCJzz6t40kdQo,231
2
+ airia/constants.py,sha256=fHZNUbvEP_x567uFI1qnA2DT8dOzQ07ojdawdPwIrIA,292
3
+ airia/exceptions.py,sha256=4Z55n-cRJrtTa5-pZBIK2oZD4-Z99aUtKx_kfTFYY5o,1146
4
+ airia/logs.py,sha256=17YZ4IuzOF0m5bgofj9-QYlJ2BYR2kRZbBVQfFSLFEk,5441
5
+ airia/client/__init__.py,sha256=6gSQ9bl7j79q1HPE0o5py3IRdkwWWuU_7J4h05Dd2o8,127
6
+ airia/client/async_client.py,sha256=7EOYRWT_DWTXKZuvWr3n9xkvws4DseiiCvhhpAWVKQs,29600
7
+ airia/client/base_client.py,sha256=qG78HclndjAGsn2DLEdvog-V7AR1yt7bEakSYDsi-xM,10898
8
+ airia/client/sync_client.py,sha256=AwJKBaKuJvo_2Z-0dfZva_9BvZ3lFUetwoRmuFGEw94,28579
9
+ airia/types/_api_version.py,sha256=Uzom6O2ZG92HN_Z2h-lTydmO2XYX9RVs4Yi4DJmXytE,255
10
+ airia/types/_request_data.py,sha256=WUvf7fixhBPWLxKbc2VY3Y32BOUbLmXktY58mINuq3A,243
11
+ airia/types/api/__init__.py,sha256=ay9ncmHuyfTZtwwUELcv1U2WalQQFqSBfL-XoRnGw04,596
12
+ airia/types/api/conversations.py,sha256=EYNp1XgydFSFk-f_FhDei41Gw155vUBUYI0Pwn9yDcU,535
13
+ airia/types/api/get_pipeline_config.py,sha256=BLz4HS94EYmdwq37KHda2XJ5KV7tJPP43jHmPbO8-NE,6647
14
+ airia/types/api/get_projects.py,sha256=kWmlN0VMgmQ9WP9ms245MAAEmsHhkpwWUQJ_XJrhIRI,1362
15
+ airia/types/api/pipeline_execution.py,sha256=TBtdpPX3bJnmML7wcrHBRZjN4zAHQXctdOjQCXBdyrU,740
16
+ airia/types/sse/__init__.py,sha256=BVrFyLdRI7-eeFLtbDIingLU5L6kQR1yyu4hXVRlEuE,1581
17
+ airia/types/sse/sse_messages.py,sha256=wSdowY07AjEO8R73SJrFPJtkfIBS4satUpNytjKQq2U,8305
18
+ airia/utils/sse_parser.py,sha256=Zij-BEBdNtc_RrSppeKCLX0pmiFNdgFGHDW7_KiDz50,2782
19
+ airia-0.1.11.dist-info/licenses/LICENSE,sha256=R3ClUMMKPRItIcZ0svzyj2taZZnFYw568YDNzN9KQ1Q,1066
20
+ airia-0.1.11.dist-info/METADATA,sha256=nwpvwFbP8VGNqpvnYr2OzHxUMGMFIiKV8VPwjxiw7Ic,19691
21
+ airia-0.1.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ airia-0.1.11.dist-info/top_level.txt,sha256=qUQEKfs_hdOYTwjKj1JZbRhS5YeXDNaKQaVTrzabS6w,6
23
+ airia-0.1.11.dist-info/RECORD,,
@@ -1,20 +0,0 @@
1
- airia/__init__.py,sha256=T39gO8E5T5zxlw-JP78ruxOu7-LeKOJCJzz6t40kdQo,231
2
- airia/exceptions.py,sha256=4Z55n-cRJrtTa5-pZBIK2oZD4-Z99aUtKx_kfTFYY5o,1146
3
- airia/logs.py,sha256=17YZ4IuzOF0m5bgofj9-QYlJ2BYR2kRZbBVQfFSLFEk,5441
4
- airia/client/__init__.py,sha256=6gSQ9bl7j79q1HPE0o5py3IRdkwWWuU_7J4h05Dd2o8,127
5
- airia/client/async_client.py,sha256=jILf-aNgIw3YY4VFRxzkDoRAWcFqzdJ3fom9Up8nYYo,27010
6
- airia/client/base_client.py,sha256=yNo_N4I08fHXtRm9zMZufSKlA6peNB8b2m8zhKK3b9A,8475
7
- airia/client/sync_client.py,sha256=NP-mfiGtLSnxJcJ8Ymt9y8K5fHrG4I7yyhdFaPk6gcA,26068
8
- airia/types/__init__.py,sha256=Tr1xm5bQrE7yvw0Bo-goNmeh7Rl0QiXUabg7dsJ55dk,2227
9
- airia/types/api_version.py,sha256=Uzom6O2ZG92HN_Z2h-lTydmO2XYX9RVs4Yi4DJmXytE,255
10
- airia/types/request_data.py,sha256=WUvf7fixhBPWLxKbc2VY3Y32BOUbLmXktY58mINuq3A,243
11
- airia/types/sse_messages.py,sha256=wSdowY07AjEO8R73SJrFPJtkfIBS4satUpNytjKQq2U,8305
12
- airia/types/api/get_pipeline_config.py,sha256=BLz4HS94EYmdwq37KHda2XJ5KV7tJPP43jHmPbO8-NE,6647
13
- airia/types/api/get_projects.py,sha256=kWmlN0VMgmQ9WP9ms245MAAEmsHhkpwWUQJ_XJrhIRI,1362
14
- airia/types/api/pipeline_execution.py,sha256=4zGM5W4aXiAibAdgWQCIZBC_blW6QYAlAHoVUMbnCF0,752
15
- airia/utils/sse_parser.py,sha256=h3TcBvXqUIngTqgY6yYxZCGLnC1eI6meQzYr13aFAb8,2791
16
- airia-0.1.9.dist-info/licenses/LICENSE,sha256=R3ClUMMKPRItIcZ0svzyj2taZZnFYw568YDNzN9KQ1Q,1066
17
- airia-0.1.9.dist-info/METADATA,sha256=qQ_S_ut5wUtvkiGKH-DPQzzJtbR4FlS9Rw_-0xzugoI,13218
18
- airia-0.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- airia-0.1.9.dist-info/top_level.txt,sha256=qUQEKfs_hdOYTwjKj1JZbRhS5YeXDNaKQaVTrzabS6w,6
20
- airia-0.1.9.dist-info/RECORD,,
File without changes
File without changes
File without changes
File without changes