unique_toolkit 2026.24.0.dev5__py3-none-any.whl → 2026.24.0.dev6__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/__init__.py +84 -20
- unique_toolkit/app/schemas.py +28 -2
- unique_toolkit/content/__init__.py +30 -1
- unique_toolkit/language_model/__init__.py +15 -3
- {unique_toolkit-2026.24.0.dev5.dist-info → unique_toolkit-2026.24.0.dev6.dist-info}/METADATA +1 -1
- {unique_toolkit-2026.24.0.dev5.dist-info → unique_toolkit-2026.24.0.dev6.dist-info}/RECORD +7 -7
- {unique_toolkit-2026.24.0.dev5.dist-info → unique_toolkit-2026.24.0.dev6.dist-info}/WHEEL +0 -0
unique_toolkit/__init__.py
CHANGED
|
@@ -1,23 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
)
|
|
13
|
-
from unique_toolkit.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
from unique_toolkit.
|
|
1
|
+
from importlib import import_module
|
|
2
|
+
from typing import TYPE_CHECKING, Any
|
|
3
|
+
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from unique_toolkit.chat import ChatService as ChatService
|
|
6
|
+
from unique_toolkit.content import ContentService as ContentService
|
|
7
|
+
from unique_toolkit.data_extraction import (
|
|
8
|
+
StructuredOutputDataExtractor as StructuredOutputDataExtractor,
|
|
9
|
+
)
|
|
10
|
+
from unique_toolkit.data_extraction import (
|
|
11
|
+
StructuredOutputDataExtractorConfig as StructuredOutputDataExtractorConfig,
|
|
12
|
+
)
|
|
13
|
+
from unique_toolkit.embedding import EmbeddingService as EmbeddingService
|
|
14
|
+
from unique_toolkit.framework_utilities.openai.client import (
|
|
15
|
+
get_async_openai_client as get_async_openai_client,
|
|
16
|
+
)
|
|
17
|
+
from unique_toolkit.framework_utilities.openai.client import (
|
|
18
|
+
get_openai_client as get_openai_client,
|
|
19
|
+
)
|
|
20
|
+
from unique_toolkit.language_model import (
|
|
21
|
+
LanguageModelMessages as LanguageModelMessages,
|
|
22
|
+
)
|
|
23
|
+
from unique_toolkit.language_model import LanguageModelName as LanguageModelName
|
|
24
|
+
from unique_toolkit.language_model import (
|
|
25
|
+
LanguageModelService as LanguageModelService,
|
|
26
|
+
)
|
|
27
|
+
from unique_toolkit.language_model import (
|
|
28
|
+
LanguageModelToolDescription as LanguageModelToolDescription,
|
|
29
|
+
)
|
|
30
|
+
from unique_toolkit.services.knowledge_base import (
|
|
31
|
+
KnowledgeBaseService as KnowledgeBaseService,
|
|
32
|
+
)
|
|
33
|
+
from unique_toolkit.short_term_memory import (
|
|
34
|
+
ShortTermMemoryService as ShortTermMemoryService,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
_EXPORTS: dict[str, tuple[str, str]] = {
|
|
38
|
+
"ChatService": ("unique_toolkit.chat", "ChatService"),
|
|
39
|
+
"ContentService": ("unique_toolkit.content", "ContentService"),
|
|
40
|
+
"EmbeddingService": ("unique_toolkit.embedding", "EmbeddingService"),
|
|
41
|
+
"get_openai_client": (
|
|
42
|
+
"unique_toolkit.framework_utilities.openai.client",
|
|
43
|
+
"get_openai_client",
|
|
44
|
+
),
|
|
45
|
+
"get_async_openai_client": (
|
|
46
|
+
"unique_toolkit.framework_utilities.openai.client",
|
|
47
|
+
"get_async_openai_client",
|
|
48
|
+
),
|
|
49
|
+
"KnowledgeBaseService": (
|
|
50
|
+
"unique_toolkit.services.knowledge_base",
|
|
51
|
+
"KnowledgeBaseService",
|
|
52
|
+
),
|
|
53
|
+
"LanguageModelMessages": (
|
|
54
|
+
"unique_toolkit.language_model",
|
|
55
|
+
"LanguageModelMessages",
|
|
56
|
+
),
|
|
57
|
+
"LanguageModelName": ("unique_toolkit.language_model", "LanguageModelName"),
|
|
58
|
+
"LanguageModelService": ("unique_toolkit.language_model", "LanguageModelService"),
|
|
59
|
+
"LanguageModelToolDescription": (
|
|
60
|
+
"unique_toolkit.language_model",
|
|
61
|
+
"LanguageModelToolDescription",
|
|
62
|
+
),
|
|
63
|
+
"ShortTermMemoryService": (
|
|
64
|
+
"unique_toolkit.short_term_memory",
|
|
65
|
+
"ShortTermMemoryService",
|
|
66
|
+
),
|
|
67
|
+
"StructuredOutputDataExtractor": (
|
|
68
|
+
"unique_toolkit.data_extraction",
|
|
69
|
+
"StructuredOutputDataExtractor",
|
|
70
|
+
),
|
|
71
|
+
"StructuredOutputDataExtractorConfig": (
|
|
72
|
+
"unique_toolkit.data_extraction",
|
|
73
|
+
"StructuredOutputDataExtractorConfig",
|
|
74
|
+
),
|
|
75
|
+
}
|
|
21
76
|
|
|
22
77
|
# Conditionally import config_checker (requires pydantic-settings)
|
|
23
78
|
_CONFIG_CHECKER_AVAILABLE: bool = False
|
|
@@ -83,3 +138,12 @@ if _CONFIG_CHECKER_AVAILABLE:
|
|
|
83
138
|
# Add langchain-specific exports if available
|
|
84
139
|
if _LANGCHAIN_AVAILABLE:
|
|
85
140
|
__all__.append("get_langchain_client")
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def __getattr__(name: str) -> Any:
|
|
144
|
+
export = _EXPORTS.get(name)
|
|
145
|
+
if export is None:
|
|
146
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
147
|
+
|
|
148
|
+
module_name, attribute_name = export
|
|
149
|
+
return getattr(import_module(module_name), attribute_name)
|
unique_toolkit/app/schemas.py
CHANGED
|
@@ -4,10 +4,17 @@ import json
|
|
|
4
4
|
from enum import StrEnum
|
|
5
5
|
from logging import getLogger
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import Any, Generic, Optional, TypeVar, override
|
|
7
|
+
from typing import Annotated, Any, Generic, Optional, TypeVar, override
|
|
8
8
|
|
|
9
9
|
from humps import camelize
|
|
10
|
-
from pydantic import
|
|
10
|
+
from pydantic import (
|
|
11
|
+
BaseModel,
|
|
12
|
+
BeforeValidator,
|
|
13
|
+
ConfigDict,
|
|
14
|
+
Field,
|
|
15
|
+
JsonValue,
|
|
16
|
+
field_validator,
|
|
17
|
+
)
|
|
11
18
|
from pydantic_settings import BaseSettings
|
|
12
19
|
from typing_extensions import deprecated
|
|
13
20
|
|
|
@@ -16,6 +23,8 @@ from unique_toolkit.app.chat_event_filter_options_settings import (
|
|
|
16
23
|
CHAT_EVENT_FILTER_OPTIONS_SETTINGS,
|
|
17
24
|
)
|
|
18
25
|
from unique_toolkit.app.unique_settings import UniqueChatEventFilterOptions
|
|
26
|
+
from unique_toolkit.language_model.default_language_model import DEFAULT_LANGUAGE_MODEL
|
|
27
|
+
from unique_toolkit.language_model.infos import LanguageModelInfo
|
|
19
28
|
from unique_toolkit.smart_rules.compile import UniqueQL, parse_uniqueql
|
|
20
29
|
|
|
21
30
|
FilterOptionsT = TypeVar("FilterOptionsT", bound=BaseSettings)
|
|
@@ -29,6 +38,15 @@ model_config = ConfigDict(
|
|
|
29
38
|
_logger = getLogger(__name__)
|
|
30
39
|
|
|
31
40
|
|
|
41
|
+
def _validate_language_model_info(v: Any) -> Any:
|
|
42
|
+
from unique_toolkit._common.validators import validate_and_init_language_model_info
|
|
43
|
+
|
|
44
|
+
return validate_and_init_language_model_info(v)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
LMI = Annotated[LanguageModelInfo, BeforeValidator(_validate_language_model_info)]
|
|
48
|
+
|
|
49
|
+
|
|
32
50
|
class EventName(StrEnum):
|
|
33
51
|
EXTERNAL_MODULE_CHOSEN = "unique.chat.external-module.chosen"
|
|
34
52
|
USER_MESSAGE_CREATED = "unique.chat.user-message.created"
|
|
@@ -247,6 +265,10 @@ class ChatEventPayload(BaseModel):
|
|
|
247
265
|
user_metadata: dict[str, Any] | None = Field(
|
|
248
266
|
default_factory=dict,
|
|
249
267
|
)
|
|
268
|
+
model_choice: LMI = Field(
|
|
269
|
+
default_factory=lambda: LanguageModelInfo.from_name(DEFAULT_LANGUAGE_MODEL),
|
|
270
|
+
description="The model choice the user has chosen to be used.",
|
|
271
|
+
)
|
|
250
272
|
tool_choices: list[str] = Field(
|
|
251
273
|
default_factory=list,
|
|
252
274
|
description="A list containing the tool names the user has chosen to be activated.",
|
|
@@ -305,6 +327,10 @@ class ChatEventPayload(BaseModel):
|
|
|
305
327
|
if value:
|
|
306
328
|
return parse_uniqueql(value)
|
|
307
329
|
|
|
330
|
+
@property
|
|
331
|
+
def has_model_choice_override(self) -> bool:
|
|
332
|
+
return "model_choice" in self.model_fields_set
|
|
333
|
+
|
|
308
334
|
|
|
309
335
|
@deprecated("""Use `ChatEventPayload` instead.
|
|
310
336
|
This class will be removed in the next major version.""")
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, Any
|
|
2
|
+
|
|
1
3
|
from .constants import DOMAIN_NAME as DOMAIN_NAME
|
|
2
4
|
from .schemas import (
|
|
3
5
|
Content as Content,
|
|
@@ -23,7 +25,6 @@ from .schemas import (
|
|
|
23
25
|
from .schemas import (
|
|
24
26
|
ContentUploadInput as ContentUploadInput,
|
|
25
27
|
)
|
|
26
|
-
from .service import ContentService as ContentService
|
|
27
28
|
from .utils import (
|
|
28
29
|
count_tokens as count_tokens,
|
|
29
30
|
)
|
|
@@ -36,3 +37,31 @@ from .utils import (
|
|
|
36
37
|
from .utils import (
|
|
37
38
|
sort_content_chunks as sort_content_chunks,
|
|
38
39
|
)
|
|
40
|
+
|
|
41
|
+
if TYPE_CHECKING:
|
|
42
|
+
from .service import ContentService as ContentService
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"Content",
|
|
46
|
+
"ContentChunk",
|
|
47
|
+
"ContentMetadata",
|
|
48
|
+
"ContentReference",
|
|
49
|
+
"ContentRerankerConfig",
|
|
50
|
+
"ContentSearchResult",
|
|
51
|
+
"ContentSearchType",
|
|
52
|
+
"ContentService",
|
|
53
|
+
"ContentUploadInput",
|
|
54
|
+
"DOMAIN_NAME",
|
|
55
|
+
"count_tokens",
|
|
56
|
+
"merge_content_chunks",
|
|
57
|
+
"pick_content_chunks_for_token_window",
|
|
58
|
+
"sort_content_chunks",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def __getattr__(name: str) -> Any:
|
|
63
|
+
if name == "ContentService":
|
|
64
|
+
from .service import ContentService
|
|
65
|
+
|
|
66
|
+
return ContentService
|
|
67
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, Any
|
|
2
|
+
|
|
1
3
|
from .constants import DOMAIN_NAME
|
|
2
4
|
from .default_language_model import DEFAULT_LANGUAGE_MODEL, DEFAULT_GPT_4o
|
|
3
5
|
from .functions import (
|
|
@@ -28,9 +30,6 @@ from .schemas import (
|
|
|
28
30
|
LanguageModelToolParameters,
|
|
29
31
|
LanguageModelUserMessage,
|
|
30
32
|
)
|
|
31
|
-
from .service import (
|
|
32
|
-
LanguageModelService,
|
|
33
|
-
)
|
|
34
33
|
from .stream_transform import (
|
|
35
34
|
NormalizationTransform,
|
|
36
35
|
ReferenceInjectionTransform,
|
|
@@ -42,6 +41,19 @@ from .utils import (
|
|
|
42
41
|
find_last_json_object,
|
|
43
42
|
)
|
|
44
43
|
|
|
44
|
+
if TYPE_CHECKING:
|
|
45
|
+
from .service import LanguageModelService as LanguageModelService
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def __getattr__(name: str) -> Any:
|
|
49
|
+
if name == "LanguageModelService":
|
|
50
|
+
from .service import LanguageModelService
|
|
51
|
+
|
|
52
|
+
return LanguageModelService
|
|
53
|
+
|
|
54
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
55
|
+
|
|
56
|
+
|
|
45
57
|
__all__ = [
|
|
46
58
|
"LanguageModel",
|
|
47
59
|
"LanguageModelName",
|
{unique_toolkit-2026.24.0.dev5.dist-info → unique_toolkit-2026.24.0.dev6.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: unique-toolkit
|
|
3
|
-
Version: 2026.24.0.
|
|
3
|
+
Version: 2026.24.0.dev6
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Cedric Klinkert, Martin Fadler, Sadique Sheik, Fabian Schläpfer, Pascal Hauri, Ejiroghene Oki-Peter, Rami Azouz, Ricardo Visini, Sanzio Monti
|
|
6
6
|
Author-email: Cedric Klinkert <cedric.klinkert@unique.ch>, Martin Fadler <martin.fadler@unique.ch>, Sadique Sheik <sadique@unique.ch>, Fabian Schläpfer <fabian@unique.ch>, Pascal Hauri <pascal@unique.ch>, Ejiroghene Oki-Peter <oki-peter.ejiroghene@unique.ai>, Rami Azouz <rami.ext@unique.ch>, Ricardo Visini <ricardo.visini@unique.ch>, Sanzio Monti <sanzio.monti@unique.ai>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
unique_toolkit/__init__.py,sha256=
|
|
1
|
+
unique_toolkit/__init__.py,sha256=wLqk58sHN8n2-UzUqSdJKq3duNIpIBsXo453d3ueGto,5153
|
|
2
2
|
unique_toolkit/_common/__init__.py,sha256=jfbOCUi5zumgGpKrIanIuTFY7f7_yfToRg7o64j6Egk,46
|
|
3
3
|
unique_toolkit/_common/_base_service.py,sha256=S8H0rAebx7GsOldA7xInLp3aQJt9yEPDQdsGSFRJsGg,276
|
|
4
4
|
unique_toolkit/_common/_time_utils.py,sha256=ztmTovTvr-3w71Ns2VwXC65OKUUh-sQlzbHdKTQWm-w,135
|
|
@@ -233,7 +233,7 @@ unique_toolkit/app/init_logging.py,sha256=Lv0FuEiUmxvtV2yovjD0gWNIvLdsi2xdMFeEiN
|
|
|
233
233
|
unique_toolkit/app/init_sdk.py,sha256=5_oDoETr6akwYyBCb0ivTdMNu3SVgPSkrXcDS6ELyY8,2269
|
|
234
234
|
unique_toolkit/app/performance/async_tasks.py,sha256=8Xv5kEmmFDJO7YyyBxv4e7bcNgq-3z_E2_4z1Yn9EqU,1970
|
|
235
235
|
unique_toolkit/app/performance/async_wrapper.py,sha256=yVVcRDkcdyfjsxro-N29SBvi-7773wnfDplef6-y8xw,1077
|
|
236
|
-
unique_toolkit/app/schemas.py,sha256=
|
|
236
|
+
unique_toolkit/app/schemas.py,sha256=f5h9BqCuqHvrXUAB7tjrx0PSLmuJJKlZ89othqOsuSY,14762
|
|
237
237
|
unique_toolkit/app/unique_settings.py,sha256=bUrT57CIhu8fnU5pdEboZ4Ic6BPG1FetfsOh0mwlHoM,22704
|
|
238
238
|
unique_toolkit/app/verification.py,sha256=GxFFwcJMy25fCA_Xe89wKW7bgqOu8PAs5y8QpHF0GSc,3861
|
|
239
239
|
unique_toolkit/app/webhook.py,sha256=evpxLDnvz7P3D7-TV1XBkl8WcoldXpjOkw3tvFRxHr0,2368
|
|
@@ -248,7 +248,7 @@ unique_toolkit/chat/schemas.py,sha256=l-Epugu27RoajiX5OkFO-BrVNey-wfTmaXiEmNNmG7
|
|
|
248
248
|
unique_toolkit/chat/service.py,sha256=6D00OL4QrGafbOhTaC5zNXaNgg7gS5W_2ePVa4LhqpE,4439
|
|
249
249
|
unique_toolkit/chat/state.py,sha256=Cjgwv_2vhDFbV69xxsn7SefhaoIAEqLx3ferdVFCnOg,1445
|
|
250
250
|
unique_toolkit/chat/utils.py,sha256=CsD9IER2gA1IOV0fmUOl-N0LmKvA7JP9dGrOqeOY0Gg,1173
|
|
251
|
-
unique_toolkit/content/__init__.py,sha256=
|
|
251
|
+
unique_toolkit/content/__init__.py,sha256=nnQDfnNTEvI8-3dgWvIojoFDYU7edwd8Kloi6lMDG0M,1586
|
|
252
252
|
unique_toolkit/content/constants.py,sha256=1iy4Y67xobl5VTnJB6SxSyuoBWbdLl9244xfVMUZi5o,60
|
|
253
253
|
unique_toolkit/content/functions.py,sha256=Rx3N9x23JjVt7mmUlFhOhjAjkWQCzzodtpDgoIsE2xg,33932
|
|
254
254
|
unique_toolkit/content/schemas.py,sha256=z3xlTkOh9MTwHGLwcc5vfT5OmDRCiWE0F0MaiPMV4dg,10281
|
|
@@ -361,7 +361,7 @@ unique_toolkit/framework_utilities/openai/__init__.py,sha256=CrHYoC7lv2pBscitLer
|
|
|
361
361
|
unique_toolkit/framework_utilities/openai/client.py,sha256=Ft-oLiS6BTaMiuCdObdaMLkiEPE3RYjtc9VPnqQk3W8,2449
|
|
362
362
|
unique_toolkit/framework_utilities/openai/message_builder.py,sha256=RT1pZjxH42TFZlAxQ5zlqdKPvHKVTjc5t3JDUy58I7Q,6887
|
|
363
363
|
unique_toolkit/framework_utilities/utils.py,sha256=JK7g2yMfEx3eMprug26769xqNpS5WJcizf8n2zWMBng,789
|
|
364
|
-
unique_toolkit/language_model/__init__.py,sha256=
|
|
364
|
+
unique_toolkit/language_model/__init__.py,sha256=WleWs4UXFzVOVglKYGkyfmogY-cuUyOKYHvHhWmy4LY,2607
|
|
365
365
|
unique_toolkit/language_model/_responses_api_utils.py,sha256=w2ZyleOQcWLpOWGJNNb2-uBYApUNlqS-ABqXoMFySlg,3084
|
|
366
366
|
unique_toolkit/language_model/builder.py,sha256=KwBzsD6-fvQnB4p2I7M-5Tk6j4tmQ973MYwU1ulXFb4,4526
|
|
367
367
|
unique_toolkit/language_model/constants.py,sha256=B-topqW0r83dkC_25DeQfnPk3n53qzIHUCBS7YJ0-1U,119
|
|
@@ -391,6 +391,6 @@ unique_toolkit/short_term_memory/service.py,sha256=Ncw0_0CNM6kmzJSLVJGG5GcKpBduI
|
|
|
391
391
|
unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
392
392
|
unique_toolkit/smart_rules/compile.py,sha256=vRe0aMJWuVIK-VsqomgxQImzke7MDmwgSxxJfYCa7zw,1386
|
|
393
393
|
unique_toolkit/test_utilities/events.py,sha256=FLrhMh0A_mQutAUjoD0FdMcVQ4Gq31r35OVGzRjvLro,6760
|
|
394
|
-
unique_toolkit-2026.24.0.
|
|
395
|
-
unique_toolkit-2026.24.0.
|
|
396
|
-
unique_toolkit-2026.24.0.
|
|
394
|
+
unique_toolkit-2026.24.0.dev6.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
395
|
+
unique_toolkit-2026.24.0.dev6.dist-info/METADATA,sha256=9iqeteqQZ9CeoDz6t3gI0L0YdK6AnpC376d7cqfdps4,7392
|
|
396
|
+
unique_toolkit-2026.24.0.dev6.dist-info/RECORD,,
|
|
File without changes
|