unique_toolkit 0.5.40__tar.gz → 0.5.42__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.
Files changed (47) hide show
  1. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/CHANGELOG.md +6 -0
  2. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/PKG-INFO +7 -1
  3. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/pyproject.toml +1 -1
  4. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/language_model/schemas.py +22 -20
  5. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/LICENSE +0 -0
  6. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/README.md +0 -0
  7. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/__init__.py +0 -0
  8. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/_common/_base_service.py +0 -0
  9. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/_common/_time_utils.py +0 -0
  10. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/_common/exception.py +0 -0
  11. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/_common/validators.py +0 -0
  12. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/app/__init__.py +0 -0
  13. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/app/init_logging.py +0 -0
  14. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/app/init_sdk.py +0 -0
  15. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/app/performance/async_tasks.py +0 -0
  16. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/app/performance/async_wrapper.py +0 -0
  17. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/app/schemas.py +0 -0
  18. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/app/verification.py +0 -0
  19. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/chat/__init__.py +0 -0
  20. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/chat/schemas.py +0 -0
  21. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/chat/service.py +0 -0
  22. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/chat/state.py +0 -0
  23. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/chat/utils.py +0 -0
  24. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/content/__init__.py +0 -0
  25. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/content/schemas.py +0 -0
  26. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/content/service.py +0 -0
  27. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/content/utils.py +0 -0
  28. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/embedding/__init__.py +0 -0
  29. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/embedding/schemas.py +0 -0
  30. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/embedding/service.py +0 -0
  31. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/embedding/utils.py +0 -0
  32. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/config.py +0 -0
  33. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/context_relevancy/constants.py +0 -0
  34. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/context_relevancy/prompts.py +0 -0
  35. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/context_relevancy/service.py +0 -0
  36. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/context_relevancy/utils.py +0 -0
  37. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/exception.py +0 -0
  38. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/hallucination/constants.py +0 -0
  39. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/hallucination/prompts.py +0 -0
  40. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/hallucination/service.py +0 -0
  41. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/hallucination/utils.py +0 -0
  42. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/output_parser.py +0 -0
  43. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/evaluators/schemas.py +0 -0
  44. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/language_model/__init__.py +0 -0
  45. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/language_model/infos.py +0 -0
  46. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/language_model/service.py +0 -0
  47. {unique_toolkit-0.5.40 → unique_toolkit-0.5.42}/unique_toolkit/language_model/utils.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.5.42] - 2024-12-11
9
+ - Update `LanguageModelTokenLimits` with fix avoiding floats for token
10
+
11
+ ## [0.5.41] - 2024-12-11
12
+ - Update `LanguageModelTokenLimits` includes a fraction_input now to always have input/output token limits available.
13
+
8
14
  ## [0.5.40] - 2024-12-11
9
15
  - Add `other_options` to `LanguageModelService.complete`, `LanguageModelService.complete_async`, `LanguageModelService.stream_complete` and `LanguageModelService.stream_complete_async`
10
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 0.5.40
3
+ Version: 0.5.42
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Martin Fadler
@@ -100,6 +100,12 @@ 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.42] - 2024-12-11
104
+ - Update `LanguageModelTokenLimits` with fix avoiding floats for token
105
+
106
+ ## [0.5.41] - 2024-12-11
107
+ - Update `LanguageModelTokenLimits` includes a fraction_input now to always have input/output token limits available.
108
+
103
109
  ## [0.5.40] - 2024-12-11
104
110
  - Add `other_options` to `LanguageModelService.complete`, `LanguageModelService.complete_async`, `LanguageModelService.stream_complete` and `LanguageModelService.stream_complete_async`
105
111
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "unique_toolkit"
3
- version = "0.5.40"
3
+ version = "0.5.42"
4
4
  description = ""
5
5
  authors = [
6
6
  "Martin Fadler <martin.fadler@unique.ch>",
@@ -1,4 +1,5 @@
1
1
  import json
2
+ import math
2
3
  from enum import StrEnum
3
4
  from typing import Any, Optional, Self
4
5
  from uuid import uuid4
@@ -197,29 +198,30 @@ class LanguageModelTokenLimits(BaseModel):
197
198
  token_limit_input: Optional[int] = None
198
199
  token_limit_output: Optional[int] = None
199
200
 
201
+ fraction_input: float = Field(default=0.4, le=1, ge=0)
202
+
200
203
  @model_validator(mode="after")
201
- def validate_model(self):
202
- token_limit = self.token_limit
203
- token_limit_input = self.token_limit_input
204
- token_limit_output = self.token_limit_output
205
-
206
- if (
207
- token_limit is None
208
- and token_limit_input is None
209
- and token_limit_output is None
210
- ):
211
- raise ValueError(
212
- "At least one of token_limit, token_limit_input or token_limit_output must be set"
204
+ def check_required_fields(self):
205
+ # Best case input and output is determined
206
+ if self.token_limit_input and self.token_limit_output:
207
+ self.token_limit = self.token_limit_input + self.token_limit_output
208
+ self.fraction_input = self.token_limit_input / self.token_limit
209
+ return self
210
+
211
+ # Deal with case where only token_limit and optional fraction_input is given
212
+ if self.token_limit:
213
+ if not self.fraction_input:
214
+ self.fraction_input = 0.4
215
+
216
+ self.token_limit_input = math.floor(self.fraction_input * self.token_limit)
217
+ self.token_limit_output = math.floor(
218
+ (1 - self.fraction_input) * self.token_limit
213
219
  )
220
+ return self
214
221
 
215
- if (
216
- token_limit is None
217
- and token_limit_input is not None
218
- and token_limit_output is not None
219
- ):
220
- self.token_limit = token_limit_input + token_limit_output
221
-
222
- return self
222
+ raise ValueError(
223
+ 'Either "token_limit_input" and "token_limit_output" must be provided together, or "token_limit" must be provided.'
224
+ )
223
225
 
224
226
 
225
227
  class LanguageModelToolParameterProperty(BaseModel):
File without changes