unique_toolkit 0.7.9__py3-none-any.whl → 1.33.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.
Files changed (190) hide show
  1. unique_toolkit/__init__.py +36 -3
  2. unique_toolkit/_common/api_calling/human_verification_manager.py +357 -0
  3. unique_toolkit/_common/base_model_type_attribute.py +303 -0
  4. unique_toolkit/_common/chunk_relevancy_sorter/config.py +49 -0
  5. unique_toolkit/_common/chunk_relevancy_sorter/exception.py +5 -0
  6. unique_toolkit/_common/chunk_relevancy_sorter/schemas.py +46 -0
  7. unique_toolkit/_common/chunk_relevancy_sorter/service.py +374 -0
  8. unique_toolkit/_common/chunk_relevancy_sorter/tests/test_service.py +275 -0
  9. unique_toolkit/_common/default_language_model.py +12 -0
  10. unique_toolkit/_common/docx_generator/__init__.py +7 -0
  11. unique_toolkit/_common/docx_generator/config.py +12 -0
  12. unique_toolkit/_common/docx_generator/schemas.py +80 -0
  13. unique_toolkit/_common/docx_generator/service.py +225 -0
  14. unique_toolkit/_common/docx_generator/template/Doc Template.docx +0 -0
  15. unique_toolkit/_common/endpoint_builder.py +368 -0
  16. unique_toolkit/_common/endpoint_requestor.py +480 -0
  17. unique_toolkit/_common/exception.py +24 -0
  18. unique_toolkit/_common/experimental/endpoint_builder.py +368 -0
  19. unique_toolkit/_common/experimental/endpoint_requestor.py +488 -0
  20. unique_toolkit/_common/feature_flags/schema.py +9 -0
  21. unique_toolkit/_common/pydantic/rjsf_tags.py +936 -0
  22. unique_toolkit/_common/pydantic_helpers.py +174 -0
  23. unique_toolkit/_common/referencing.py +53 -0
  24. unique_toolkit/_common/string_utilities.py +140 -0
  25. unique_toolkit/_common/tests/test_referencing.py +521 -0
  26. unique_toolkit/_common/tests/test_string_utilities.py +506 -0
  27. unique_toolkit/_common/token/image_token_counting.py +67 -0
  28. unique_toolkit/_common/token/token_counting.py +204 -0
  29. unique_toolkit/_common/utils/__init__.py +1 -0
  30. unique_toolkit/_common/utils/files.py +43 -0
  31. unique_toolkit/_common/utils/image/encode.py +25 -0
  32. unique_toolkit/_common/utils/jinja/helpers.py +10 -0
  33. unique_toolkit/_common/utils/jinja/render.py +18 -0
  34. unique_toolkit/_common/utils/jinja/schema.py +65 -0
  35. unique_toolkit/_common/utils/jinja/utils.py +80 -0
  36. unique_toolkit/_common/utils/structured_output/__init__.py +1 -0
  37. unique_toolkit/_common/utils/structured_output/schema.py +5 -0
  38. unique_toolkit/_common/utils/write_configuration.py +51 -0
  39. unique_toolkit/_common/validators.py +101 -4
  40. unique_toolkit/agentic/__init__.py +1 -0
  41. unique_toolkit/agentic/debug_info_manager/debug_info_manager.py +28 -0
  42. unique_toolkit/agentic/debug_info_manager/test/test_debug_info_manager.py +278 -0
  43. unique_toolkit/agentic/evaluation/config.py +36 -0
  44. unique_toolkit/{evaluators → agentic/evaluation}/context_relevancy/prompts.py +25 -0
  45. unique_toolkit/agentic/evaluation/context_relevancy/schema.py +80 -0
  46. unique_toolkit/agentic/evaluation/context_relevancy/service.py +273 -0
  47. unique_toolkit/agentic/evaluation/evaluation_manager.py +218 -0
  48. unique_toolkit/agentic/evaluation/hallucination/constants.py +61 -0
  49. unique_toolkit/agentic/evaluation/hallucination/hallucination_evaluation.py +112 -0
  50. unique_toolkit/{evaluators → agentic/evaluation}/hallucination/prompts.py +1 -1
  51. unique_toolkit/{evaluators → agentic/evaluation}/hallucination/service.py +20 -16
  52. unique_toolkit/{evaluators → agentic/evaluation}/hallucination/utils.py +32 -21
  53. unique_toolkit/{evaluators → agentic/evaluation}/output_parser.py +20 -2
  54. unique_toolkit/{evaluators → agentic/evaluation}/schemas.py +27 -7
  55. unique_toolkit/agentic/evaluation/tests/test_context_relevancy_service.py +253 -0
  56. unique_toolkit/agentic/evaluation/tests/test_output_parser.py +87 -0
  57. unique_toolkit/agentic/history_manager/history_construction_with_contents.py +298 -0
  58. unique_toolkit/agentic/history_manager/history_manager.py +241 -0
  59. unique_toolkit/agentic/history_manager/loop_token_reducer.py +484 -0
  60. unique_toolkit/agentic/history_manager/utils.py +96 -0
  61. unique_toolkit/agentic/message_log_manager/__init__.py +5 -0
  62. unique_toolkit/agentic/message_log_manager/service.py +93 -0
  63. unique_toolkit/agentic/postprocessor/postprocessor_manager.py +212 -0
  64. unique_toolkit/agentic/reference_manager/reference_manager.py +103 -0
  65. unique_toolkit/agentic/responses_api/__init__.py +19 -0
  66. unique_toolkit/agentic/responses_api/postprocessors/code_display.py +71 -0
  67. unique_toolkit/agentic/responses_api/postprocessors/generated_files.py +297 -0
  68. unique_toolkit/agentic/responses_api/stream_handler.py +15 -0
  69. unique_toolkit/agentic/short_term_memory_manager/persistent_short_term_memory_manager.py +141 -0
  70. unique_toolkit/agentic/thinking_manager/thinking_manager.py +103 -0
  71. unique_toolkit/agentic/tools/__init__.py +1 -0
  72. unique_toolkit/agentic/tools/a2a/__init__.py +36 -0
  73. unique_toolkit/agentic/tools/a2a/config.py +17 -0
  74. unique_toolkit/agentic/tools/a2a/evaluation/__init__.py +15 -0
  75. unique_toolkit/agentic/tools/a2a/evaluation/_utils.py +66 -0
  76. unique_toolkit/agentic/tools/a2a/evaluation/config.py +55 -0
  77. unique_toolkit/agentic/tools/a2a/evaluation/evaluator.py +260 -0
  78. unique_toolkit/agentic/tools/a2a/evaluation/summarization_user_message.j2 +9 -0
  79. unique_toolkit/agentic/tools/a2a/manager.py +55 -0
  80. unique_toolkit/agentic/tools/a2a/postprocessing/__init__.py +21 -0
  81. unique_toolkit/agentic/tools/a2a/postprocessing/_display_utils.py +240 -0
  82. unique_toolkit/agentic/tools/a2a/postprocessing/_ref_utils.py +84 -0
  83. unique_toolkit/agentic/tools/a2a/postprocessing/config.py +78 -0
  84. unique_toolkit/agentic/tools/a2a/postprocessing/display.py +264 -0
  85. unique_toolkit/agentic/tools/a2a/postprocessing/references.py +101 -0
  86. unique_toolkit/agentic/tools/a2a/postprocessing/test/test_display.py +421 -0
  87. unique_toolkit/agentic/tools/a2a/postprocessing/test/test_display_utils.py +2103 -0
  88. unique_toolkit/agentic/tools/a2a/postprocessing/test/test_ref_utils.py +603 -0
  89. unique_toolkit/agentic/tools/a2a/prompts.py +46 -0
  90. unique_toolkit/agentic/tools/a2a/response_watcher/__init__.py +6 -0
  91. unique_toolkit/agentic/tools/a2a/response_watcher/service.py +91 -0
  92. unique_toolkit/agentic/tools/a2a/tool/__init__.py +4 -0
  93. unique_toolkit/agentic/tools/a2a/tool/_memory.py +26 -0
  94. unique_toolkit/agentic/tools/a2a/tool/_schema.py +9 -0
  95. unique_toolkit/agentic/tools/a2a/tool/config.py +158 -0
  96. unique_toolkit/agentic/tools/a2a/tool/service.py +393 -0
  97. unique_toolkit/agentic/tools/agent_chunks_hanlder.py +65 -0
  98. unique_toolkit/agentic/tools/config.py +128 -0
  99. unique_toolkit/agentic/tools/factory.py +44 -0
  100. unique_toolkit/agentic/tools/mcp/__init__.py +4 -0
  101. unique_toolkit/agentic/tools/mcp/manager.py +71 -0
  102. unique_toolkit/agentic/tools/mcp/models.py +28 -0
  103. unique_toolkit/agentic/tools/mcp/tool_wrapper.py +234 -0
  104. unique_toolkit/agentic/tools/openai_builtin/__init__.py +11 -0
  105. unique_toolkit/agentic/tools/openai_builtin/base.py +46 -0
  106. unique_toolkit/agentic/tools/openai_builtin/code_interpreter/__init__.py +8 -0
  107. unique_toolkit/agentic/tools/openai_builtin/code_interpreter/config.py +88 -0
  108. unique_toolkit/agentic/tools/openai_builtin/code_interpreter/service.py +250 -0
  109. unique_toolkit/agentic/tools/openai_builtin/manager.py +79 -0
  110. unique_toolkit/agentic/tools/schemas.py +145 -0
  111. unique_toolkit/agentic/tools/test/test_mcp_manager.py +536 -0
  112. unique_toolkit/agentic/tools/test/test_tool_progress_reporter.py +445 -0
  113. unique_toolkit/agentic/tools/tool.py +187 -0
  114. unique_toolkit/agentic/tools/tool_manager.py +492 -0
  115. unique_toolkit/agentic/tools/tool_progress_reporter.py +285 -0
  116. unique_toolkit/agentic/tools/utils/__init__.py +19 -0
  117. unique_toolkit/agentic/tools/utils/execution/__init__.py +1 -0
  118. unique_toolkit/agentic/tools/utils/execution/execution.py +286 -0
  119. unique_toolkit/agentic/tools/utils/source_handling/__init__.py +0 -0
  120. unique_toolkit/agentic/tools/utils/source_handling/schema.py +21 -0
  121. unique_toolkit/agentic/tools/utils/source_handling/source_formatting.py +207 -0
  122. unique_toolkit/agentic/tools/utils/source_handling/tests/test_source_formatting.py +216 -0
  123. unique_toolkit/app/__init__.py +9 -0
  124. unique_toolkit/app/dev_util.py +180 -0
  125. unique_toolkit/app/fast_api_factory.py +131 -0
  126. unique_toolkit/app/init_sdk.py +32 -1
  127. unique_toolkit/app/schemas.py +206 -31
  128. unique_toolkit/app/unique_settings.py +367 -0
  129. unique_toolkit/app/webhook.py +77 -0
  130. unique_toolkit/chat/__init__.py +8 -1
  131. unique_toolkit/chat/deprecated/service.py +232 -0
  132. unique_toolkit/chat/functions.py +648 -78
  133. unique_toolkit/chat/rendering.py +34 -0
  134. unique_toolkit/chat/responses_api.py +461 -0
  135. unique_toolkit/chat/schemas.py +134 -2
  136. unique_toolkit/chat/service.py +115 -767
  137. unique_toolkit/content/functions.py +353 -8
  138. unique_toolkit/content/schemas.py +128 -15
  139. unique_toolkit/content/service.py +321 -45
  140. unique_toolkit/content/smart_rules.py +301 -0
  141. unique_toolkit/content/utils.py +10 -3
  142. unique_toolkit/data_extraction/README.md +96 -0
  143. unique_toolkit/data_extraction/__init__.py +11 -0
  144. unique_toolkit/data_extraction/augmented/__init__.py +5 -0
  145. unique_toolkit/data_extraction/augmented/service.py +93 -0
  146. unique_toolkit/data_extraction/base.py +25 -0
  147. unique_toolkit/data_extraction/basic/__init__.py +11 -0
  148. unique_toolkit/data_extraction/basic/config.py +18 -0
  149. unique_toolkit/data_extraction/basic/prompt.py +13 -0
  150. unique_toolkit/data_extraction/basic/service.py +55 -0
  151. unique_toolkit/embedding/service.py +103 -12
  152. unique_toolkit/framework_utilities/__init__.py +1 -0
  153. unique_toolkit/framework_utilities/langchain/__init__.py +10 -0
  154. unique_toolkit/framework_utilities/langchain/client.py +71 -0
  155. unique_toolkit/framework_utilities/langchain/history.py +19 -0
  156. unique_toolkit/framework_utilities/openai/__init__.py +6 -0
  157. unique_toolkit/framework_utilities/openai/client.py +84 -0
  158. unique_toolkit/framework_utilities/openai/message_builder.py +229 -0
  159. unique_toolkit/framework_utilities/utils.py +23 -0
  160. unique_toolkit/language_model/__init__.py +3 -0
  161. unique_toolkit/language_model/_responses_api_utils.py +93 -0
  162. unique_toolkit/language_model/builder.py +27 -11
  163. unique_toolkit/language_model/default_language_model.py +3 -0
  164. unique_toolkit/language_model/functions.py +345 -43
  165. unique_toolkit/language_model/infos.py +1288 -46
  166. unique_toolkit/language_model/reference.py +242 -0
  167. unique_toolkit/language_model/schemas.py +481 -49
  168. unique_toolkit/language_model/service.py +229 -28
  169. unique_toolkit/protocols/support.py +145 -0
  170. unique_toolkit/services/__init__.py +7 -0
  171. unique_toolkit/services/chat_service.py +1631 -0
  172. unique_toolkit/services/knowledge_base.py +1094 -0
  173. unique_toolkit/short_term_memory/service.py +178 -41
  174. unique_toolkit/smart_rules/__init__.py +0 -0
  175. unique_toolkit/smart_rules/compile.py +56 -0
  176. unique_toolkit/test_utilities/events.py +197 -0
  177. unique_toolkit-1.33.3.dist-info/METADATA +1145 -0
  178. unique_toolkit-1.33.3.dist-info/RECORD +205 -0
  179. unique_toolkit/evaluators/__init__.py +0 -1
  180. unique_toolkit/evaluators/config.py +0 -35
  181. unique_toolkit/evaluators/constants.py +0 -1
  182. unique_toolkit/evaluators/context_relevancy/constants.py +0 -32
  183. unique_toolkit/evaluators/context_relevancy/service.py +0 -53
  184. unique_toolkit/evaluators/context_relevancy/utils.py +0 -142
  185. unique_toolkit/evaluators/hallucination/constants.py +0 -41
  186. unique_toolkit-0.7.9.dist-info/METADATA +0 -413
  187. unique_toolkit-0.7.9.dist-info/RECORD +0 -64
  188. /unique_toolkit/{evaluators → agentic/evaluation}/exception.py +0 -0
  189. {unique_toolkit-0.7.9.dist-info → unique_toolkit-1.33.3.dist-info}/LICENSE +0 -0
  190. {unique_toolkit-0.7.9.dist-info → unique_toolkit-1.33.3.dist-info}/WHEEL +0 -0
