unique_toolkit 0.5.48__py3-none-any.whl → 0.5.49__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.
- unique_toolkit/language_model/schemas.py +16 -7
- {unique_toolkit-0.5.48.dist-info → unique_toolkit-0.5.49.dist-info}/METADATA +4 -1
- {unique_toolkit-0.5.48.dist-info → unique_toolkit-0.5.49.dist-info}/RECORD +5 -5
- {unique_toolkit-0.5.48.dist-info → unique_toolkit-0.5.49.dist-info}/LICENSE +0 -0
- {unique_toolkit-0.5.48.dist-info → unique_toolkit-0.5.49.dist-info}/WHEEL +0 -0
@@ -35,7 +35,7 @@ class LanguageModelMessageRole(StrEnum):
|
|
35
35
|
class LanguageModelFunction(BaseModel):
|
36
36
|
model_config = model_config
|
37
37
|
|
38
|
-
id:
|
38
|
+
id: str | None = None
|
39
39
|
name: str
|
40
40
|
arguments: Optional[dict[str, Any] | str] = None # type: ignore
|
41
41
|
|
@@ -63,8 +63,8 @@ class LanguageModelFunction(BaseModel):
|
|
63
63
|
class LanguageModelFunctionCall(BaseModel):
|
64
64
|
model_config = model_config
|
65
65
|
|
66
|
-
id:
|
67
|
-
type:
|
66
|
+
id: str | None = None
|
67
|
+
type: str | None = None
|
68
68
|
function: LanguageModelFunction
|
69
69
|
|
70
70
|
@staticmethod
|
@@ -88,10 +88,17 @@ class LanguageModelFunctionCall(BaseModel):
|
|
88
88
|
class LanguageModelMessage(BaseModel):
|
89
89
|
model_config = model_config
|
90
90
|
role: LanguageModelMessageRole
|
91
|
-
content:
|
91
|
+
content: str | list[dict] | None = None
|
92
92
|
|
93
93
|
def __str__(self):
|
94
|
-
|
94
|
+
if not self.content:
|
95
|
+
message = ""
|
96
|
+
if isinstance(self.content, str):
|
97
|
+
message = self.content
|
98
|
+
elif isinstance(self.content, list):
|
99
|
+
message = json.dumps(self.content)
|
100
|
+
|
101
|
+
return format_message(self.role.capitalize(), message=message, num_tabs=1)
|
95
102
|
|
96
103
|
|
97
104
|
class LanguageModelSystemMessage(LanguageModelMessage):
|
@@ -112,7 +119,9 @@ class LanguageModelUserMessage(LanguageModelMessage):
|
|
112
119
|
|
113
120
|
class LanguageModelAssistantMessage(LanguageModelMessage):
|
114
121
|
role: LanguageModelMessageRole = LanguageModelMessageRole.ASSISTANT
|
115
|
-
|
122
|
+
parsed: dict | None = None
|
123
|
+
refusal: str | None = None
|
124
|
+
tool_calls: list[LanguageModelFunctionCall] | None = None
|
116
125
|
|
117
126
|
@field_validator("role", mode="before")
|
118
127
|
def set_role(cls, value):
|
@@ -178,7 +187,7 @@ class LanguageModelStreamResponseMessage(BaseModel):
|
|
178
187
|
) # Stream response can return a null previous_message_id if an assisstant message is manually added
|
179
188
|
role: LanguageModelMessageRole
|
180
189
|
text: str
|
181
|
-
original_text:
|
190
|
+
original_text: str | None = None
|
182
191
|
references: list[dict[str, list | dict | str | int | float | bool]] = [] # type: ignore
|
183
192
|
|
184
193
|
# TODO make sdk return role in lowercase
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unique_toolkit
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.49
|
4
4
|
Summary:
|
5
5
|
License: Proprietary
|
6
6
|
Author: Martin Fadler
|
@@ -100,6 +100,9 @@ All notable changes to this project will be documented in this file.
|
|
100
100
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
101
101
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
102
102
|
|
103
|
+
## [0.5.49] - 2025-01-24
|
104
|
+
- Add `parsed` and `refusal` to `LanguageModelAssistantMessage` to support structured output
|
105
|
+
|
103
106
|
## [0.5.48] - 2025-01-19
|
104
107
|
- Added the possibility define tool parameters with a json schema (Useful when generating tool parameters from a pydantic object)
|
105
108
|
|
@@ -39,12 +39,12 @@ unique_toolkit/language_model/__init__.py,sha256=hgk5yiFF4SpIcE2QSoki9YknFxmcKnq
|
|
39
39
|
unique_toolkit/language_model/builder.py,sha256=nsRqWO_2dgFehK5CgtqR5aqXgYUU0QL6mR0lALPrQXM,1898
|
40
40
|
unique_toolkit/language_model/infos.py,sha256=NgoV05ausVWMqrYqgH6i3s7tYG7mejupROIF_bwEGZo,13050
|
41
41
|
unique_toolkit/language_model/prompt.py,sha256=JSawaLjQg3VR-E2fK8engFyJnNdk21zaO8pPIodzN4Q,3991
|
42
|
-
unique_toolkit/language_model/schemas.py,sha256=
|
42
|
+
unique_toolkit/language_model/schemas.py,sha256=87511yupvea-U6sfKWfelETevNMVPevhj7mEqX5FszU,7461
|
43
43
|
unique_toolkit/language_model/service.py,sha256=brNCPRA0XxgqHi2rI5i2lyFCkUiw4MNMe1VaR3UgWmY,15500
|
44
44
|
unique_toolkit/language_model/utils.py,sha256=bPQ4l6_YO71w-zaIPanUUmtbXC1_hCvLK0tAFc3VCRc,1902
|
45
45
|
unique_toolkit/short_term_memory/schemas.py,sha256=OhfcXyF6ACdwIXW45sKzjtZX_gkcJs8FEZXcgQTNenw,1406
|
46
46
|
unique_toolkit/short_term_memory/service.py,sha256=Jd9P72-VvJy7hnqNrjmrmB5BHmsKuOpTiT0Jr-dBbsQ,1682
|
47
|
-
unique_toolkit-0.5.
|
48
|
-
unique_toolkit-0.5.
|
49
|
-
unique_toolkit-0.5.
|
50
|
-
unique_toolkit-0.5.
|
47
|
+
unique_toolkit-0.5.49.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
|
48
|
+
unique_toolkit-0.5.49.dist-info/METADATA,sha256=y2wgnOvbhd2PaXa5wshMxjmQ-hNrkaKhqalKAtr5K4E,15819
|
49
|
+
unique_toolkit-0.5.49.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
50
|
+
unique_toolkit-0.5.49.dist-info/RECORD,,
|
File without changes
|
File without changes
|