unique_toolkit 0.7.2__py3-none-any.whl → 0.7.3__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.
@@ -2,6 +2,8 @@ from typing_extensions import Self
2
2
 
3
3
  from unique_toolkit.language_model import (
4
4
  LanguageModelAssistantMessage,
5
+ LanguageModelFunction,
6
+ LanguageModelFunctionCall,
5
7
  LanguageModelMessage,
6
8
  LanguageModelMessageRole,
7
9
  LanguageModelMessages,
@@ -48,11 +50,22 @@ class MessagesBuilder:
48
50
  self.messages.append(message)
49
51
  return self
50
52
 
51
- def assistant_message_append(self, content: str) -> Self:
53
+ def assistant_message_append(
54
+ self, content: str, tool_calls: list[LanguageModelFunction] | None = None
55
+ ) -> Self:
52
56
  """Appends an assistant message to the messages list."""
53
57
  message = LanguageModelAssistantMessage(content=content)
58
+ if tool_calls:
59
+ message.tool_calls = [
60
+ LanguageModelFunctionCall(
61
+ id=tool_call.id,
62
+ type="function",
63
+ function=tool_call,
64
+ )
65
+ for tool_call in tool_calls
66
+ ]
54
67
  self.messages.append(message)
55
- return self # Return self to allow method chaining
68
+ return self
56
69
 
57
70
  def tool_message_append(self, name: str, tool_call_id: str, content: str) -> Self:
58
71
  """Appends a tool message to the messages list."""
@@ -60,7 +73,7 @@ class MessagesBuilder:
60
73
  name=name, tool_call_id=tool_call_id, content=content
61
74
  )
62
75
  self.messages.append(message)
63
- return self # Return self to allow method chaining
76
+ return self
64
77
 
65
78
  def build(self, reset: bool = True) -> LanguageModelMessages:
66
79
  """Returns the list of messages and resets the builder"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Martin Fadler
@@ -112,6 +112,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
112
112
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
113
113
 
114
114
 
115
+ ## [0.7.3] - 2025-03-20
116
+ - Enable handling tool calls in message builder
117
+
115
118
  ## [0.7.2] - 2025-03-17
116
119
  - HotFix `ContentService.search_content_chunks` to use `chat_id` from event if provided.
117
120
 
@@ -45,7 +45,7 @@ unique_toolkit/evaluators/hallucination/utils.py,sha256=4KTJH8low_fBzOcuVlcHB2FR
45
45
  unique_toolkit/evaluators/output_parser.py,sha256=eI72qkzK1dZyUvnfP2SOAQCGBj_-PwX5wy_aLPMsJMY,883
46
46
  unique_toolkit/evaluators/schemas.py,sha256=Jaue6Uhx75X1CyHKWj8sT3RE1JZXTqoLtfLt2xQNCX8,2507
47
47
  unique_toolkit/language_model/__init__.py,sha256=jWko_vQj48wjnpTtlkg8iNdef0SMI3FN2kGywXRTMzg,1880
48
- unique_toolkit/language_model/builder.py,sha256=_lUL2shMN1Je2LLYu2PiehOvfWtn5pg1yUuYyiw3f_c,2710
48
+ unique_toolkit/language_model/builder.py,sha256=aIAXWWUoB5G-HONJiAt3MdRGd4jdP8nA-HYX2D2WlSI,3048
49
49
  unique_toolkit/language_model/constants.py,sha256=B-topqW0r83dkC_25DeQfnPk3n53qzIHUCBS7YJ0-1U,119
50
50
  unique_toolkit/language_model/functions.py,sha256=I5jHhHsKoq7GwEQyTrM8LXB2n_6dvMAk7UklenjuHSY,7945
51
51
  unique_toolkit/language_model/infos.py,sha256=HRdQLG3oetwc-bPHtsXvDRRLsK7fSsC1q8FubvxLMsw,16459
@@ -58,7 +58,7 @@ unique_toolkit/short_term_memory/constants.py,sha256=698CL6-wjup2MvU19RxSmQk3gX7
58
58
  unique_toolkit/short_term_memory/functions.py,sha256=3WiK-xatY5nh4Dr5zlDUye1k3E6kr41RiscwtTplw5k,4484
59
59
  unique_toolkit/short_term_memory/schemas.py,sha256=OhfcXyF6ACdwIXW45sKzjtZX_gkcJs8FEZXcgQTNenw,1406
60
60
  unique_toolkit/short_term_memory/service.py,sha256=0wrwuo6K17Edcuiwp5LMCvxFuBSDP82HF0_5qwi0nYc,5307
61
- unique_toolkit-0.7.2.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
62
- unique_toolkit-0.7.2.dist-info/METADATA,sha256=grlxS6ihrKZ5fk-IeNN7iGqMK0iKVkAPMOzN8Kx-u28,20871
63
- unique_toolkit-0.7.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
64
- unique_toolkit-0.7.2.dist-info/RECORD,,
61
+ unique_toolkit-0.7.3.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
62
+ unique_toolkit-0.7.3.dist-info/METADATA,sha256=ynA_2RASnYvrs5DSqAcq7-taxnu1iZQe2gSRBiJupd4,20944
63
+ unique_toolkit-0.7.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
64
+ unique_toolkit-0.7.3.dist-info/RECORD,,