unique_toolkit 0.5.40__py3-none-any.whl → 0.5.41__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 +21 -22
- {unique_toolkit-0.5.40.dist-info → unique_toolkit-0.5.41.dist-info}/METADATA +4 -1
- {unique_toolkit-0.5.40.dist-info → unique_toolkit-0.5.41.dist-info}/RECORD +5 -5
- {unique_toolkit-0.5.40.dist-info → unique_toolkit-0.5.41.dist-info}/LICENSE +0 -0
- {unique_toolkit-0.5.40.dist-info → unique_toolkit-0.5.41.dist-info}/WHEEL +0 -0
@@ -197,29 +197,28 @@ class LanguageModelTokenLimits(BaseModel):
|
|
197
197
|
token_limit_input: Optional[int] = None
|
198
198
|
token_limit_output: Optional[int] = None
|
199
199
|
|
200
|
+
fraction_input: float = Field(default=0.4, le=1, ge=0)
|
201
|
+
|
200
202
|
@model_validator(mode="after")
|
201
|
-
def
|
202
|
-
|
203
|
-
token_limit_input
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
and token_limit_output
|
219
|
-
)
|
220
|
-
self.token_limit = token_limit_input + token_limit_output
|
221
|
-
|
222
|
-
return self
|
203
|
+
def check_required_fields(self):
|
204
|
+
# Best case input and output is determined
|
205
|
+
if self.token_limit_input and self.token_limit_output:
|
206
|
+
self.token_limit = self.token_limit_input + self.token_limit_output
|
207
|
+
self.fraction_input = self.token_limit_input / self.token_limit
|
208
|
+
return self
|
209
|
+
|
210
|
+
# Deal with case where only token_limit and optional fraction_input is given
|
211
|
+
if self.token_limit:
|
212
|
+
if not self.fraction_input:
|
213
|
+
self.fraction_input = 0.4
|
214
|
+
|
215
|
+
self.token_limit_input = self.fraction_input * self.token_limit
|
216
|
+
self.token_limit_output = (1 - self.fraction_input) * self.token_limit
|
217
|
+
return self
|
218
|
+
|
219
|
+
raise ValueError(
|
220
|
+
'Either "token_limit_input" and "token_limit_output" must be provided together, or "token_limit" must be provided.'
|
221
|
+
)
|
223
222
|
|
224
223
|
|
225
224
|
class LanguageModelToolParameterProperty(BaseModel):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unique_toolkit
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.41
|
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.41] - 2024-12-11
|
104
|
+
- Update `LanguageModelTokenLimits` includes a fraction_input now to always have input/output token limits available.
|
105
|
+
|
103
106
|
## [0.5.40] - 2024-12-11
|
104
107
|
- Add `other_options` to `LanguageModelService.complete`, `LanguageModelService.complete_async`, `LanguageModelService.stream_complete` and `LanguageModelService.stream_complete_async`
|
105
108
|
|
@@ -37,10 +37,10 @@ unique_toolkit/evaluators/output_parser.py,sha256=eI72qkzK1dZyUvnfP2SOAQCGBj_-Pw
|
|
37
37
|
unique_toolkit/evaluators/schemas.py,sha256=Jaue6Uhx75X1CyHKWj8sT3RE1JZXTqoLtfLt2xQNCX8,2507
|
38
38
|
unique_toolkit/language_model/__init__.py,sha256=YuhyczGPj6w9xX-sOVUhmozvzIFxcckHFEkeMBecr5s,1784
|
39
39
|
unique_toolkit/language_model/infos.py,sha256=kQK6F3r8xTN7oT6b39J7rxW-Y4iPXjx_Fr9bCOVQdm0,12509
|
40
|
-
unique_toolkit/language_model/schemas.py,sha256
|
40
|
+
unique_toolkit/language_model/schemas.py,sha256=-5yTJsEUMKSc6qZ1zdBU9Eewo9qQlpqlVssKHIwUY64,6925
|
41
41
|
unique_toolkit/language_model/service.py,sha256=brNCPRA0XxgqHi2rI5i2lyFCkUiw4MNMe1VaR3UgWmY,15500
|
42
42
|
unique_toolkit/language_model/utils.py,sha256=bPQ4l6_YO71w-zaIPanUUmtbXC1_hCvLK0tAFc3VCRc,1902
|
43
|
-
unique_toolkit-0.5.
|
44
|
-
unique_toolkit-0.5.
|
45
|
-
unique_toolkit-0.5.
|
46
|
-
unique_toolkit-0.5.
|
43
|
+
unique_toolkit-0.5.41.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
|
44
|
+
unique_toolkit-0.5.41.dist-info/METADATA,sha256=im-lBhwsW2ZgUZoA6mfyogye1c6ZIFXqgaw_Ilf2yLs,14764
|
45
|
+
unique_toolkit-0.5.41.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
46
|
+
unique_toolkit-0.5.41.dist-info/RECORD,,
|
File without changes
|
File without changes
|