unique_sdk 0.10.31__tar.gz → 0.10.33__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.

Potentially problematic release.


This version of unique_sdk might be problematic. Click here for more details.

Files changed (43) hide show
  1. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/CHANGELOG.md +6 -0
  2. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/PKG-INFO +42 -19
  3. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/README.md +35 -18
  4. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/pyproject.toml +1 -1
  5. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_message.py +56 -0
  6. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_message_execution.py +12 -10
  7. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_message_log.py +9 -7
  8. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/LICENSE +0 -0
  9. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/__init__.py +0 -0
  10. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_api_requestor.py +0 -0
  11. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_api_resource.py +0 -0
  12. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_api_version.py +0 -0
  13. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_error.py +0 -0
  14. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_http_client.py +0 -0
  15. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_list_object.py +0 -0
  16. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_object_classes.py +0 -0
  17. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_request_options.py +0 -0
  18. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_unique_object.py +0 -0
  19. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_unique_ql.py +0 -0
  20. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_unique_response.py +0 -0
  21. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_util.py +0 -0
  22. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_version.py +0 -0
  23. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/_webhook.py +0 -0
  24. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/__init__.py +0 -0
  25. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_acronyms.py +0 -0
  26. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_agentic_table.py +0 -0
  27. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_chat_completion.py +0 -0
  28. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_content.py +0 -0
  29. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_embedding.py +0 -0
  30. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_event.py +0 -0
  31. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_folder.py +0 -0
  32. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_integrated.py +0 -0
  33. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_mcp.py +0 -0
  34. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_message_assessment.py +0 -0
  35. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_search.py +0 -0
  36. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_search_string.py +0 -0
  37. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_short_term_memory.py +0 -0
  38. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/api_resources/_space.py +0 -0
  39. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/utils/chat_history.py +0 -0
  40. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/utils/chat_in_space.py +0 -0
  41. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/utils/file_io.py +0 -0
  42. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/utils/sources.py +0 -0
  43. {unique_sdk-0.10.31 → unique_sdk-0.10.33}/unique_sdk/utils/token.py +0 -0
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.10.33] - 2025-10-27
9
+ - Improve messagelog and message execution types.
10
+
11
+ ## [0.10.32] - 2025-10-14
12
+ - Add function to stream to chat frontend.
13
+
8
14
  ## [0.10.31] - 2025-10-13
9
15
  - Add readme for message log and execution.
10
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.10.31
3
+ Version: 0.10.33
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -700,6 +700,26 @@ message = unique_sdk.Message.create(
700
700
  )
701
701
  ```
702
702
 
703
+ #### `unique_sdk.Message.create_event`
704
+
705
+ Create a new message event in a chat. Updating the text of a message in the chat UI is possible by creating a message update event. This function can be used for custom streaming to the chat. (Compatible with release >.42)
706
+
707
+ The event only changes the text in the UI, it *does not* update the database.
708
+
709
+ ```python
710
+ message = unique_sdk.Message.create_event(
711
+ user_id=user_id,
712
+ company_id=company_id,
713
+ messageId="msg_l4ushn85yqbewpf6tllh2cl7",
714
+ chatId="chat_kc8p3kgkn7393qhgmv5js5nt",
715
+ text="Hello.", #optional
716
+ originalText="Hello.", #optional
717
+ references=[], #optional
718
+ gptRequest={} #optional
719
+ debugInfo={ "hello": "test" }, #optional
720
+ )
721
+ ```
722
+
703
723
  #### `unique_sdk.Message.modify`
704
724
 
705
725
  Modify an existing chat message.
@@ -825,7 +845,7 @@ unique_sdk.Integrated.responses_stream(
825
845
 
826
846
  #### `unique_sdk.MessageLog.create`
827
847
 
828
- Create a message log for a provided `messageId`.
848
+ Function to update the steps section of a message in the chat UI. This is possible by creating a message log record during a message execution.
829
849
 
830
850
  ```python
