unique_toolkit 0.8.10__py3-none-any.whl → 0.8.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.
@@ -4,6 +4,7 @@ from enum import StrEnum
4
4
  from humps import camelize
5
5
  from openai.types.chat import (
6
6
  ChatCompletionAssistantMessageParam,
7
+ ChatCompletionMessageParam,
7
8
  ChatCompletionUserMessageParam,
8
9
  )
9
10
  from openai.types.chat.chat_completion_message_function_tool_call_param import (
@@ -96,7 +97,7 @@ class ChatMessage(BaseModel):
96
97
  raise ValueError("tool_call_ids is required when role is 'tool'")
97
98
  return self
98
99
 
99
- def to_openai_param(self):
100
+ def to_openai_param(self) -> ChatCompletionMessageParam:
100
101
  match self.role:
101
102
  case ChatMessageRole.USER:
102
103
  return ChatCompletionUserMessageParam(
@@ -105,14 +106,25 @@ class ChatMessage(BaseModel):
105
106
  )
106
107
 
107
108
  case ChatMessageRole.ASSISTANT:
108
- return ChatCompletionAssistantMessageParam(
109
- role="assistant",
110
- audio=None,
111
- content=self.content or "",
112
- function_call=None,
113
- refusal=None,
114
- tool_calls=[t.to_openai_param() for t in self.tool_calls or []],
115
- )
109
+ if self.tool_calls:
110
+ assistant_message = ChatCompletionAssistantMessageParam(
111
+ role="assistant",
112
+ audio=None,
113
+ content=self.content or "",
114
+ function_call=None,
115
+ refusal=None,
116
+ tool_calls=[t.to_openai_param() for t in self.tool_calls],
117
+ )
118
+ else:
119
+ assistant_message = ChatCompletionAssistantMessageParam(
120
+ role="assistant",
121
+ audio=None,
122
+ content=self.content or "",
123
+ function_call=None,
124
+ refusal=None,
125
+ )
126
+
127
+ return assistant_message
116
128
 
117
129
  case ChatMessageRole.TOOL:
118
130
  raise NotImplementedError
@@ -402,9 +402,9 @@ class ChatService:
402
402
  references: list[ContentReference] | None = None,
403
403
  debug_info: dict | None = None,
404
404
  message_id: str | None = None,
405
- set_completed_at: bool = False,
405
+ set_completed_at: bool | None = None,
406
406
  ) -> ChatMessage:
407
- """Modifies a message in the chat session synchronously.
407
+ """Modifies a message in the chat session synchronously if parameter is not specified the corresponding field will remain as is.
408
408
 
409
409
  Args:
410
410
  content (str, optional): The new content for the message.
@@ -49,6 +49,9 @@ class OpenAIMessageBuilder:
49
49
  builder._messages = messages.copy()
50
50
  return builder
51
51
 
