airia 0.1.9__tar.gz → 0.1.11__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 (36) hide show
  1. {airia-0.1.9 → airia-0.1.11}/PKG-INFO +182 -8
  2. {airia-0.1.9 → airia-0.1.11}/README.md +181 -7
  3. {airia-0.1.9 → airia-0.1.11}/airia/client/async_client.py +169 -98
  4. {airia-0.1.9 → airia-0.1.11}/airia/client/base_client.py +77 -16
  5. {airia-0.1.9 → airia-0.1.11}/airia/client/sync_client.py +165 -97
  6. airia-0.1.11/airia/constants.py +9 -0
  7. airia-0.1.11/airia/types/api/__init__.py +19 -0
  8. airia-0.1.11/airia/types/api/conversations.py +14 -0
  9. {airia-0.1.9 → airia-0.1.11}/airia/types/api/pipeline_execution.py +6 -10
  10. {airia-0.1.9/airia/types → airia-0.1.11/airia/types/sse}/__init__.py +4 -20
  11. {airia-0.1.9 → airia-0.1.11}/airia/utils/sse_parser.py +1 -1
  12. {airia-0.1.9 → airia-0.1.11}/airia.egg-info/PKG-INFO +182 -8
  13. {airia-0.1.9 → airia-0.1.11}/airia.egg-info/SOURCES.txt +9 -4
  14. {airia-0.1.9 → airia-0.1.11}/pyproject.toml +1 -1
  15. airia-0.1.11/tests/test_bearer_token_auth.py +90 -0
  16. airia-0.1.11/tests/test_create_conversation.py +227 -0
  17. {airia-0.1.9 → airia-0.1.11}/tests/test_execute_pipeline.py +3 -26
  18. {airia-0.1.9 → airia-0.1.11}/tests/test_get_active_pipelines_ids.py +1 -28
  19. {airia-0.1.9 → airia-0.1.11}/tests/test_get_pipeline_config.py +3 -14
  20. {airia-0.1.9 → airia-0.1.11}/tests/test_get_projects.py +1 -27
  21. {airia-0.1.9 → airia-0.1.11}/LICENSE +0 -0
  22. {airia-0.1.9 → airia-0.1.11}/airia/__init__.py +0 -0
  23. {airia-0.1.9 → airia-0.1.11}/airia/client/__init__.py +0 -0
  24. {airia-0.1.9 → airia-0.1.11}/airia/exceptions.py +0 -0
  25. {airia-0.1.9 → airia-0.1.11}/airia/logs.py +0 -0
  26. /airia-0.1.9/airia/types/api_version.py → /airia-0.1.11/airia/types/_api_version.py +0 -0
  27. /airia-0.1.9/airia/types/request_data.py → /airia-0.1.11/airia/types/_request_data.py +0 -0
  28. {airia-0.1.9 → airia-0.1.11}/airia/types/api/get_pipeline_config.py +0 -0
  29. {airia-0.1.9 → airia-0.1.11}/airia/types/api/get_projects.py +0 -0
  30. {airia-0.1.9/airia/types → airia-0.1.11/airia/types/sse}/sse_messages.py +0 -0
  31. {airia-0.1.9 → airia-0.1.11}/airia.egg-info/dependency_links.txt +0 -0
  32. {airia-0.1.9 → airia-0.1.11}/airia.egg-info/requires.txt +0 -0
  33. {airia-0.1.9 → airia-0.1.11}/airia.egg-info/top_level.txt +0 -0
  34. {airia-0.1.9 → airia-0.1.11}/setup.cfg +0 -0
  35. {airia-0.1.9 → airia-0.1.11}/tests/test_anthropic_gateway.py +0 -0
  36. {airia-0.1.9 → airia-0.1.11}/tests/test_openai_gateway.py +0 -0
