airia 0.1.12__py3-none-any.whl → 0.1.13__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.
@@ -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)
@@ -97,6 +97,21 @@ class AiriaBaseClient:
97
97
  params: Optional[Dict[str, Any]] = None,
98
98
  correlation_id: Optional[str] = None,
99
99
  ):
100
+ """
101
+ Prepare request data including headers, authentication, and logging.
102
+
103
+ This method sets up all the necessary components for an API request including
104
+ correlation ID, authentication headers, and sanitized logging.
105
+
106
+ Args:
107
+ url: The target URL for the request
108
+ payload: Optional JSON payload for the request body
109
+ params: Optional query parameters for the request
110
+ correlation_id: Optional correlation ID for request tracing
111
+
112
+ Returns:
113
+ RequestData: A data structure containing all prepared request components
114
+ """
100
115
  # Set correlation ID if provided or generate a new one
101
116
  correlation_id = set_correlation_id(correlation_id)
102
117
 
@@ -170,6 +185,38 @@ class AiriaBaseClient:
170
185
  correlation_id: Optional[str] = None,
171
186
  api_version: str = ApiVersion.V2.value,
172
187
  ):
188
+ """
189
+ Prepare request data for pipeline execution endpoint.
190
+
191
+ This internal method constructs the URL and payload for pipeline execution
192
+ requests, validating the API version and preparing all request components.
193
+
194
+ Args:
195
+ pipeline_id: ID of the pipeline to execute
196
+ user_input: Input text to process
197
+ debug: Whether to enable debug mode
198
+ user_id: Optional user identifier
199
+ conversation_id: Optional conversation identifier
200
+ async_output: Whether to enable streaming output
201
+ include_tools_response: Whether to include tool responses
202
+ images: Optional list of base64-encoded images
203
+ files: Optional list of base64-encoded files
204
+ data_source_folders: Optional data source folder configuration
205
+ data_source_files: Optional data source files configuration
206
+ in_memory_messages: Optional list of in-memory messages
207
+ current_date_time: Optional current date/time in ISO format
208
+ save_history: Whether to save to conversation history
209
+ additional_info: Optional additional information
210
+ prompt_variables: Optional prompt variables
211
+ correlation_id: Optional correlation ID for tracing
212
+ api_version: API version to use for the request
213
+
214
+ Returns:
215
+ RequestData: Prepared request data for the pipeline execution endpoint
216
+
217
+ Raises:
218
+ ValueError: If an invalid API version is provided
219
+ """
173
220
  if api_version not in ApiVersion.as_list():
174
221
  raise ValueError(
175
222
  f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
@@ -205,6 +252,19 @@ class AiriaBaseClient:
205
252
  correlation_id: Optional[str] = None,
206
253
  api_version: str = ApiVersion.V1.value,
207
254
  ):
255
+ """
256
+ Prepare request data for getting projects endpoint.
257
+
258
+ Args:
259
+ correlation_id: Optional correlation ID for tracing
260
+ api_version: API version to use for the request
261
+
262
+ Returns:
263
+ RequestData: Prepared request data for the projects endpoint
264
+
265
+ Raises:
266
+ ValueError: If an invalid API version is provided
267
+ """
208
268
  if api_version not in ApiVersion.as_list():
209
269
  raise ValueError(
210
270
  f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
@@ -220,6 +280,20 @@ class AiriaBaseClient:
220
280
  correlation_id: Optional[str] = None,
221
281
  api_version: str = ApiVersion.V1.value,
222
282
  ):
283
+ """
284
+ Prepare request data for getting active pipelines IDs.
285
+
286
+ Args:
287
+ project_id: ID of the project to get configuration for
288
+ correlation_id: Optional correlation ID for tracing
289
+ api_version: API version to use for the request
290
+
291
+ Returns:
292
+ RequestData: Prepared request data for the pipeline config endpoint
293
+
294
+ Raises:
295
+ ValueError: If an invalid API version is provided
296
+ """
223
297
  if api_version not in ApiVersion.as_list():
224
298
  raise ValueError(
225
299
  f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
@@ -238,6 +312,20 @@ class AiriaBaseClient:
238
312
  correlation_id: Optional[str] = None,
239
313
  api_version: str = ApiVersion.V1.value,
240
314
  ):