831
851
  msg_log = unique_sdk.MessageLog.create(
@@ -834,10 +854,10 @@ msg_log = unique_sdk.MessageLog.create(
834
854
  messageId="msg_a0jgnt1jrqv1d3uzr450waxw",
835
855
  text="Create message log text",
836
856
  order=1,
837
- status="RUNNING", # one of "RUNNING", "COMPLETED", "FAILED"
838
- details=None, # optional, details dictionary
839
- uncitedReferences=None, # optional, references dictionary
840
- references=None, # optional, list of references
857
+ status="RUNNING", # one of "RUNNING", "COMPLETED", "FAILED"
858
+ details={}, # optional, details dictionary
859
+ uncitedReferences={}, # optional, references dictionary
860
+ references=[], # optional, list of references
841
861
  )
842
862
  ```
843
863
 
@@ -850,12 +870,12 @@ msg_log = unique_sdk.MessageLog.update(
850
870
  user_id=user_id,
851
871
  company_id=company_id,
852
872
  message_log_id="message_log_fd7z7gjljo1z2wu5g6l9q7r9",
853
- text="Update a message log text", # optional
854
- order=1, # optional
855
- status="RUNNING", # one of "RUNNING", "COMPLETED", "FAILED"
856
- details=None, # optional, details dictionary
857
- uncitedReferences=None, # optional, references dictionary
858
- references=None,
873
+ text="Update a message log text", # optional
874
+ order=1, # optional
875
+ status="RUNNING", # one of "RUNNING", "COMPLETED", "FAILED"
876
+ details={}, # optional, details dictionary
877
+ uncitedReferences={}, # optional, references dictionary
878
+ references=[], # optional, list of references
859
879
  )
860
880
  ```
861
881
 
@@ -870,10 +890,7 @@ msg_execution = unique_sdk.MessageExecution.create(
870
890
  user_id=user_id,
871
891
  company_id=company_id,
872
892
  messageId="msg_a0jgnt1jrqv143uzr750waxw",
873
- chatId="chat_nx21havszl1skchd7544oykh",
874
- type="DEEP_RESEARCH"
875
- secondsRemaining=None # optional, number defining the seconds remaining
876
- percentageCompleted=None # optional, number defining the percentage completed
893
+ type="DEEP_RESEARCH",
877
894
  )
878
895
  ```
879
896
 
@@ -898,9 +915,9 @@ msg_execution = unique_sdk.MessageExecution.update(
898
915
  user_id=user_id,
899
916
  company_id=company_id,
900
917
  messageId="msg_a0jgnt1jrqv143uzr750waxw",
901
- status="COMPLETED", # one of: COMPLETED, FAILED
902
- secondsRemaining=55 # optional, number defining the seconds remaining
903
- percentageCompleted=10 # optional, number defining the percentage completed
918
+ status="COMPLETED", # optional, one of: COMPLETED, FAILED - not specifying the status will have no effect over the status
919
+ secondsRemaining=55, # optional, number defining the seconds remaining
920
+ percentageCompleted=10, # optional, number defining the percentage completed
904
921
  )
905
922
  ```
906
923
 
@@ -1749,6 +1766,12 @@ All notable changes to this project will be documented in this file.
1749
1766
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1750
1767
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1751
1768
 
1769
+ ## [0.10.33] - 2025-10-27
1770
+ - Improve messagelog and message execution types.
1771
+
1772
+ ## [0.10.32] - 2025-10-14
1773
+ - Add function to stream to chat frontend.
1774
+
1752
1775
  ## [0.10.31] - 2025-10-13
1753
1776
  - Add readme for message log and execution.
1754
1777
 
@@ -682,6 +682,26 @@ message = unique_sdk.Message.create(
682
682
  )
683
683
  ```
684
684
 
685
+ #### `unique_sdk.Message.create_event`
686
+
687
+ Create a new message event in a chat. Updating the text of a message in the chat UI is possible by creating a message update event. This function can be used for custom streaming to the chat. (Compatible with release >.42)
688
+
689
+ The event only changes the text in the UI, it *does not* update the database.
690
+
691
+ ```python
692
+ message = unique_sdk.Message.create_event(
693
+ user_id=user_id,
694
+ company_id=company_id,
695
+ messageId="msg_l4ushn85yqbewpf6tllh2cl7",
696
+ chatId="chat_kc8p3kgkn7393qhgmv5js5nt",
697
+ text="Hello.", #optional
698
+ originalText="Hello.", #optional
699
+ references=[], #optional
700
+ gptRequest={} #optional
701
+ debugInfo={ "hello": "test" }, #optional
702
+ )
703
+ ```
704
+
685
705
  #### `unique_sdk.Message.modify`
686
706
 
687
707
  Modify an existing chat message.
@@ -807,7 +827,7 @@ unique_sdk.Integrated.responses_stream(
807
827
 
808
828
  #### `unique_sdk.MessageLog.create`
809
829
 
810
- Create a message log for a provided `messageId`.
830
+ Function to update the steps section of a message in the chat UI. This is possible by creating a message log record during a message execution.
811
831
 
812
832
  ```python
813
833
  msg_log = unique_sdk.MessageLog.create(
@@ -816,10 +836,10 @@ msg_log = unique_sdk.MessageLog.create(
816
836
  messageId="msg_a0jgnt1jrqv1d3uzr450waxw",
817
837
  text="Create message log text",
818
838
  order=1,
819
- status="RUNNING", # one of "RUNNING", "COMPLETED", "FAILED"
820
- details=None, # optional, details dictionary
821
- uncitedReferences=None, # optional, references dictionary
822
- references=None, # optional, list of references
839
+ status="RUNNING", # one of "RUNNING", "COMPLETED", "FAILED"
840
+ details={}, # optional, details dictionary
841
+ uncitedReferences={}, # optional, references dictionary
842
+ references=[], # optional, list of references
823
843
  )
824
844
  ```
825
845
 
@@ -832,12 +852,12 @@ msg_log = unique_sdk.MessageLog.update(
832
852
  user_id=user_id,
833
853
  company_id=company_id,
834
854
  message_log_id="message_log_fd7z7gjljo1z2wu5g6l9q7r9",
835
- text="Update a message log text", # optional
836
- order=1, # optional
837
- status="RUNNING", # one of "RUNNING", "COMPLETED", "FAILED"
838
- details=None, # optional, details dictionary
839
- uncitedReferences=None, # optional, references dictionary
840
- references=None,
855
+ text="Update a message log text", # optional
856
+ order=1, # optional
857
+ status="RUNNING", # one of "RUNNING", "COMPLETED", "FAILED"
858
+ details={}, # optional, details dictionary
859
+ uncitedReferences={}, # optional, references dictionary
860
+ references=[], # optional, list of references
841
861
  )
842
862
  ```
843
863
 
@@ -852,10 +872,7 @@ msg_execution = unique_sdk.MessageExecution.create(
852
872
  user_id=user_id,
853
873
  company_id=company_id,
854
874
  messageId="msg_a0jgnt1jrqv143uzr750waxw",
855
- chatId="chat_nx21havszl1skchd7544oykh",
856
- type="DEEP_RESEARCH"
857
- secondsRemaining=None # optional, number defining the seconds remaining
858
- percentageCompleted=None # optional, number defining the percentage completed
875
+ type="DEEP_RESEARCH",
859
876
  )
860
877
  ```
861
878
 
@@ -880,9 +897,9 @@ msg_execution = unique_sdk.MessageExecution.update(
880
897
  user_id=user_id,
881
898
  company_id=company_id,
882
899
  messageId="msg_a0jgnt1jrqv143uzr750waxw",
883
- status="COMPLETED", # one of: COMPLETED, FAILED
884
- secondsRemaining=55 # optional, number defining the seconds remaining
885
- percentageCompleted=10 # optional, number defining the percentage completed
900
+ status="COMPLETED", # optional, one of: COMPLETED, FAILED - not specifying the status will have no effect over the status
901
+ secondsRemaining=55, # optional, number defining the seconds remaining
902
+ percentageCompleted=10, # optional, number defining the percentage completed
886
903
  )
887
904
  ```
888
905
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "unique_sdk"
3
- version = "0.10.31"
3
+ version = "0.10.33"
4
4
  description = ""
5
5
  authors = [
6
6
  "Martin Fadler <martin.fadler@unique.ch>",
@@ -59,6 +59,16 @@ class Message(APIResource["Message"]):
59
59
  class RetrieveParams(RequestOptions):
60
60
  chatId: str
61
61
 
62
+ class CreateEventParams(RequestOptions):
63
+ messageId: str
64
+ chatId: str
65
+ originalText: NotRequired[str | None]
66
+ text: NotRequired[str | None]
67
+ references: NotRequired[List["Message.Reference"] | None]
68
+ gptRequest: NotRequired[Dict[str, Any] | None]
69
+ debugInfo: NotRequired[Dict[str, Any] | None]
70
+ completedAt: NotRequired[datetime | None]
71
+
62
72
  chatId: str
63
73
  text: Optional[str]
64
74
  role: Literal["SYSTEM", "USER", "ASSISTANT"]
@@ -303,3 +313,49 @@ class Message(APIResource["Message"]):
303
313
  company_id,
304
314
  params=params,
305
315
  )
316
+
317
+ @classmethod
318
+ def create_event(
319
+ cls,
320
+ user_id: str,
321
+ company_id: str,
322
+ **params: Unpack["Message.CreateEventParams"],
323
+ ) -> "Message":
324
+ """
325
+ Creates a new message event object.
326
+ """
327
+ message_id = params.get("messageId")
328
+ params.pop("messageId", None)
329
+ return cast(
330
+ "Message",
331
+ cls._static_request(
332
+ "post",
333
+ f"{cls.class_url()}/{message_id}/event",
334
+ user_id,
335
+ company_id,
336
+ params,
337
+ ),
338
+ )
339
+
340
+ @classmethod
341
+ async def create_event_async(
342
+ cls,
343
+ user_id: str,
344
+ company_id: str,
345
+ **params: Unpack["Message.CreateEventParams"],
346
+ ) -> "Message":
347
+ """
348
+ Creates a new message event object.
349
+ """
350
+ message_id = params.get("messageId")
351
+ params.pop("messageId", None)
352
+ return cast(
353
+ "Message",
354
+ await cls._static_request_async(
355
+ "post",
356
+ f"{cls.class_url()}/{message_id}/event",
357
+ user_id,
358
+ company_id,
359
+ params,
360
+ ),
361
+ )
@@ -8,16 +8,18 @@ class MessageExecution(APIResource["MessageExecution"]):
8
8
  OBJECT_NAME: ClassVar[Literal["message_execution"]] = "message_execution"
9
9
  RESOURCE_URL = "/message-execution"
10
10
 
11
+ TypeLiteral = Literal["DEEP_RESEARCH"]
12
+ StatusLiteral = Literal["PENDING", "RUNNING", "COMPLETED", "FAILED"]
13
+ # Only COMPLETED and FAILED statuses are allowed for update
14
+ UpdateStatusLiteral = Literal["COMPLETED", "FAILED"]
15
+
11
16
  class CreateMessageExecutionParams(RequestOptions):
12
17
  """
13
18
  Parameters for creating a message execution.
14
19
  """
15
20
 
16
21
  messageId: str
17
- chatId: str
18
- type: Literal["DEEP_RESEARCH"]
19
- secondsRemaining: NotRequired[int | None]
20
- percentageCompleted: NotRequired[int | None]
22
+ type: "MessageExecution.TypeLiteral"
21
23
 
22
24
  class GetMessageExecutionParams(RequestOptions):
23
25
  """
@@ -32,18 +34,18 @@ class MessageExecution(APIResource["MessageExecution"]):
32
34
  """
33
35
 
34
36
  messageId: str
35
- status: Literal["COMPLETED", "FAILED"]
37
+ status: NotRequired["MessageExecution.UpdateStatusLiteral | None"]
36
38
  secondsRemaining: NotRequired[int | None]
37
39
  percentageCompleted: NotRequired[int | None]
38
40
 
39
- messageExecutionId: str | None
40
- messageId: str | None
41
- status: Literal["PENDING", "RUNNING", "COMPLETED", "FAILED"]
42
- type: Literal["DEEP_RESEARCH"] = "DEEP_RESEARCH"
41
+ messageId: str
42
+ status: "MessageExecution.StatusLiteral"
43
+ type: "MessageExecution.TypeLiteral"
43
44
  secondsRemaining: int | None
44
45
  percentageCompleted: int | None
46
+ positionInQueue: int | None
45
47
  createdAt: str
46
- updatedAt: str | None
48
+ updatedAt: str
47
49
 
48
50
  @classmethod
49
51
  def create(
@@ -8,6 +8,8 @@ class MessageLog(APIResource["MessageLog"]):
8
8
  OBJECT_NAME: ClassVar[Literal["message_log"]] = "message_log"
9
9
  RESOURCE_URL = "/message-log"
10
10
 
11
+ StatusLiteral = Literal["RUNNING", "COMPLETED", "FAILED"]
12
+
11
13
  class Reference(TypedDict):
12
14
  name: str
13
15
  url: str | None
@@ -23,7 +25,7 @@ class MessageLog(APIResource["MessageLog"]):
23
25
 
24
26
  messageId: str
25
27
  text: str
26
- status: Literal["RUNNING", "COMPLETED", "FAILED"]
28
+ status: "MessageLog.StatusLiteral"
27
29
  order: int
28
30
  details: NotRequired[dict | None]
29
31
  uncitedReferences: NotRequired[dict | None]
@@ -35,21 +37,21 @@ class MessageLog(APIResource["MessageLog"]):
35
37
  """
36
38
 
37
39
  text: NotRequired[str | None]
38
- status: NotRequired[Literal["RUNNING", "COMPLETED", "FAILED"] | None]
40
+ status: NotRequired["MessageLog.StatusLiteral | None"]
39
41
  order: NotRequired[int | None]
40
42
  details: NotRequired[dict | None]
41
43
  uncitedReferences: NotRequired[dict | None]
42
44
  references: NotRequired[list["MessageLog.Reference"] | None]
43
45
 
44
- messageLogId: str | None
45
- messageId: str | None
46
- status: Literal["RUNNING", "COMPLETED", "FAILED"]
47
- text: str | None
46
+ id: str
47
+ messageId: str
48
+ status: "MessageLog.StatusLiteral"
49
+ text: str
48
50
  details: dict
49
51
  uncitedReferences: dict
50
52
  order: int
51
53
  createdAt: str
52
- updatedAt: str | None
54
+ updatedAt: str
53
55
 
54
56
  @classmethod
55
57
  def create(
File without changes