@@ -1,413 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: unique_toolkit
3
- Version: 0.7.9
4
- Summary:
5
- License: Proprietary
6
- Author: Martin Fadler
7
- Author-email: martin.fadler@unique.ch
8
- Requires-Python: >=3.11,<4.0
9
- Classifier: License :: Other/Proprietary License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Requires-Dist: numpy (>=1.26.4,<2.0.0)
14
- Requires-Dist: pydantic (>=2.8.2,<3.0.0)
15
- Requires-Dist: pyhumps (>=3.8.0,<4.0.0)
16
- Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
17
- Requires-Dist: regex (>=2024.5.15,<2025.0.0)
18
- Requires-Dist: tiktoken (>=0.7.0,<0.8.0)
19
- Requires-Dist: typing-extensions (>=4.9.0,<5.0.0)
20
- Requires-Dist: unique-sdk (>=0.9.17,<0.10.0)
21
- Description-Content-Type: text/markdown
22
-
23
- # Unique Toolkit
24
-
25
- This package provides highlevel abstractions and methods on top of `unique_sdk` to ease application development for the Unique Platform.
26
-
27
- The Toolkit is structured along the following domains:
28
- - `unique_toolkit.chat`
29
- - `unique_toolkit.content`
30
- - `unique_toolkit.embedding`
31
- - `unique_toolkit.language_model`
32
- - `unique_toolkit.short_term_memory`
33
-
34
- Each domain comprises a set of functions (in `functions.py`) and a service class (in `service.py`) which encapsulates the basic functionalities to interact with the domain entities, the schemas (in `schemas.py`) used in the service and required for interacting with the service functions, utility functions (in `utils.py`) which give additional functionality to interact with the domain entities (all domains except embedding) and other domain specific functionalities which are explained in the respective domain documentation.
35
-
36
- In addition, the `unique_toolkit.app` module provides functions to initialize apps that interact with the Unique platform. It also includes some utility functions to run async tasks in parallel (async webserver and app implementation required).
37
-
38
- ## Changelog
39
-
40
- See the [CHANGELOG.md](https://github.com/Unique-AG/ai/blob/main/unique_toolkit/CHANGELOG.md) file for details on changes and version history.
41
-
42
- # Domains
43
-
44
- ## App
45
-
46
- The `unique_toolkit.app` module encompasses functions for initializing and securing apps that will interact with the Unique platform.
47
-
48
- - `init_logging.py` can be used to initalize the logger either with unique dictConfig or an any other dictConfig.
49
- - `init_sdk.py` can be used to initialize the sdk using the correct env variables and retrieving the endpoint secret.
50
- - `schemas.py` contains the Event schema which can be used to parse and validate the unique.chat.external-module.chosen event.
51
- - `verification.py` can be used to verify the endpoint secret and construct the event.
52
-
53
- ## Chat
54
-
55
- The `unique_toolkit.chat` module encompasses all chat related functionality.
56
-
57
- - `functions.py` comprises the functions to manage and load the chat history and interact with the chat ui, e.g., creating a new assistant message.
58
- - `service.py` comprises the ChatService and provides an interface to manage and load the chat history and interact with the chat ui, e.g., creating a new assistant message and stream complete.
59
- - `schemas.py` comprises all relevant schemas, e.g., ChatMessage, used in the ChatService.
60
- - `utils.py` comprises utility functions to use and convert ChatMessage objects in assistants, e.g., convert_chat_history_to_injectable_string converts the chat history to a string that can be injected into a prompt.
61
-
62
- ## Content
63
-
64
- The `unique_toolkit.content` module encompasses all content related functionality. Content can be any type of textual data that is stored in the Knowledgebase on the Unique platform. During the ingestion of the content, the content is parsed, split in chunks, indexed, and stored in the database.
65
-
66
- - `functions.py` comprises the functions to manage and load the chat history and interact with the chat ui, e.g., creating a new assistant message.
67
- - `service.py` comprises the ContentService and provides an interface to interact with the content, e.g., search content, search content chunks, upload and download content.
68
- - `schemas.py` comprises all relevant schemas, e.g., Content and ContentChunk, used in the ContentService.
69
- - `utils.py` comprise utility functions to manipulate Content and ContentChunk objects, e.g., sort_content_chunks and merge_content_chunks.
70
-
71
- ## Embedding
72
-
73
- The `unique_toolkit.embedding` module encompasses all embedding related functionality. Embeddings are used to represent textual data in a high-dimensional space. The embeddings can be used to calculate the similarity between two texts, for instance.
74
-
75
- - `functions.py` comprises the functions to embed text and calculate the similarity between two texts.
76
- - `service.py` encompasses the EmbeddingService and provides an interface to interact with the embeddings, e.g., embed text and calculate the similarity between two texts.
77
- - `schemas.py` comprises all relevant schemas, e.g., Embeddings, used in the EmbeddingService.
78
-
79
- ## Language Model
80
-
81
- The `unique_toolkit.language_model` module encompasses all language model related functionality and information on the different language models deployed through the
82
- Unique platform.
83
-
84
- - `infos.py` comprises the information on all language models deployed through the Unique platform. We recommend to use the LanguageModel class, initialized with the LanguageModelName, e.g., LanguageModel(LanguageModelName.AZURE_GPT_35_TURBO_0125) to get the information on the specific language model like the name, version, token limits or retirement date.
85
- - `functions.py` comprises the functions to complete and stream complete to chat.
86
- - `service.py` comprises the LanguageModelService and provides an interface to interact with the language models, e.g., complete.
87
- - `schemas.py` comprises all relevant schemas, e.g., LanguageModelResponse, used in the LanguageModelService.
88
- - `utils.py` comprises utility functions to parse the output of the language model, e.g., convert_string_to_json finds and parses the last json object in a string.
89
-
90
- ## Short Term Memory
91
-
92
- The `unique_toolkit.short_term_memory` module encompasses all short term memory related functionality.
93
-
94
- - `functions.py` comprises the functions to manage and load the chat history and interact with the chat ui, e.g., creating a new assistant message.
95
- - `service.py` comprises the ShortTermMemoryService and provides an interface to interact with the short term memory, e.g., create memory.
96
- - `schemas.py` comprises all relevant schemas, e.g., ShortTermMemory, used in the ShortTermMemoryService.
97
-
98
- # Development instructions
99
-
100
- 1. Install poetry on your system (through `brew` or `pipx`).
101
-
102
- 2. Install `pyenv` and install python 3.11. `pyenv` is recommended as otherwise poetry uses the python version used to install itself and not the user preferred python version.
103
-
104
- 3. If you then run `python --version` in your terminal, you should be able to see python version as specified in `.python-version`.
105
-
106
- 4. Then finally run `poetry install` to install the package and all dependencies.
107
- # Changelog
108
-
109
- All notable changes to this project will be documented in this file.
110
-
111
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
112
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
113
-
114
- ## [0.7.9] - 2025-04-17
115
- - add `AZURE_GPT_41_2025_0414` as part of the models
116
-
117
- ## [0.7.8] - 2025-04-08
118
- - add `AZURE_GPT_4o_2024_1120` as part of the models
119
-
120
- ## [0.7.7] - 2025-04-11
121
- - Add tool choice parameter to chat event payload
122
-
123
- ## [0.7.6] - 2025-04-08
124
- - De provisioning o1-preview
125
-
126
- ## [0.7.5] - 2025-04-07
127
- - Skip None values when serializing to json schema for LanguageModelInfo
128
-
129
- ## [0.7.4] - 2025-03-20
130
- - add `AZURE_GPT_45_PREVIEW_2025_0227` as part of the models
131
-
132
- ## [0.7.3] - 2025-03-20
133
- - Enable handling tool calls in message builder
134
-
135
- ## [0.7.2] - 2025-03-17
136
- - HotFix `ContentService.search_content_chunks` to use `chat_id` from event if provided.
137
-
138
- ## [0.7.1] - 2025-03-11
139
- - Fix Breaking change: `ContentService.search_content_chunks` `ContentService.search_content_chunks` now accepts`chat_id` for the specific to handle chat_only instances
140
-
141
- ## [0.7.0] - 2025-03-11
142
- - Fix the issue with `ShortTermMemoryService.create_memory_async` adding `self.chat_id` and `self.message_id` as part of the parameter.
143
- - Breaking change: `ContentService.search_content_on_chat` now requires you pass in a `chat_id` for the specific chat instance
144
-
145
- ## [0.6.9] - 2025-03-11
146
- - Add o1-preview as part of the language model info, make the name consistent across board.
147
-
148
- ## [0.6.8] - 2025-03-11
149
- - Add `verify_request_and_construct_event` to `verification.py`
150
-
151
- ## [0.6.7] - 2025-03-10
152
- - Extend language model message builder
153
-
154
- ## [0.6.6] - 2025-03-10
155
- - Add o1, o1-mini and o3-mini models
156
- - Remove deprecated gpt4 models
157
- - Make token_limits and encoder a required attribute of LanguageModelInfo
158
-
159
- ## [0.6.5] - 2025-03-04
160
- - Add `upload_content_from_bytes` to `ContentService`
161
- - Add `download_content_to_bytes` to `ContentService`
162
-
163
- ## [0.6.3] - 2025-02-27
164
- - Simplified imports for services. `from unique_toolkit.language_model import LanguageModelService` -> `from unique_toolkit import LanguageModelService` to reduce number of import lines.
165
-
166
- ## [0.6.3] - 2025-02-26
167
- - Add `builder` method to `LanguageModelMessages` class
168
-
169
- ## [0.6.2] - 2025-02-25
170
- - Deprecate `LanguageModel` in favor of `LanguageModelInfo`
171
- - `LanguageModelTokenLimits` properties become mandatory, initialization allows
172
- - init with `token_limit` and `fraction_input` or `input_token_limit` and `output_token_limit`
173
- - only `input_token_limit` and `output_token_limit` are members of model
174
-
175
- ## [0.6.1] - 2025-02-25
176
- - [BREAKING] `LanguageModelService.stream_complete` and `LanguageModelService.stream_complete_async` are now moved to `ChatService.stream_complete` and `ChatService.stream_complete_async`. Correspondingly `assistant_message_id` and `user_message_id` are removed from `LanguageModelService`.
177
- - Add `create_user_message` and `create_user_message_async` to `ChatService` (similar to `create_assistant_message` and `create_assistant_message_async`)
178
-
179
- ## [0.6.0] - 2025-02-21
180
- - make for each domain, its base functionality accessible from `functions.py`
181
- - make it possible to instantiate the domain services directly from different event types, inhereted from common `BaseEvent`
182
- - extend the functionalities in the ShortTermMemoryService by adding the `find_latest_memory` and `create_memory` functions for sync and async usage
183
- - remove logger dependency from service classes
184
- - marked deprecated:
185
- - `from_chat_event` in ShortTermMemoryService, use `ShortTermMemoryService(event=event)` instead
186
- - `complete_async_util` in LanguageModelService, use `functions.complete_async` instead
187
- - `stream_complete_async` in LanguageModelService, use `stream_complete_to_chat_async` instead
188
- - `stream_complete` in LanguageModelService, use `stream_complete_to_chat` instead
189
- - `Event` and nested schemas in `app`, use `ChatEvent` and `ChatEventUserMessage`, `ChatEventAssistantMessage` and `ChatEventToolMessage` instead
190
-
191
- ## [0.5.56] - 2025-02-19
192
- - Add `MessageAssessment` title field and change label values
193
-
194
- ## [0.5.55] - 2025-02-18
195
- - Log `contentId` for better debugging
196
-
197
- ## [0.5.54] - 2025-02-10
198
- - Add `created_at`, `completed_at`, `updated_at` and `gpt_request` to `ChatMessage` schema.
199
-
200
- ## [0.5.53] - 2025-02-01
201
- - Correct `MessageAssessment` schemas
202
-
203
- ## [0.5.52] - 2025-02-01
204
- - Add `MessageAssessment` schemas and functions to `ChatService` to handle message assessments.
205
- - Fix `LanguageModelService.complete_async_util` to use the correct async method.
206
-
207
- ## [0.5.51] - 2025-01-30
208
- - Add missing structured output arguments in complete_async
209
-
210
- ## [0.5.50] - 2025-01-30
211
- - Add the possibility to define completion output structure through a pydantic class
212
-
213
- ## [0.5.49] - 2025-01-24
214
- - Add `parsed` and `refusal` to `LanguageModelAssistantMessage` to support structured output
215
-
216
- ## [0.5.48] - 2025-01-19
217
- - Added the possibility define tool parameters with a json schema (Useful when generating tool parameters from a pydantic object)
218
-
219
- ## [0.5.47] - 2025-01-07
220
- - Added a message builder to build language model messages conveniently without importing all different messages.
221
- - Move tool_calls to assistant message as not needed anywhere else.
222
-
223
- ## [0.5.46] - 2025-01-07
224
- - Added `AZURE_GPT_35_TURBO_0125` as new model into toolkit.
225
-
226
- ## [0.5.45] - 2025-01-03
227
- - Added `ShortTermMemoryService` class to handle short term memory.
228
-
229
- ## [0.5.44] - 2024-12-18
230
- - Add `event_constructor` to `verify_signature_and_construct_event` to allow for custom event construction.
231
-
232
- ## [0.5.43] - 2024-12-13
233
- - Add `Prompt` class to handle templated prompts that can be formatted into LanguageModelSystemMessage and LanguageModelUserMessage.
234
-
235
- ## [0.5.42] - 2024-12-11
236
- - Update `LanguageModelTokenLimits` with fix avoiding floats for token
237
-
238
- ## [0.5.41] - 2024-12-11
239
- - Update `LanguageModelTokenLimits` includes a fraction_input now to always have input/output token limits available.
240
-
241
- ## [0.5.40] - 2024-12-11
242
- - Add `other_options` to `LanguageModelService.complete`, `LanguageModelService.complete_async`, `LanguageModelService.stream_complete` and `LanguageModelService.stream_complete_async`
243
-
244
- ## [0.5.39] - 2024-12-09
245
- - Add `contentIds` to `Search.create` and `Search.create_async`
246
- - Use `metadata_filter` from event in `ContentService.search_content_chunks` and `ContentService.async_search_content_chunks` as default.
247
-
248
- ## [0.5.38] - 2024-11-26
249
- - Added string representation to `LanguageModelMessage` and `LanguageModelMessages` class
250
-
251
- ## [0.5.37] - 2024-11-26
252
- - `content` parameter in `ChatService.modify_assistant_message` and `ChatService.modify_assistant_message_async` is now optional
253
- - Added optional parameter `original_content` to `ChatService.modify_assistant_message` and `ChatService.modify_assistant_message_async`
254
- - Added optional parameter `original_content` to `ChatService.create_assistant_message` and `ChatService.create_assistant_message_async`
255
-
256
- ## [0.5.36] - 2024-11-19
257
- - Add possibility to return the response from the download file from chat request
258
- - Add possibility to not specify a filename and use filename from response headers
259
-
260
- ## [0.5.35] - 2024-11-18
261
- - Add the possibilty to upload files without triggering ingestion by setting `skip_ingestion` to `True` in `ContentService.upload_content`
262
-
263
- ## [0.5.34] - 2024-11-15
264
- - Add `content_id_to_translate` to `EventAdditionalParameters`
265
-
266
- ## [0.5.33] - 2024-10-30
267
- - Force randomizing tool_call_id. This is helpful to better identify the tool_calls.
268
-
269
- ## [0.5.32] - 2024-10-30
270
- - Extending `LanguageModelName` with GPT-4o-2024-0806. This model is invoked using `AZURE_GPT_4o_2024_0806`.
271
-
272
- ## [0.5.31] - 2024-10-29
273
- - Adding support for function calling. Assistant message for tool calls can be directly created with `LanguageModelFunctionCall.create_assistant_message_from_tool_calls`. Better separation of schemas for different types of `LanguageModelMessages`.
274
-
275
- ## [0.5.30] - 2024-10-28
276
- - Correctly use `temperature` parameter in `LanguageModelService.complete` and `LanguageModelService.complete_async` methods
277
-
278
- ## [0.5.29] - 2024-10-28
279
- - Allow numbers in `LanguageModelTool` name
280
-
281
- ## [0.5.28] - 2024-10-23
282
- - Correctly use `temperature` parameter in `LanguageModelService.stream_complete` and `LanguageModelService.stream_complete_async` methods
283
-
284
- ## [0.5.27] - 2024-10-22
285
- - Add encoder_name to to language model info
286
- - Verify tool name for `LanguageModelTool` to conform with frontent requirements.
287
- - Add `search_on_chat` to `ContentService`
288
-
289
- ## [0.5.26] - 2024-10-16
290
- - Bump `unique_sdk` version
291
-
292
- ## [0.5.25] - 2024-09-26
293
- - Add `evaluators` for hallucination and context relevancy evaluation
294
-
295
- ## [0.5.24] - 2024-09-26
296
- - Add `originalText` to `_construct_message_modify_params` and `_construct_message_create_params`. This addition makes sure that the `originalText` on the database is populated with the `text`
297
-
298
- ## [0.5.23] - 2024-09-23
299
- - Add `set_completed_at` as a boolen parameter to the following functions: `modify_user_message`, `modify_user_message_async`, `modify_assistant_message`, `modify_assistant_message_async`, `create_assistant_message` and `create_assistant_message`. This parameter allows the `completedAt` timestamp on the database to be updated when set to True.
300
-
301
- ## [0.5.22] - 2024-09-17
302
- - Add `LanguageModelToolMessage` as additional `LanguageModelMessage`
303
-
304
- ## [0.5.21] - 2024-09-16
305
- - Add `tool` as new role to `ChatMessage`, as well as `tool_calls` and `tool_call_id` as additional parameters
306
-
307
- ## [0.5.20] - 2024-09-16
308
- - `LanguageModelService` now supports complete_util_async that can be called without instantiating the class, currently being used in the Hallucination service and evaluation API
309
-
310
- ## [0.5.19] - 2024-09-11
311
- - `LanguageModelMessage` now supports content as a list of dictionary. Useful when adding image_url content along user message.
312
-
313
- ## [0.5.18] - 2024-09-03
314
- - Adds option to use `metadata_filter` with search.
315
- - Adds `user_metadata`, `tool_parameters` and `metadata_filter` to `EventPayload`.
316
- - Adds `update_debug_info` and `modify_user_message` (and the corresponding `async` variants) to `ChatService`.
317
-
318
- ## [0.5.17] - 2024-08-30
319
- - Add option to initiate `LanguageModel` with a string.
320
- - Add option to call `LanguageModelService` functions also with a string instead of `LanguageModelName` enum for parameter `model_name`.
321
-
322
- ## [0.5.16] - 2024-08-29
323
- - Fix `ContentService.upload_content` function.
324
-
325
- ## [0.5.15] - 2024-08-27
326
- - Possibility to specify root directory in `ContentService.download_content`
327
-
328
- ## [0.5.14] - 2024-08-26
329
- - Add AZURE_GPT_4o_MINI_2024_0718 to language model infos
330
-
331
- ## [0.5.13] - 2024-08-19
332
- - Added `items` to `LanguageModelToolParameterProperty` schema to add support for parameters with list types.
333
- - Added `returns` to `LanguageModelTool` schema to describe the return types of tool calls.
334
-
335
- ## [0.5.12] - 2024-08-7
336
- - added `completedAt` datetime to `unique_sdk.Message.modify` and `unique_sdk.Message.modify_async`
337
- - added `original_text` and `language` to `EventUserMessage`
338
-
339
- ## [0.5.11] - 2024-08-6
340
- - made all domain specific functions and classes directly importable from `unique_toolkit.[DOMAIN_NAME]`
341
- - renamed `RerankerConfig` to `ContentRerankerConfig`
342
- - renamed `get_cosine_similarity` to `calculate_cosine_similarity` and moved it to `unique_toolkit.embedding.utils`
343
- - moved `calculate_tokens` from `unique_toolkit.content.utils` to `unique_toolkit.embedding.utils`
344
- - disabled deprecation warning in `LanguageModel`
345
- - added `additional_parameters` to event
346
- - removed `ChatState` and use `Event` instead
347
-
348
- ## [0.5.10] - 2024-08-6
349
- - fix content schema
350
-
351
- ## [0.5.9] - 2024-08-6
352
- - added `created_at` and `updated_at` to content schema
353
-
354
- ## [0.5.8] - 2024-08-1
355
- - `RerankerConfig` serialization alias added
356
-
357
- ## [0.5.7] - 2024-07-31
358
- - Replace mocked async service calls with async calls in `unique_sdk`
359
- - Change async methods name from `async_*` to `*_async`
360
- - Remove `chat_only` and `scope_ids` attributes from `ChatState` class
361
- - Replace `AsyncExecutor` by simpler utility function `run_async_tasks_parallel`
362
-
363
- ## [0.5.6] - 2024-07-30
364
- - Bug fix: `ContentService.search_content_chunks` and it's `async` equivalent now accept `None` as a valid parameter value for `scope_ids`.
365
-
366
- ## [0.5.5] - 2024-07-30
367
- - Added parameters to `ContentService.search_content_chunks` and `ContentService.async_search_content_chunks`
368
- - `reranker_config` to optinally rerank the search results
369
- - `search_language` to specify a language for full-text-search
370
-
371
- ## [0.5.4] - 2024-07-26
372
- - correct ChatMessage schema
373
-
374
- ## [0.5.3] - 2024-07-25
375
- - downgrade numpy version to ^1.26.4 to be compatible with langchain libraries (require numpy<2.0)
376
-
377
- ## [0.5.2] - 2024-07-25
378
- - correct event schema
379
-
380
- ## [0.5.1] - 2024-07-23
381
- - correct documentation
382
-
383
- ## [0.5.0] - 2024-07-23
384
- ### Added
385
- - Added `unique_toolkit.app` module with the following components:
386
- - `init_logging.py` for initializing the logger.
387
- - `init_sdk.py` for initializing the SDK with environment variables.
388
- - `schemas.py` containing the Event schema.
389
- - `verification.py` for verifying the endpoint secret and constructing the event.
390
-
391
- - Added `unique_toolkit.chat` module with the following components:
392
- - `state.py` containing the `ChatState` class.
393
- - `service.py` containing the `ChatService` class for managing chat interactions.
394
- - `schemas.py` containing relevant schemas such as `ChatMessage`.
395
- - `utils.py` with utility functions for chat interactions.
396
-
397
- - Added `unique_toolkit.content` module with the following components:
398
- - `service.py` containing the `ContentService` class for interacting with content.
399
- - `schemas.py` containing relevant schemas such as `Content` and `ContentChunk`.
400
- - `utils.py` with utility functions for manipulating content objects.
401
-
402
- - Added `unique_toolkit.embedding` module with the following components:
403
- - `service.py` containing the `EmbeddingService` class for working with embeddings.
404
- - `schemas.py` containing relevant schemas such as `Embeddings`.
405
-
406
- - Added `unique_toolkit.language_model` module with the following components:
407
- - `infos.py` containing information on language models deployed on the Unique platform.
408
- - `service.py` containing the `LanguageModelService` class for interacting with language models.
409
- - `schemas.py` containing relevant schemas such as `LanguageModelResponse`.
410
- - `utils.py` with utility functions for parsing language model output.
411
-
412
- ## [0.0.2] - 2024-07-10
413
- - Initial release of `unique_toolkit`.
@@ -1,64 +0,0 @@
1
- unique_toolkit/__init__.py,sha256=waK7W0EK3v2RJ26hawccwVz1i3yHGvHIIu5qgGjEGHQ,583
2
- unique_toolkit/_common/_base_service.py,sha256=S8H0rAebx7GsOldA7xInLp3aQJt9yEPDQdsGSFRJsGg,276
3
- unique_toolkit/_common/_time_utils.py,sha256=ztmTovTvr-3w71Ns2VwXC65OKUUh-sQlzbHdKTQWm-w,135
4
- unique_toolkit/_common/exception.py,sha256=caQIE1btsQnpKCHqL2cgWUSbHup06enQu_Pt7uGUTTE,727
5
- unique_toolkit/_common/validate_required_values.py,sha256=Y_M1ub9gIKP9qZ45F6Zq3ZHtuIqhmOjl8Z2Vd3avg8w,588
6
- unique_toolkit/_common/validators.py,sha256=w5lzvRxl0sBTvv0CXLF9UwtJyKmmS2lez0KXaqapgBE,258
7
- unique_toolkit/app/__init__.py,sha256=jgwWfu27U911kZE1yRq920ZULGLAQGycD3222YxUvsY,1182
8
- unique_toolkit/app/init_logging.py,sha256=Sh26SRxOj8i8dzobKhYha2lLrkrMTHfB1V4jR3h23gQ,678
9
- unique_toolkit/app/init_sdk.py,sha256=Nv4Now4pMfM0AgRhbtatLpm_39rKxn0WmRLwmPhRl-8,1285
10
- unique_toolkit/app/performance/async_tasks.py,sha256=H0l3OAcosLwNHZ8d2pd-Di4wHIXfclEvagi5kfqLFPA,1941
11
- unique_toolkit/app/performance/async_wrapper.py,sha256=yVVcRDkcdyfjsxro-N29SBvi-7773wnfDplef6-y8xw,1077
12
- unique_toolkit/app/schemas.py,sha256=WsdiK39za5h7ir__DBv_FYV-i2_FMucNCWdFgXWN7NE,3373
13
- unique_toolkit/app/verification.py,sha256=GxFFwcJMy25fCA_Xe89wKW7bgqOu8PAs5y8QpHF0GSc,3861
14
- unique_toolkit/chat/__init__.py,sha256=LRs2G-JTVuci4lbtHTkVUiNcZcSR6uqqfnAyo7af6nY,619
15
- unique_toolkit/chat/constants.py,sha256=05kq6zjqUVB2d6_P7s-90nbljpB3ryxwCI-CAz0r2O4,83
16
- unique_toolkit/chat/functions.py,sha256=J9Cmgkhj9bBxZja3ggkSp48af_LPU4Dfi9Sbc_WhhNY,27204
17
- unique_toolkit/chat/schemas.py,sha256=MNcGAXjK1K8zOODeMFz3FHVQL5sIBQXRwkr_2hFkG8k,2672
18
- unique_toolkit/chat/service.py,sha256=SoFeaOi0BTexhiyX6busui_7JjhlRu30YNiKdgwV3JQ,29127
19
- unique_toolkit/chat/state.py,sha256=Cjgwv_2vhDFbV69xxsn7SefhaoIAEqLx3ferdVFCnOg,1445
20
- unique_toolkit/chat/utils.py,sha256=ihm-wQykBWhB4liR3LnwPVPt_qGW6ETq21Mw4HY0THE,854
21
- unique_toolkit/content/__init__.py,sha256=EdJg_A_7loEtCQf4cah3QARQreJx6pdz89Rm96YbMVg,940
22
- unique_toolkit/content/constants.py,sha256=1iy4Y67xobl5VTnJB6SxSyuoBWbdLl9244xfVMUZi5o,60
23
- unique_toolkit/content/functions.py,sha256=yB87wrbtmHzr3jGJUHetmuhy-7RVtnqG2IQ6gqFAun8,17093
24
- unique_toolkit/content/schemas.py,sha256=zks_Pkki2VhxICJJgHZyc-LPmRuj5dLbw3pgcUT7SW8,2362
25
- unique_toolkit/content/service.py,sha256=cb5q8oFbKQbuyikQyTdrSvJMfVdpC9K3S5GT0NkD5uo,15771
26
- unique_toolkit/content/utils.py,sha256=GUVPrkZfMoAj4MRoBs5BD_7vSuLZTZx69hyWzYFrI50,7747
27
- unique_toolkit/embedding/__init__.py,sha256=uUyzjonPvuDCYsvXCIt7ErQXopLggpzX-MEQd3_e2kE,250
28
- unique_toolkit/embedding/constants.py,sha256=Lj8-Lcy1FvuC31PM9Exq7vaFuxQV4pEI1huUMFX-J2M,52
29
- unique_toolkit/embedding/functions.py,sha256=3qp-BfuMAbnp8YB04rh3xH8vsJuCBPizoy-JeaBFtoQ,1944
30
- unique_toolkit/embedding/schemas.py,sha256=1GvKCaSk4jixzVQ2PKq8yDqwGEVY_hWclYtoAr6CC2g,96
31
- unique_toolkit/embedding/service.py,sha256=sCMKeFjwNrWYQic1UUW2c1jnhjRQLcDYfsBgxmR70sY,2697
32
- unique_toolkit/embedding/utils.py,sha256=v86lo__bCJbxZBQ3OcLu5SuwT6NbFfWlcq8iyk6BuzQ,279
33
- unique_toolkit/evaluators/__init__.py,sha256=3Rfpnowm7MUXHWmeU4UV4s_3Hk-sw3V20oBwQCYlejQ,50
34
- unique_toolkit/evaluators/config.py,sha256=iYiBi7M6u5MG9nVgpxl9dKfoS4j72stA6Hl-MQHmYp8,1056
35
- unique_toolkit/evaluators/constants.py,sha256=1oI93jsh0R_TjX_8OenliiiywVe3vTooSnaMqtq6R18,27
36
- unique_toolkit/evaluators/context_relevancy/constants.py,sha256=9mAGc23e5XjTYOBfeuZVbaqOyYrvRoXYjfUnsBOVShU,1126
37
- unique_toolkit/evaluators/context_relevancy/prompts.py,sha256=gTlWP7fDuxhrXhCYNCqXMbCey_DalZMdi5l-a6RHgk0,713
38
- unique_toolkit/evaluators/context_relevancy/service.py,sha256=9hzdMuF4A4T97-3X3zcXgrDISLn1bleZ6tTL1bHa9dQ,1722
39
- unique_toolkit/evaluators/context_relevancy/utils.py,sha256=E9ljdRNbwYlx04fQDLvgF4SwxvlTJT0vE328PlUF6KA,5191
40
- unique_toolkit/evaluators/exception.py,sha256=7lcVbCyoN4Md1chNJDFxpUYyWbVrcr9dcc3TxWykJTc,115
41
- unique_toolkit/evaluators/hallucination/constants.py,sha256=DEycXlxY9h01D0iF3aU5LIdPrDJ-5OkF0VdXDLn_tSs,1440
42
- unique_toolkit/evaluators/hallucination/prompts.py,sha256=9yCpO_WGLDvYfPWKL1VuRA-jt0P_-A-qvLUOmuv-Nks,3320
43
- unique_toolkit/evaluators/hallucination/service.py,sha256=k8qro5Lw4Ak58m4HYp3G4HPLIaexeFySIIVvW6fAdeA,2408
44
- unique_toolkit/evaluators/hallucination/utils.py,sha256=4KTJH8low_fBzOcuVlcHB2FRrtIiN8TR6uuU8EGwjJM,7668
45
- unique_toolkit/evaluators/output_parser.py,sha256=eI72qkzK1dZyUvnfP2SOAQCGBj_-PwX5wy_aLPMsJMY,883
46
- unique_toolkit/evaluators/schemas.py,sha256=Jaue6Uhx75X1CyHKWj8sT3RE1JZXTqoLtfLt2xQNCX8,2507
47
- unique_toolkit/language_model/__init__.py,sha256=jWko_vQj48wjnpTtlkg8iNdef0SMI3FN2kGywXRTMzg,1880
48
- unique_toolkit/language_model/builder.py,sha256=aIAXWWUoB5G-HONJiAt3MdRGd4jdP8nA-HYX2D2WlSI,3048
49
- unique_toolkit/language_model/constants.py,sha256=B-topqW0r83dkC_25DeQfnPk3n53qzIHUCBS7YJ0-1U,119
50
- unique_toolkit/language_model/functions.py,sha256=I5jHhHsKoq7GwEQyTrM8LXB2n_6dvMAk7UklenjuHSY,7945
51
- unique_toolkit/language_model/infos.py,sha256=kze4jI0CqLVEcejlC-q9pd9pPqkfJy6A-qPKKZ4iDEc,19211
52
- unique_toolkit/language_model/prompt.py,sha256=JSawaLjQg3VR-E2fK8engFyJnNdk21zaO8pPIodzN4Q,3991
53
- unique_toolkit/language_model/schemas.py,sha256=rrwzUgKANFOrdehCULW8Hh03uRW3tsE5dXpWqxmClfg,8618
54
- unique_toolkit/language_model/service.py,sha256=GupYD4uDZjy1TfVQW3jichmgQwiSgQCj350FtL4O0W4,5569
55
- unique_toolkit/language_model/utils.py,sha256=bPQ4l6_YO71w-zaIPanUUmtbXC1_hCvLK0tAFc3VCRc,1902
56
- unique_toolkit/short_term_memory/__init__.py,sha256=2mI3AUrffgH7Yt-xS57EGqnHf7jnn6xquoKEhJqk3Wg,185
57
- unique_toolkit/short_term_memory/constants.py,sha256=698CL6-wjup2MvU19RxSmQk3gX7aqW_OOpZB7sbz_Xg,34
58
- unique_toolkit/short_term_memory/functions.py,sha256=3WiK-xatY5nh4Dr5zlDUye1k3E6kr41RiscwtTplw5k,4484
59
- unique_toolkit/short_term_memory/schemas.py,sha256=OhfcXyF6ACdwIXW45sKzjtZX_gkcJs8FEZXcgQTNenw,1406
60
- unique_toolkit/short_term_memory/service.py,sha256=0wrwuo6K17Edcuiwp5LMCvxFuBSDP82HF0_5qwi0nYc,5307
61
- unique_toolkit-0.7.9.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
62
- unique_toolkit-0.7.9.dist-info/METADATA,sha256=h8f89IJhXVWwgr9FOJ2xDg07fscYcJz_lQQvnH5jFEc,21412
63
- unique_toolkit-0.7.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
64
- unique_toolkit-0.7.9.dist-info/RECORD,,