315
+ """
316
+ Prepare request data for getting pipeline configuration endpoint.
317
+
318
+ Args:
319
+ pipeline_id: ID of the pipeline to get configuration for
320
+ correlation_id: Optional correlation ID for tracing
321
+ api_version: API version to use for the request
322
+
323
+ Returns:
324
+ RequestData: Prepared request data for the pipeline config endpoint
325
+
326
+ Raises:
327
+ ValueError: If an invalid API version is provided
328
+ """
241
329
  if api_version not in ApiVersion.as_list():
242
330
  raise ValueError(
243
331
  f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
@@ -259,6 +347,27 @@ class AiriaBaseClient:
259
347
  correlation_id: Optional[str] = None,
260
348
  api_version: str = ApiVersion.V1.value,
261
349
  ):
350
+ """
351
+ Prepare request data for creating a new conversation.
352
+
353
+ This internal method constructs the URL and payload for conversation creation
354
+ requests, including all conversation metadata and settings.
355
+
356
+ Args:
357
+ user_id: ID of the user creating the conversation
358
+ title: Optional title for the conversation
359
+ deployment_id: Optional deployment to associate with the conversation
360
+ data_source_files: Optional data source files configuration
361
+ is_bookmarked: Whether the conversation should be bookmarked
362
+ correlation_id: Optional correlation ID for tracing
363
+ api_version: API version to use for the request
364
+
365
+ Returns:
366
+ RequestData: Prepared request data for the conversation creation endpoint
367
+
368
+ Raises:
369
+ ValueError: If an invalid API version is provided
370
+ """
262
371
  if api_version not in ApiVersion.as_list():
