unique_toolkit 2026.24.0.dev4__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/_common/metadata_filter_scope.py +7 -4
- unique_toolkit/_common/pydantic/rjsf_tags.py +6 -1
- unique_toolkit/app/schemas.py +28 -2
- unique_toolkit/content/__init__.py +30 -1
- unique_toolkit/content/smart_rules.py +61 -3
- unique_toolkit/experimental/components/internal_search/knowledge_base/config.py +27 -4
- unique_toolkit/experimental/components/internal_search/knowledge_base/service.py +5 -1
- unique_toolkit/language_model/__init__.py +15 -3
- unique_toolkit/smart_rules/compile.py +6 -0
- {unique_toolkit-2026.24.0.dev4.dist-info → unique_toolkit-2026.24.0.dev6.dist-info}/METADATA +1 -1
- {unique_toolkit-2026.24.0.dev4.dist-info → unique_toolkit-2026.24.0.dev6.dist-info}/RECORD +13 -13
- {unique_toolkit-2026.24.0.dev4.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)
|
|
@@ -8,6 +8,8 @@ from typing import Any
|
|
|
8
8
|
from unique_toolkit.content.smart_rules import (
|
|
9
9
|
Operator,
|
|
10
10
|
Statement,
|
|
11
|
+
UniqueQL,
|
|
12
|
+
uniqueql_to_dict,
|
|
11
13
|
)
|
|
12
14
|
|
|
13
15
|
_UQL_AND = "and"
|
|
@@ -29,16 +31,17 @@ def build_folder_id_in_clause(scope_ids: list[str]) -> dict[str, Any]:
|
|
|
29
31
|
|
|
30
32
|
def merge_scope_clause_into_metadata_filter(
|
|
31
33
|
scope_clause: Mapping[str, Any],
|
|
32
|
-
metadata_filter:
|
|
34
|
+
metadata_filter: UniqueQL | Mapping[str, Any] | None,
|
|
33
35
|
) -> dict[str, Any]:
|
|
34
36
|
"""AND-merge *scope_clause* with *metadata_filter*, flattening a top-level ``and``."""
|
|
35
37
|
scope_dict = dict(scope_clause)
|
|
36
|
-
|
|
38
|
+
metadata_dict = uniqueql_to_dict(metadata_filter)
|
|
39
|
+
if not metadata_dict:
|
|
37
40
|
return scope_dict
|
|
38
|
-
inner_and =
|
|
41
|
+
inner_and = metadata_dict.get(_UQL_AND)
|
|
39
42
|
if isinstance(inner_and, list):
|
|
40
43
|
return {_UQL_AND: [scope_dict, *inner_and]}
|
|
41
|
-
return {_UQL_AND: [scope_dict,
|
|
44
|
+
return {_UQL_AND: [scope_dict, metadata_dict]}
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
__all__ = [
|
|
@@ -974,7 +974,12 @@ def ui_schema_for_model(
|
|
|
974
974
|
node["items"] = item_node
|
|
975
975
|
|
|
976
976
|
# Dict -> additionalProperties (value side)
|
|
977
|
-
|
|
977
|
+
# Skip when the node already carries a ui:widget (fully-specified
|
|
978
|
+
# widget) or an anyOf (fully-specified type branching): walking the
|
|
979
|
+
# dict value type in those cases adds a spurious "additionalProperties"
|
|
980
|
+
# node that confuses RJSF renderers. Presentation-only meta such as
|
|
981
|
+
# ui:expandable or ui:title does NOT prevent the walk.
|
|
982
|
+
elif origin is dict and "ui:widget" not in node and "anyOf" not in node:
|
|
978
983
|
_key_t, val_t = get_args(base) or (Any, Any)
|
|
979
984
|
val_base, val_meta = _walk_annotated_chain(val_t)
|
|
980
985
|
val_base = _unwrap_optional(val_base)
|
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,10 +1,13 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import re
|
|
3
|
+
from collections.abc import Mapping
|
|
2
4
|
from datetime import datetime, timedelta, timezone
|
|
3
5
|
from enum import Enum
|
|
4
|
-
from typing import Any, Dict, List,
|
|
6
|
+
from typing import Annotated, Any, Dict, List, Self, Union
|
|
5
7
|
|
|
6
|
-
from pydantic import AliasChoices, BaseModel, Field
|
|
8
|
+
from pydantic import AliasChoices, BaseModel, BeforeValidator, Field, PlainSerializer
|
|
7
9
|
from pydantic.config import ConfigDict
|
|
10
|
+
from pydantic.json_schema import WithJsonSchema
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
class Operator(str, Enum):
|
|
@@ -54,6 +57,10 @@ class BaseStatement(BaseModel):
|
|
|
54
57
|
) -> Self:
|
|
55
58
|
return self.model_copy()
|
|
56
59
|
|
|
60
|
+
def to_dict(self) -> dict[str, Any]:
|
|
61
|
+
"""Convert to wire-format JSON dict (uses serialization aliases)."""
|
|
62
|
+
return self.model_dump(mode="json")
|
|
63
|
+
|
|
57
64
|
|
|
58
65
|
class Statement(BaseStatement):
|
|
59
66
|
operator: Operator
|
|
@@ -285,7 +292,6 @@ def get_fallback_values(
|
|
|
285
292
|
return values
|
|
286
293
|
|
|
287
294
|
|
|
288
|
-
# Example usage:
|
|
289
295
|
def parse_uniqueql(json_data: Dict[str, Any]) -> UniqueQL:
|
|
290
296
|
if "operator" in json_data:
|
|
291
297
|
return Statement.model_validate(json_data)
|
|
@@ -299,3 +305,55 @@ def parse_uniqueql(json_data: Dict[str, Any]) -> UniqueQL:
|
|
|
299
305
|
)
|
|
300
306
|
else:
|
|
301
307
|
raise ValueError("Invalid UniqueQL format")
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def parse_uniqueql_input(v: Any) -> UniqueQL | None:
|
|
311
|
+
"""Parse config/API input (JSON string, dict, or model) into a UniqueQL model."""
|
|
312
|
+
if v is None:
|
|
313
|
+
return None
|
|
314
|
+
if isinstance(v, (Statement, AndStatement, OrStatement)):
|
|
315
|
+
return v
|
|
316
|
+
if isinstance(v, str):
|
|
317
|
+
if v.strip() == "":
|
|
318
|
+
return None
|
|
319
|
+
try:
|
|
320
|
+
v = json.loads(v)
|
|
321
|
+
except json.JSONDecodeError as e:
|
|
322
|
+
raise ValueError(f"Invalid JSON: {e}") from e
|
|
323
|
+
if isinstance(v, dict):
|
|
324
|
+
return parse_uniqueql(v)
|
|
325
|
+
raise ValueError(f"Expected JSON string or dict, got {type(v).__name__}")
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def uniqueql_to_dict(
|
|
329
|
+
value: UniqueQL | Mapping[str, Any] | None,
|
|
330
|
+
) -> dict[str, Any] | None:
|
|
331
|
+
"""Convert a UniqueQL model (or wire dict) to a JSON-serializable dict for APIs."""
|
|
332
|
+
if value is None:
|
|
333
|
+
return None
|
|
334
|
+
if isinstance(value, BaseStatement):
|
|
335
|
+
return value.to_dict()
|
|
336
|
+
return dict(value)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def _serialize_uniqueql_field(value: UniqueQL | None) -> dict[str, Any] | None:
|
|
340
|
+
return None if value is None else value.to_dict()
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
_UNIQUEQL_JSON_SCHEMA = {
|
|
344
|
+
"anyOf": [
|
|
345
|
+
{"type": "string", "title": "UniqueQL (JSON)"},
|
|
346
|
+
{"type": "null", "title": "Deactivated", "description": "None"},
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
UniqueQLField = Annotated[
|
|
351
|
+
UniqueQL | None,
|
|
352
|
+
BeforeValidator(parse_uniqueql_input),
|
|
353
|
+
WithJsonSchema(_UNIQUEQL_JSON_SCHEMA),
|
|
354
|
+
PlainSerializer(
|
|
355
|
+
_serialize_uniqueql_field,
|
|
356
|
+
when_used="json",
|
|
357
|
+
return_type=dict[str, Any] | None,
|
|
358
|
+
),
|
|
359
|
+
]
|
|
@@ -6,8 +6,10 @@ from typing import Annotated, Self
|
|
|
6
6
|
from pydantic import Field, model_validator
|
|
7
7
|
|
|
8
8
|
from unique_toolkit._common.config_checker import register_config
|
|
9
|
+
from unique_toolkit._common.pydantic.rjsf_tags import RJSFMetaTag
|
|
9
10
|
from unique_toolkit._common.pydantic_helpers import DeactivatedNone
|
|
10
11
|
from unique_toolkit.content.schemas import ContentRerankerConfig
|
|
12
|
+
from unique_toolkit.content.smart_rules import UniqueQLField
|
|
11
13
|
from unique_toolkit.experimental.components.internal_search.base.config import (
|
|
12
14
|
InternalSearchConfig,
|
|
13
15
|
)
|
|
@@ -15,9 +17,11 @@ from unique_toolkit.experimental.components.internal_search.base.config import (
|
|
|
15
17
|
|
|
16
18
|
@register_config()
|
|
17
19
|
class KnowledgeBaseInternalSearchConfig(InternalSearchConfig):
|
|
18
|
-
scope_ids:
|
|
20
|
+
scope_ids: Annotated[
|
|
21
|
+
Annotated[list[str], Field(title="Scope IDs")] | DeactivatedNone,
|
|
22
|
+
RJSFMetaTag({"anyOf": [{"items": {"ui:title": "Scope ID"}}, {}]}),
|
|
23
|
+
] = Field(
|
|
19
24
|
default=None,
|
|
20
|
-
title="Active",
|
|
21
25
|
deprecated=True,
|
|
22
26
|
description=(
|
|
23
27
|
"Not accepted for new configs. Use ``metadata_filter`` with "
|
|
@@ -26,10 +30,29 @@ class KnowledgeBaseInternalSearchConfig(InternalSearchConfig):
|
|
|
26
30
|
"a ``folderId in [scope_ids]`` metadata filter at search time."
|
|
27
31
|
),
|
|
28
32
|
)
|
|
29
|
-
metadata_filter:
|
|
33
|
+
metadata_filter: Annotated[
|
|
34
|
+
UniqueQLField,
|
|
35
|
+
# Put textarea attrs on the string branch (index 0) only, not at field level.
|
|
36
|
+
# If set at field level, RJSF's MultiSchemaField applies ui:widget to every
|
|
37
|
+
# anyOf branch during option iteration, which crashes on non-string branches.
|
|
38
|
+
RJSFMetaTag(
|
|
39
|
+
{
|
|
40
|
+
"ui:options": {"customValidation": "uniqueql"},
|
|
41
|
+
"anyOf": [
|
|
42
|
+
{
|
|
43
|
+
"ui:widget": "textarea",
|
|
44
|
+
"ui:placeholder": '{"operator": "equals", "value": "...", "path": ["fieldName"]}',
|
|
45
|
+
"ui:emptyValue": "",
|
|
46
|
+
},
|
|
47
|
+
{},
|
|
48
|
+
],
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
] = Field(
|
|
30
52
|
default=None,
|
|
31
53
|
description=(
|
|
32
|
-
"Static metadata filter applied to every KB search. "
|
|
54
|
+
"Static UniqueQL metadata filter applied to every KB search. "
|
|
55
|
+
"Pass as a JSON string or a plain dict. "
|
|
33
56
|
"Overridden by chat context filter or per-invocation state override."
|
|
34
57
|
),
|
|
35
58
|
)
|
|
@@ -105,7 +105,11 @@ class KnowledgeBaseInternalSearchService(
|
|
|
105
105
|
return cast("dict[str, Any] | None", self._state.metadata_filter_override)
|
|
106
106
|
if self._context.chat is not None:
|
|
107
107
|
return self._context.chat.metadata_filter
|
|
108
|
-
return
|
|
108
|
+
return (
|
|
109
|
+
self._config.metadata_filter.to_dict()
|
|
110
|
+
if self._config.metadata_filter
|
|
111
|
+
else None
|
|
112
|
+
)
|
|
109
113
|
|
|
110
114
|
@property
|
|
111
115
|
def _effective_scope_ids(self) -> list[str] | None:
|
|
@@ -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",
|
|
@@ -7,6 +7,7 @@ from unique_toolkit.content.smart_rules import (
|
|
|
7
7
|
OrStatement,
|
|
8
8
|
Statement,
|
|
9
9
|
UniqueQL,
|
|
10
|
+
UniqueQLField,
|
|
10
11
|
array_operator,
|
|
11
12
|
binary_operator,
|
|
12
13
|
calculate_current_date,
|
|
@@ -19,9 +20,11 @@ from unique_toolkit.content.smart_rules import (
|
|
|
19
20
|
is_array_of_strings,
|
|
20
21
|
null_operator,
|
|
21
22
|
parse_uniqueql,
|
|
23
|
+
parse_uniqueql_input,
|
|
22
24
|
replace_tool_parameters_patterns,
|
|
23
25
|
replace_user_metadata_patterns,
|
|
24
26
|
replace_variables,
|
|
27
|
+
uniqueql_to_dict,
|
|
25
28
|
)
|
|
26
29
|
|
|
27
30
|
warnings.warn(
|
|
@@ -38,6 +41,7 @@ __all__ = [
|
|
|
38
41
|
"OrStatement",
|
|
39
42
|
"Statement",
|
|
40
43
|
"UniqueQL",
|
|
44
|
+
"UniqueQLField",
|
|
41
45
|
"array_operator",
|
|
42
46
|
"binary_operator",
|
|
43
47
|
"calculate_current_date",
|
|
@@ -50,7 +54,9 @@ __all__ = [
|
|
|
50
54
|
"is_array_of_strings",
|
|
51
55
|
"null_operator",
|
|
52
56
|
"parse_uniqueql",
|
|
57
|
+
"parse_uniqueql_input",
|
|
53
58
|
"replace_tool_parameters_patterns",
|
|
54
59
|
"replace_user_metadata_patterns",
|
|
55
60
|
"replace_variables",
|
|
61
|
+
"uniqueql_to_dict",
|
|
56
62
|
]
|
{unique_toolkit-2026.24.0.dev4.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
|
|
@@ -58,8 +58,8 @@ unique_toolkit/_common/experimental/write_up_agent/services/template_handler/ser
|
|
|
58
58
|
unique_toolkit/_common/experimental/write_up_agent/services/template_handler/utils.py,sha256=FeJhTAU7AUlSFCfFwmEzzI22PtAdFJluzsGeiEPK49Q,6393
|
|
59
59
|
unique_toolkit/_common/experimental/write_up_agent/utils.py,sha256=I_OCDXCxY6uZk_fNQg_bIXHwjnN7ND_ngcisThnGGIc,739
|
|
60
60
|
unique_toolkit/_common/feature_flags/schema.py,sha256=X32VqH4VMK7bhEfSd8Wbddl8FVs7Gh7ucuIEbmqc4Kw,268
|
|
61
|
-
unique_toolkit/_common/metadata_filter_scope.py,sha256=
|
|
62
|
-
unique_toolkit/_common/pydantic/rjsf_tags.py,sha256=
|
|
61
|
+
unique_toolkit/_common/metadata_filter_scope.py,sha256=Lj7oYrqHUoiqSBn6PA1FmeqtZONhSdQ8u3CR5YolxcM,1432
|
|
62
|
+
unique_toolkit/_common/pydantic/rjsf_tags.py,sha256=B4iMCvKlzP-xE8pp56uJ4xYNB89Vz9u3z5MXXx68CPs,39955
|
|
63
63
|
unique_toolkit/_common/pydantic_helpers.py,sha256=LTI21litYJdzRe7cbgO1ntKf06yb5V8v7hASMM3Wwa8,5839
|
|
64
64
|
unique_toolkit/_common/referencing.py,sha256=UY7-9nJLcRqlHUNytfJZPVkdpjvy5wIps_7P33_qgA0,1496
|
|
65
65
|
unique_toolkit/_common/string_utilities.py,sha256=HOAOZbH3vRmTDwUCIF0YTE04IWcVHZyq3uOmevxWXn0,4433
|
|
@@ -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,12 +248,12 @@ 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
|
|
255
255
|
unique_toolkit/content/service.py,sha256=fR93_76aPczx2voxR7cvYDs_-pxD-Mc9WP6-5IqA8ko,28301
|
|
256
|
-
unique_toolkit/content/smart_rules.py,sha256=
|
|
256
|
+
unique_toolkit/content/smart_rules.py,sha256=9GlHXm63POTi4jy5hW0qUjeqy-JSeL1wIbURM1GKhc4,11481
|
|
257
257
|
unique_toolkit/content/utils.py,sha256=keDkqu_ZzQY0y_g7g_XLOza3p4XsvfqVVDI9ylM91KY,10115
|
|
258
258
|
unique_toolkit/data_extraction/README.md,sha256=5KxzqPHC29wxBiWJ-87wBQisSgRBkuSnPTb38pGH1wA,3138
|
|
259
259
|
unique_toolkit/data_extraction/__init__.py,sha256=y6uSp8PAqgPZMoBgXWp1Ep0gsk9MD-NV8qn2QpOY-xY,330
|
|
@@ -299,9 +299,9 @@ unique_toolkit/experimental/components/internal_search/chat/config.py,sha256=2DQ
|
|
|
299
299
|
unique_toolkit/experimental/components/internal_search/chat/schemas.py,sha256=vWPulL7QVo9y8vPZTKAeHVYOCHG1DmKIh6W75S0jEnA,299
|
|
300
300
|
unique_toolkit/experimental/components/internal_search/chat/service.py,sha256=SO60zGtzJIp5kGLEXCzHwcKgdN4MGeiv5kjGA3ki9fc,2355
|
|
301
301
|
unique_toolkit/experimental/components/internal_search/knowledge_base/__init__.py,sha256=eAp_8qw5XP2z6GFbxvVCmwgirXxMvJuEDZGx-PsFi54,411
|
|
302
|
-
unique_toolkit/experimental/components/internal_search/knowledge_base/config.py,sha256=
|
|
302
|
+
unique_toolkit/experimental/components/internal_search/knowledge_base/config.py,sha256=QyewUg9tH5mmfL56N3mpFUZ3_2qSthitd8JCV1oX3oU,3232
|
|
303
303
|
unique_toolkit/experimental/components/internal_search/knowledge_base/schemas.py,sha256=q5tk4IcpyypzqMb_36nEpO_eZgE9PqQsFrlpXJIwVWk,912
|
|
304
|
-
unique_toolkit/experimental/components/internal_search/knowledge_base/service.py,sha256=
|
|
304
|
+
unique_toolkit/experimental/components/internal_search/knowledge_base/service.py,sha256=LBp6SPJ8mO5x9rAbey-mejHZFK8om9EviyRUNGm5W7s,4856
|
|
305
305
|
unique_toolkit/experimental/components/internal_search/post_processing/__init__.py,sha256=ndNXfBOya9AEzhg8inbJVRpOtG809cw9vURK1yXnlAY,1896
|
|
306
306
|
unique_toolkit/experimental/components/internal_search/post_processing/config.py,sha256=Rkfm1PZhotJ8yyOK_SufIlUNcknyNzqMZWl4wYHnZMM,2385
|
|
307
307
|
unique_toolkit/experimental/components/internal_search/post_processing/service.py,sha256=5GL0bm4a24saPLUamP59CPPjxGlpEgBHBDCn7OqWGEI,7499
|
|
@@ -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
|
|
@@ -389,8 +389,8 @@ unique_toolkit/short_term_memory/functions.py,sha256=RQpdcpAIKQ8rRDhP8bHqekIKttQ
|
|
|
389
389
|
unique_toolkit/short_term_memory/schemas.py,sha256=C6gopsnuIgWJBG7XF87gxMwzLJtqbSGmsKXUf2h1sn4,1666
|
|
390
390
|
unique_toolkit/short_term_memory/service.py,sha256=Ncw0_0CNM6kmzJSLVJGG5GcKpBduIBebYZlzZ7N4G8Q,8900
|
|
391
391
|
unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
392
|
-
unique_toolkit/smart_rules/compile.py,sha256=
|
|
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
|