52
+ def append(self, message: ChatCompletionMessageParam):
53
+ self._messages.append(message)
54
+
52
55
  def system_message_append(
53
56
  self,
54
57
  content: str | Iterable[ChatCompletionContentPartTextParam],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 0.8.10
3
+ Version: 0.8.11
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Martin Fadler
@@ -114,6 +114,10 @@ All notable changes to this project will be documented in this file.
114
114
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
115
115
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
116
116
 
117
+ ## [0.8.11] - 2025-08-15
118
+ - Fix no tool call respoonse in ChatMessage -> Open Ai messages translation
119
+ - Add simple append method to OpenAIMessageBuilder
120
+
117
121
  ## [0.8.10] - 2025-08-15
118
122
  - Add min and max temperature to `LanguageModelInfo`: temperature will be clamped to the min and max temperature
119
123
  - Add default options to `LanguageModelInfo`: These are used by default
@@ -16,8 +16,8 @@ unique_toolkit/app/verification.py,sha256=GxFFwcJMy25fCA_Xe89wKW7bgqOu8PAs5y8QpH
16
16
  unique_toolkit/chat/__init__.py,sha256=LRs2G-JTVuci4lbtHTkVUiNcZcSR6uqqfnAyo7af6nY,619
17
17
  unique_toolkit/chat/constants.py,sha256=05kq6zjqUVB2d6_P7s-90nbljpB3ryxwCI-CAz0r2O4,83
18
18
  unique_toolkit/chat/functions.py,sha256=I6r81PpWNu-j9DvHxNFKN3V6T5E5q42FhW9kF8pJJSY,29950
19
- unique_toolkit/chat/schemas.py,sha256=0tWzu5_F_-PRK5A6MUsdpNqCfNAIMEAuQ26wIgP2pYs,4415
20
- unique_toolkit/chat/service.py,sha256=LNZm9JS17M-MWcVRR3o2HpQFgDkIkxnGMUCoYmz9vzA,37759
19
+ unique_toolkit/chat/schemas.py,sha256=ekmDzxZRnO4pF-8DAnP4JqKmYuJnSC5RpYcO7j5T3aI,4927
20
+ unique_toolkit/chat/service.py,sha256=iyOSzbRxAnxxGw4VrcduVPjA6cPw_98SL70YgL7V9VI,37837
21
21
  unique_toolkit/chat/state.py,sha256=Cjgwv_2vhDFbV69xxsn7SefhaoIAEqLx3ferdVFCnOg,1445
22
22
  unique_toolkit/chat/utils.py,sha256=ihm-wQykBWhB4liR3LnwPVPt_qGW6ETq21Mw4HY0THE,854
23
23
  unique_toolkit/content/__init__.py,sha256=EdJg_A_7loEtCQf4cah3QARQreJx6pdz89Rm96YbMVg,940
@@ -49,7 +49,7 @@ unique_toolkit/evaluators/schemas.py,sha256=Jaue6Uhx75X1CyHKWj8sT3RE1JZXTqoLtfLt
49
49
  unique_toolkit/framework_utilities/langchain/client.py,sha256=Msfmr7uezwqagyRJ2zjWbQRFqzDExWYK0y5KLEnDNqM,1329
50
50
  unique_toolkit/framework_utilities/langchain/history.py,sha256=R9RuCeSFNaUO3OZ0G_LmIC4gmOCIANcl91MfyWLnZ1c,650
51
51
  unique_toolkit/framework_utilities/openai/client.py,sha256=IasxPXlVJHIsZdXHin7yq-5tO4RNLUu9cEuhrgb4ghE,1205
52
- unique_toolkit/framework_utilities/openai/message_builder.py,sha256=XNtgFcgzVeTHZBjfs-fS4cgMEOWqkGObj6ygG08HdfM,4240
52
+ unique_toolkit/framework_utilities/openai/message_builder.py,sha256=VU6mJm_upLcarJQKFft_t1RlLRncWDxDuLC5LIJ5lQQ,4339
53
53
  unique_toolkit/framework_utilities/utils.py,sha256=JK7g2yMfEx3eMprug26769xqNpS5WJcizf8n2zWMBng,789
54
54
  unique_toolkit/language_model/__init__.py,sha256=lRQyLlbwHbNFf4-0foBU13UGb09lwEeodbVsfsSgaCk,1971
55
55
  unique_toolkit/language_model/builder.py,sha256=4OKfwJfj3TrgO1ezc_ewIue6W7BCQ2ZYQXUckWVPPTA,3369
@@ -82,7 +82,7 @@ unique_toolkit/tools/utils/execution/execution.py,sha256=vjG2Y6awsGNtlvyQAGCTthQ
82
82
  unique_toolkit/tools/utils/source_handling/schema.py,sha256=pvNhtL2daDLpCVIQpfdn6R35GvKmITVLXjZNLAwpgUE,871
83
83
  unique_toolkit/tools/utils/source_handling/source_formatting.py,sha256=C7uayNbdkNVJdEARA5CENnHtNY1SU6etlaqbgHNyxaQ,9152
84
84
  unique_toolkit/tools/utils/source_handling/tests/test_source_formatting.py,sha256=zu3AJnYH9CMqZPrxKEH3IgI-fM3nlvIBuspJG6W6B18,6978
85
- unique_toolkit-0.8.10.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
86
- unique_toolkit-0.8.10.dist-info/METADATA,sha256=GVFDjq3YzjeBV-w8WTtrqLKSuCYuPTc42lgv7Ev9hWk,27071
87
- unique_toolkit-0.8.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
88
- unique_toolkit-0.8.10.dist-info/RECORD,,
85
+ unique_toolkit-0.8.11.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
86
+ unique_toolkit-0.8.11.dist-info/METADATA,sha256=tfIpLbuPa7_CQnJ9BM6ZWxmgvdOhptwhJFAS9z_vaJA,27224
87
+ unique_toolkit-0.8.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
88
+ unique_toolkit-0.8.11.dist-info/RECORD,,