263
372
  raise ValueError(
264
373
  f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
@@ -279,16 +388,66 @@ class AiriaBaseClient:
279
388
 
280
389
  return request_data
281
390
 
282
- def _pre_get_projects(
391
+ def _pre_get_conversation(
283
392
  self,
393
+ conversation_id: str,
284
394
  correlation_id: Optional[str] = None,
285
395
  api_version: str = ApiVersion.V1.value,
286
396
  ):
397
+ """
398
+ Prepare request data for retrieving a conversation by ID.
399
+
400
+ This internal method constructs the URL for conversation retrieval
401
+ requests using the provided conversation identifier.
402
+
403
+ Args:
404
+ conversation_id: ID of the conversation to retrieve
405
+ correlation_id: Optional correlation ID for tracing
406
+ api_version: API version to use for the request
407
+
408
+ Returns:
409
+ RequestData: Prepared request data for the conversation retrieval endpoint
410
+
411
+ Raises:
412
+ ValueError: If an invalid API version is provided
413
+ """
287
414
  if api_version not in ApiVersion.as_list():
288
415
  raise ValueError(
289
416
  f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
290
417
  )
291
- url = urljoin(self.base_url, f"{api_version}/Project/paginated")
418
+ url = urljoin(self.base_url, f"{api_version}/Conversations/{conversation_id}")
419
+ request_data = self._prepare_request(url, correlation_id=correlation_id)
420
+
421
+ return request_data
422
+
423
+ def _pre_delete_conversation(
424
+ self,
425
+ conversation_id: str,
426
+ correlation_id: Optional[str] = None,
427
+ api_version: str = ApiVersion.V1.value,
428
+ ):
429
+ """
430
+ Prepare request data for deleting a conversation by ID.
431
+
432
+ This internal method constructs the URL for conversation deletion
433
+ requests using the provided conversation identifier.
434
+
435
+ Args:
436
+ conversation_id: ID of the conversation to delete
437
+ correlation_id: Optional correlation ID for tracing
438
+ api_version: API version to use for the request
439
+
440
+ Returns:
441
+ RequestData: Prepared request data for the conversation deletion endpoint
442
+
443
+ Raises:
444
+ ValueError: If an invalid API version is provided
445
+ """
446
+ if api_version not in ApiVersion.as_list():
447
+ raise ValueError(
448
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
449
+ )
450
+ url = urljoin(self.base_url, f"{api_version}/Conversations/{conversation_id}")
292
451
  request_data = self._prepare_request(url, correlation_id=correlation_id)
293
452
 
294
453
  return request_data
@@ -14,6 +14,7 @@ from ..types._api_version import ApiVersion
14
14
  from ..types._request_data import RequestData
15
15
  from ..types.api import (
16
16
  CreateConversationResponse,
17
+ GetConversationResponse,
17
18
  GetPipelineConfigResponse,
18
19
  PipelineExecutionDebugResponse,
19
20
  PipelineExecutionResponse,
@@ -202,7 +203,9 @@ class AiriaClient(AiriaBaseClient):
202
203
  status_code=e.response.status_code, message=sanitized_message
203
204
  ) from e
204
205
 
205
- def _make_request(self, method: str, request_data: RequestData) -> Dict[str, Any]:
206
+ def _make_request(
207
+ self, method: str, request_data: RequestData, return_json: bool = True
208
+ ) -> Dict[str, Any]:
206
209
  """
207
210
  Makes a synchronous HTTP request to the Airia API.
208
211
 
@@ -213,6 +216,7 @@ class AiriaClient(AiriaBaseClient):
213
216
  - headers: HTTP headers to include in the request
214
217
  - payload: The JSON payload/body for the request
215
218
  - correlation_id: Unique identifier for request tracing
219
+ return_json (bool): Whether to return the response as JSON. Default is True.
216
220
 
217
221
  Returns:
218
222
  resp (Dict[str, Any]): The JSON response from the API as a dictionary.
@@ -248,7 +252,8 @@ class AiriaClient(AiriaBaseClient):
248
252
  response.raise_for_status()
249
253
 
250
254
  # Returns the JSON response
251
- return response.json()
255
+ if return_json:
256
+ return response.json()
252
257
 
253
258
  except requests.HTTPError as e:
254
259
  self._handle_exception(e, request_data.url, request_data.correlation_id)
@@ -716,3 +721,91 @@ class AiriaClient(AiriaBaseClient):
716
721
  resp = self._make_request("POST", request_data)
717
722
 
718
723
  return CreateConversationResponse(**resp)
724
+
725
+ def get_conversation(
726
+ self, conversation_id: str, correlation_id: Optional[str] = None
727
+ ) -> GetConversationResponse:
728
+ """
729
+ Retrieve detailed information about a specific conversation by its ID.
730
+
731
+ This method fetches comprehensive information about a conversation including
732
+ all messages, metadata, policy redactions, and execution status.
733
+
734
+ Args:
735
+ conversation_id (str): The unique identifier of the conversation to retrieve.
736
+ correlation_id (str, optional): A unique identifier for request tracing
737
+ and logging. If not provided, one will be automatically generated.
738
+
739
+ Returns:
740
+ GetConversationResponse: A response object containing the conversation
741
+ details including user ID, messages, title, deployment information,
742
+ data source files, bookmark status, policy redactions, and execution status.
743
+
744
+ Raises:
745
+ AiriaAPIError: If the API request fails, including cases where:
746
+ - The conversation_id doesn't exist (404)
747
+ - Authentication fails (401)
748
+ - Access is forbidden (403)
749
+ - Server errors (5xx)
750
+
751
+ Example:
752
+ ```python
753
+ from airia import AiriaClient
754
+
755
+ client = AiriaClient(api_key="your_api_key")
756
+
757
+ # Get conversation details
758
+ conversation = client.get_conversation(
759
+ conversation_id="conversation_123"
760
+ )
761
+
762
+ print(f"Conversation: {conversation.title}")
763
+ print(f"User: {conversation.user_id}")
764
+ print(f"Messages: {len(conversation.messages)}")
765
+ print(f"Bookmarked: {conversation.is_bookmarked}")
766
+
767
+ # Access individual messages
768
+ for message in conversation.messages:
769
+ print(f"[{message.role}]: {message.message}")
770
+ ```
771
+
772
+ Note:
773
+ This method only retrieves conversation information and does not
774
+ modify or execute any operations on the conversation.
775
+ """
776
+ request_data = self._pre_get_conversation(
777
+ conversation_id=conversation_id,
778
+ correlation_id=correlation_id,
779
+ api_version=ApiVersion.V1.value,
780
+ )
781
+ resp = self._make_request("GET", request_data)
782
+
783
+ return GetConversationResponse(**resp)
784
+
785
+ def delete_conversation(
786
+ self,
787
+ conversation_id: str,
788
+ correlation_id: Optional[str] = None,
789
+ ) -> None:
790
+ """
791
+ Delete a conversation by its ID.
792
+
793
+ This method permanently removes a conversation and all associated data
794
+ from the Airia platform. This action cannot be undone.
795
+
796
+ Args:
797
+ conversation_id: The unique identifier of the conversation to delete
798
+ correlation_id: Optional correlation ID for request tracing
799
+
800
+ Returns:
801
+ None: This method returns nothing upon successful deletion
802
+
803
+ Raises:
804
+ AiriaAPIError: If the API request fails or the conversation doesn't exist
805
+ """
806
+ request_data = self._pre_delete_conversation(
807
+ conversation_id=conversation_id,
808
+ correlation_id=correlation_id,
809
+ api_version=ApiVersion.V1.value,
810
+ )
811
+ self._make_request("DELETE", request_data, return_json=False)
airia/constants.py CHANGED
@@ -1,9 +1,20 @@
1
- """Constants used throughout the Airia SDK."""
1
+ """
2
+ Constants used throughout the Airia SDK.
3
+
4
+ This module defines default values for API endpoints, timeouts, and other
5
+ configuration parameters used by the SDK clients.
6
+ """
2
7
 
3
8
  # Default API endpoints
4
9
  DEFAULT_BASE_URL = "https://api.airia.ai/"
10
+ """Default base URL for the main Airia API endpoints."""
11
+
5
12
  DEFAULT_OPENAI_GATEWAY_URL = "https://gateway.airia.ai/openai/v1"
13
+ """Default base URL for the Airia OpenAI Gateway API."""
14
+
6
15
  DEFAULT_ANTHROPIC_GATEWAY_URL = "https://gateway.airia.ai/anthropic"
16
+ """Default base URL for the Airia Anthropic Gateway API."""
7
17
 
8
18
  # Default timeouts
9
- DEFAULT_TIMEOUT = 30.0
19
+ DEFAULT_TIMEOUT = 30.0
20
+ """Default timeout in seconds for API requests."""
airia/logs.py CHANGED
@@ -2,7 +2,7 @@ import os
2
2
  import sys
3
3
  import uuid
4
4
  from contextvars import ContextVar
5
- from typing import BinaryIO, Optional, TextIO, Union, overload
5
+ from typing import BinaryIO, Optional, TextIO, Union
6
6
 
7
7
  import loguru
8
8
  from loguru import logger
@@ -48,28 +48,6 @@ def correlation_id_filter(record):
48
48
  return record
49
49
 
50
50
 
51
- @overload
52
- def configure_logging(
53
- format_string: str = "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>",
54
- level: str = "INFO",
55
- sink: Union[TextIO, BinaryIO] = ...,
56
- rotation: None = None,
57
- retention: None = None,
58
- include_correlation_id: bool = True,
59
- ) -> "loguru.Logger": ...
60
-
61
-
62
- @overload
63
- def configure_logging(
64
- format_string: str = "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>",
65
- level: str = "INFO",
66
- sink: Union[str, os.PathLike[str]] = ...,
67
- rotation: Optional[str] = None,
68
- retention: Optional[str] = None,
69
- include_correlation_id: bool = True,
70
- ) -> "loguru.Logger": ...
71
-
72
-
73
51
  def configure_logging(
74
52
  format_string: str = "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>",
75
53
  level: str = "INFO",
File without changes
@@ -1,9 +1,29 @@
1
+ """
2
+ Internal data structures for HTTP request preparation.
3
+
4
+ This module defines the data models used internally by the SDK clients
5
+ to organize and pass request information between methods.
6
+ """
1
7
  from typing import Any, Dict, Optional
2
8
 
3
9
  from pydantic import BaseModel
4
10
 
5
11
 
6
12
  class RequestData(BaseModel):
13
+ """
14
+ Structured container for HTTP request components.
15
+
16
+ This internal data structure organizes all the components needed to make
17
+ an HTTP request, including the URL, headers, payload, query parameters,
18
+ and correlation ID for tracing.
19
+
20
+ Attributes:
21
+ url: The complete URL for the HTTP request
22
+ payload: Optional JSON payload for the request body
23
+ params: Optional query parameters to append to the URL
24
+ headers: HTTP headers including authentication and content-type
25
+ correlation_id: Unique identifier for request tracing and logging
26
+ """
7
27
  url: str
8
28
  payload: Optional[Dict[str, Any]]
9
29
  params: Optional[Dict[str, Any]]
@@ -1,3 +1,10 @@
1
+ """
2
+ API response models for the Airia SDK.
3
+
4
+ This package contains Pydantic models that define the structure of responses
5
+ from various Airia API endpoints, including pipeline execution, project management,
6
+ conversation handling, and configuration retrieval.
7
+ """
1
8
  from .get_projects import ProjectItem
2
9
  from .get_pipeline_config import GetPipelineConfigResponse
3
10
  from .pipeline_execution import (
@@ -6,7 +13,7 @@ from .pipeline_execution import (
6
13
  PipelineExecutionAsyncStreamedResponse,
7
14
  PipelineExecutionStreamedResponse,
8
15
  )
9
- from .conversations import CreateConversationResponse
16
+ from .conversations import CreateConversationResponse, GetConversationResponse
10
17
 
11
18
  __all__ = [
12
19
  "PipelineExecutionDebugResponse",
@@ -16,4 +23,5 @@ __all__ = [
16
23
  "GetPipelineConfigResponse",
17
24
  "ProjectItem",
18
25
  "CreateConversationResponse",
26
+ "GetConversationResponse",
19
27
  ]
@@ -1,9 +1,73 @@
1
- from typing import Optional
1
+ """
2
+ Pydantic models for conversation management API responses.
3
+
4
+ This module defines data structures for conversation operations including
5
+ creation, retrieval, and message management within the Airia platform.
6
+ """
7
+ from typing import Optional, List, Dict
8
+ from datetime import datetime
2
9
 
3
10
  from pydantic import BaseModel, Field
4
11
 
5
12
 
13
+ class PolicyRedaction(BaseModel):
14
+ """
15
+ Information about content that was redacted due to policy violations.
16
+
17
+ When content in a conversation violates platform policies, this model
18
+ tracks what was redacted and where it occurred.
19
+ """
20
+ violating_text: str = Field(alias="violatingText")
21
+ violating_message_index: int = Field(alias="violatingMessageIndex")
22
+
23
+
24
+ class ConversationMessage(BaseModel):
25
+ """
26
+ Individual message within a conversation.
27
+
28
+ Represents a single message exchange in a conversation, which can be
29
+ from a user, assistant, or system. Messages may include text content
30
+ and optional image attachments.
31
+ """
32
+ id: str
33
+ conversation_id: str = Field(alias="conversationId")
34
+ message: Optional[str] = None
35
+ created_at: datetime = Field(alias="createdAt")
36
+ updated_at: datetime = Field(alias="updatedAt")
37
+ role: str
38
+ images: Optional[List[str]] = None
39
+
40
+
41
+ class GetConversationResponse(BaseModel):
42
+ """
43
+ Complete conversation data including messages and metadata.
44
+
45
+ This response contains all information about a conversation including
46
+ its message history, associated files, execution status, and any
47
+ content moderation actions that have been applied.
48
+ """
49
+ user_id: str = Field(alias="userId")
50
+ conversation_id: str = Field(alias="conversationId")
51
+ messages: List[ConversationMessage]
52
+ title: Optional[str] = None
53
+ websocket_url: Optional[str] = Field(None, alias="websocketUrl")
54
+ deployment_id: Optional[str] = Field(None, alias="deploymentId")
55
+ data_source_files: Dict[str, List[str]] = Field(alias="dataSourceFiles")
56
+ is_bookmarked: bool = Field(alias="isBookmarked")
57
+ policy_redactions: Optional[Dict[str, PolicyRedaction]] = Field(
58
+ None, alias="policyRedactions"
59
+ )
60
+ last_execution_status: Optional[str] = Field(None, alias="lastExecutionStatus")
61
+ last_execution_id: Optional[str] = Field(None, alias="lastExecutionId")
62
+
63
+
6
64
  class CreateConversationResponse(BaseModel):
65
+ """
66
+ Response data for newly created conversations.
67
+
68
+ Contains the essential information needed to begin interacting with
69
+ a new conversation, including connection details and visual metadata.
70
+ """
7
71
  user_id: str = Field(alias="userId")
8
72
  conversation_id: str = Field(alias="conversationId")
9
73
  websocket_url: str = Field(alias="websocketUrl")