@@ -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(
@@ -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",
@@ -238,7 +299,7 @@ When using streaming mode (`async_output=True`), the API returns Server-Sent Eve
238
299
 
239
300
  ### Available Message Types
240
301
 
241
- The streaming response includes various message types defined in `airia.types`. Here are the key ones:
302
+ The streaming response includes various message types defined in `airia.types.sse`. Here are the key ones:
242
303
 
243
304
  - `AgentModelStreamFragmentMessage` - Contains actual LLM output chunks
244
305
  - `AgentModelStreamStartMessage` - Indicates LLM streaming has started
@@ -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,117 @@ config = client.get_pipeline_config(pipeline_id="your_pipeline_id")
321
384
  print(f"Pipeline Name: {config.agent.name}")
322
385
  ```
323
386
 
387
+ ## Conversation Management
388
+
389
+ You can create and manage conversations using the `create_conversation` method. Conversations allow you to organize and persist interactions within the Airia platform.
390
+
391
+ ### Creating Conversations
392
+
393
+ #### Synchronous Usage
394
+
395
+ ```python
396
+ from airia import AiriaClient
397
+
398
+ client = AiriaClient(api_key="your_api_key")
399
+ # Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
400
+
401
+ # Create a basic conversation
402
+ conversation = client.create_conversation(
403
+ user_id="user_123"
404
+ )
405
+ print(f"Created conversation: {conversation.conversation_id}")
406
+ print(f"WebSocket URL: {conversation.websocket_url}")
407
+
408
+ # Create a conversation with all options
409
+ conversation = client.create_conversation(
410
+ user_id="user_123",
411
+ title="My Research Session",
412
+ deployment_id="deployment_456",
413
+ data_source_files={"documents": ["doc1.pdf", "doc2.txt"]},
414
+ is_bookmarked=True
415
+ )
416
+ print(f"Created bookmarked conversation: {conversation.conversation_id}")
417
+ ```
418
+
419
+ #### Asynchronous Usage
420
+
421
+ ```python
422
+ import asyncio
423
+ from airia import AiriaAsyncClient
424
+
425
+ async def main():
426
+ client = AiriaAsyncClient(api_key="your_api_key")
427
+ # Or with bearer token: client = AiriaAsyncClient.with_bearer_token(bearer_token="your_bearer_token")
428
+
429
+ # Create a basic conversation
430
+ conversation = await client.create_conversation(
431
+ user_id="user_123"
432
+ )
433
+ print(f"Created conversation: {conversation.conversation_id}")
434
+
435
+ # Create a conversation with all options
436
+ conversation = await client.create_conversation(
437
+ user_id="user_123",
438
+ title="My Research Session",
439
+ deployment_id="deployment_456",
440
+ data_source_files={"documents": ["doc1.pdf", "doc2.txt"]},
441
+ is_bookmarked=True
442
+ )
443
+ print(f"Created bookmarked conversation: {conversation.conversation_id}")
444
+
445
+ asyncio.run(main())
446
+ ```
447
+
448
+ ### Conversation Parameters
449
+
450
+ - **user_id** (required): The unique identifier of the user creating the conversation
451
+ - **title** (optional): A descriptive title for the conversation
452
+ - **deployment_id** (optional): The unique identifier of the deployment to associate with the conversation
453
+ - **data_source_files** (optional): Configuration for data source files to be associated with the conversation
454
+ - **is_bookmarked** (optional): Whether the conversation should be bookmarked (defaults to False)
455
+ - **correlation_id** (optional): A unique identifier for request tracing and logging
456
+
457
+ ### Response Fields
458
+
459
+ The `create_conversation` method returns a `CreateConversationResponse` object containing:
460
+
461
+ - **conversation_id**: The unique identifier of the created conversation
462
+ - **user_id**: The user ID associated with the conversation
463
+ - **websocket_url**: The WebSocket URL for real-time communication
464
+ - **deployment_id**: The deployment ID associated with the conversation
465
+ - **icon_id** and **icon_url**: Optional conversation icon information
466
+ - **description**: Optional conversation description
467
+ - **space_name**: Optional workspace or space name
468
+
469
+ ## Authentication Methods
470
+
471
+ Airia supports two authentication methods:
472
+
473
+ ### API Keys
474
+ - Can be passed as a parameter or via `AIRIA_API_KEY` environment variable
475
+ - Support gateway functionality (OpenAI and Anthropic gateways)
476
+ - Suitable for long-term, persistent authentication
477
+
478
+ ### Bearer Tokens
479
+ - Must be provided explicitly (no environment variable fallback)
480
+ - **Important**: Bearer tokens cannot be used with gateway functionality
481
+ - Suitable for ephemeral, short-lived authentication scenarios
482
+ - Ideal for temporary access or programmatic token generation
483
+
484
+ ```python
485
+ # ✅ API key with gateway support
486
+ client = AiriaClient.with_openai_gateway(api_key="your_api_key")
487
+
488
+ # ❌ Bearer token with gateway - NOT SUPPORTED
489
+ # client = AiriaClient.with_openai_gateway(bearer_token="token") # This won't work
490
+ ```
491
+
324
492
  ## Gateway Usage
325
493
 
326
494
  Airia provides gateway capabilities for popular AI services like OpenAI and Anthropic, allowing you to use your Airia API key with these services.
327
495
 
496
+ > **Note**: Gateway functionality requires API key authentication. Bearer tokens are not supported for gateway usage.
497
+
328
498
  ### OpenAI Gateway
329
499
 
330
500
  ```python
@@ -452,7 +622,11 @@ console_logger = configure_logging(
452
622
  The SDK uses custom exceptions to provide clear error messages:
453
623
 
454
624
  ```python
455
- from airia import AiriaAPIError
625
+ from airia import AiriaAPIError, AiriaClient
626
+
627
+ # Works with both API keys and bearer tokens
628
+ client = AiriaClient(api_key="your_api_key")
629
+ # Or: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")
456
630
 
457
631
  try:
458
632
  response = client.execute_pipeline(