unique_internal_search 2026.36.0.dev2__tar.gz → 2026.36.0.dev3__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.
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/PKG-INFO +1 -1
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/pyproject.toml +1 -1
- unique_internal_search-2026.36.0.dev3/unique_internal_search/invocation_stats.py +5 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/service.py +3 -6
- unique_internal_search-2026.36.0.dev2/unique_internal_search/invocation_stats.py +0 -33
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/README.md +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/__init__.py +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/config.py +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/prompts.py +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/services/message_log.py +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/uploaded_search/config.py +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/uploaded_search/prompts/__init__.py +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/uploaded_search/prompts/tool_description_for_system_prompt.j2 +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/uploaded_search/service.py +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/utils.py +0 -0
- {unique_internal_search-2026.36.0.dev2 → unique_internal_search-2026.36.0.dev3}/unique_internal_search/validators.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: unique-internal-search
|
|
3
|
-
Version: 2026.36.0.
|
|
3
|
+
Version: 2026.36.0.dev3
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Martin Fadler, Sadique Sheik, Fabian Schläpfer, Pascal Hauri
|
|
6
6
|
Author-email: Martin Fadler <martin.fadler@unique.ch>, Sadique Sheik <sadique@unique.ch>, Fabian Schläpfer <fabian@unique.ch>, Pascal Hauri <pascal@unique.ch>
|
|
@@ -37,10 +37,7 @@ from unique_toolkit.language_model.schemas import (
|
|
|
37
37
|
)
|
|
38
38
|
|
|
39
39
|
from unique_internal_search.config import InternalSearchConfig
|
|
40
|
-
from unique_internal_search.invocation_stats import
|
|
41
|
-
invocation_stats_scope,
|
|
42
|
-
record_invocation_stats,
|
|
43
|
-
)
|
|
40
|
+
from unique_internal_search.invocation_stats import collector
|
|
44
41
|
from unique_internal_search.services.message_log import (
|
|
45
42
|
InternalSearchMessageLogger,
|
|
46
43
|
InternalSearchMessageLoggerNoop,
|
|
@@ -322,7 +319,7 @@ class InternalSearchService:
|
|
|
322
319
|
config=self.config.chunk_relevancy_sort_config,
|
|
323
320
|
)
|
|
324
321
|
if isinstance(chunk_relevancy_sorter_result.relevancies, list):
|
|
325
|
-
record_invocation_stats(
|
|
322
|
+
collector.record_invocation_stats(
|
|
326
323
|
invocation
|
|
327
324
|
for relevancy in chunk_relevancy_sorter_result.relevancies
|
|
328
325
|
if relevancy.relevancy is not None
|
|
@@ -493,7 +490,7 @@ class InternalSearchTool(Tool[InternalSearchConfig], InternalSearchService):
|
|
|
493
490
|
# TODO: find a solution for tracking
|
|
494
491
|
# @track(name="internal_search_tool_run")
|
|
495
492
|
async def run(self, tool_call: LanguageModelFunction) -> ToolCallResponse:
|
|
496
|
-
with
|
|
493
|
+
with collector.scope() as invocation_stats:
|
|
497
494
|
try:
|
|
498
495
|
response = await self._run(tool_call)
|
|
499
496
|
except Exception as e:
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"""Run-scoped collection of language-model invocation usage."""
|
|
2
|
-
|
|
3
|
-
from collections.abc import Generator, Iterable
|
|
4
|
-
from contextlib import contextmanager
|
|
5
|
-
from contextvars import ContextVar, Token
|
|
6
|
-
|
|
7
|
-
from unique_toolkit.language_model.invocation_stats import LanguageModelInvocationStats
|
|
8
|
-
|
|
9
|
-
_CURRENT_INVOCATION_STATS: ContextVar[list[LanguageModelInvocationStats] | None] = (
|
|
10
|
-
ContextVar("internal_search_invocation_stats", default=None)
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@contextmanager
|
|
15
|
-
def invocation_stats_scope() -> Generator[list[LanguageModelInvocationStats]]:
|
|
16
|
-
"""Collect stats for one internal-search run and isolate concurrent runs."""
|
|
17
|
-
invocation_stats: list[LanguageModelInvocationStats] = []
|
|
18
|
-
token: Token[list[LanguageModelInvocationStats] | None] = (
|
|
19
|
-
_CURRENT_INVOCATION_STATS.set(invocation_stats)
|
|
20
|
-
)
|
|
21
|
-
try:
|
|
22
|
-
yield invocation_stats
|
|
23
|
-
finally:
|
|
24
|
-
_CURRENT_INVOCATION_STATS.reset(token)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def record_invocation_stats(
|
|
28
|
-
invocation_stats: Iterable[LanguageModelInvocationStats],
|
|
29
|
-
) -> None:
|
|
30
|
-
"""Record usage when an internal-search run scope is active."""
|
|
31
|
-
current_invocation_stats = _CURRENT_INVOCATION_STATS.get()
|
|
32
|
-
if current_invocation_stats is not None:
|
|
33
|
-
current_invocation_stats.extend(invocation_stats)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|