unique_internal_search 2026.32.0.dev1__tar.gz → 2026.32.0.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (15) hide show
  1. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/PKG-INFO +2 -2
  2. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/pyproject.toml +2 -2
  3. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/config.py +3 -12
  4. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/service.py +12 -4
  5. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/README.md +0 -0
  6. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/__init__.py +0 -0
  7. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/invocation_stats.py +0 -0
  8. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/prompts.py +0 -0
  9. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/services/message_log.py +0 -0
  10. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/uploaded_search/config.py +0 -0
  11. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/uploaded_search/prompts/__init__.py +0 -0
  12. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/uploaded_search/prompts/tool_description_for_system_prompt.j2 +0 -0
  13. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/uploaded_search/service.py +0 -0
  14. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/utils.py +0 -0
  15. {unique_internal_search-2026.32.0.dev1 → unique_internal_search-2026.32.0.dev2}/unique_internal_search/validators.py +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: unique-internal-search
3
- Version: 2026.32.0.dev1
3
+ Version: 2026.32.0.dev2
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>
7
7
  License: Proprietary
8
8
  Requires-Dist: pydantic>=2.8.2,<3
9
9
  Requires-Dist: typing-extensions>=4.9.0,<5
10
- Requires-Dist: unique-toolkit>=2026.32.0.dev4,<2026.32.0rc0
10
+ Requires-Dist: unique-toolkit>=2026.32.0.dev8,<2026.32.0rc0
11
11
  Requires-Python: >=3.12, <4
12
12
  Description-Content-Type: text/markdown
13
13
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "unique_internal_search"
3
- version = "2026.32.0.dev1"
3
+ version = "2026.32.0.dev2"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  license = { text = "Proprietary" }
@@ -14,7 +14,7 @@ requires-python = ">=3.12,<4"
14
14
  dependencies = [
15
15
  "pydantic>=2.8.2,<3",
16
16
  "typing-extensions>=4.9.0,<5",
17
- "unique-toolkit>=2026.32.0.dev4,<2026.32.0rc0",
17
+ "unique-toolkit>=2026.32.0.dev8,<2026.32.0rc0",
18
18
  ]
19
19
 
20
20
  [build-system]
@@ -33,8 +33,7 @@ from unique_internal_search.prompts import (
33
33
  )
34
34
  from unique_internal_search.validators import get_string_field_with_pattern_validation
35
35
 
36
- DEFAULT_LIMIT_CHUNK_RELEVANCY_SORT_ENABLED = 200
37
- DEFAULT_LIMIT_CHUNK_RELEVANCY_SORT_DISABLED = 1000
36
+ DEFAULT_SEARCH_LIMIT = 200
38
37
 
39
38
 
40
39
  class ToolResponseSystemReminderConfig(BaseModel):
@@ -72,14 +71,6 @@ class ExperimentalFeatures(FeatureExtendedSourceSerialization):
72
71
  )
73
72
 
74
73
 
75
- def _search_limit_factory(data: dict[str, Any]) -> int:
76
- return (
77
- DEFAULT_LIMIT_CHUNK_RELEVANCY_SORT_ENABLED
78
- if data["chunk_relevancy_sort_config"].enabled
79
- else DEFAULT_LIMIT_CHUNK_RELEVANCY_SORT_DISABLED
80
- )
81
-
82
-
83
74
  _FIELD_ALIASES: dict[str, str] = {
84
75
  "ftsSearchLanguage": "searchLanguage",
85
76
  }
@@ -145,8 +136,8 @@ class InternalSearchConfig(BaseToolConfig):
145
136
  description="The chunk relevancy sort config to use for the search.",
146
137
  )
147
138
  limit: int = Field(
148
- default_factory=_search_limit_factory,
149
- description="The maximum limit of chunks returned by the search.",
139
+ default=DEFAULT_SEARCH_LIMIT,
140
+ description="Maximum number of chunks returned in total across all search strings, capped by the token budget. Also used as the per-search-string fetch ceiling.",
150
141
  )
151
142
  chat_only: bool = Field(
152
143
  default=False,
@@ -228,6 +228,13 @@ class InternalSearchService:
228
228
  for result in found_chunks_per_search_string
229
229
  for chunk in result.chunks
230
230
  ]
231
+ if len(found_chunks) > self.config.limit:
232
+ self.logger.info(
233
+ "Truncating %s chunks to the configured total limit of %s",
234
+ len(found_chunks),
235
+ self.config.limit,
236
+ )
237
+ found_chunks = found_chunks[: self.config.limit]
231
238
  selected_chunks = pick_content_chunks_for_token_window(
232
239
  found_chunks,
233
240
  self._get_max_tokens(),
@@ -259,13 +266,12 @@ class InternalSearchService:
259
266
  content_ids: list[str] | None = None,
260
267
  ) -> SearchStringResult:
261
268
  try:
262
- capped_limit = self._cap_limit_to_token_budget()
263
269
  found_chunks: list[
264
270
  ContentChunk
265
271
  ] = await self.content_service.search_content_chunks_async(
266
272
  search_string=search_string, # type: ignore
267
273
  search_type=self.config.search_type,
268
- limit=capped_limit,
274
+ limit=self._cap_limit_to_token_budget(),
269
275
  reranker_config=self.config.reranker_config,
270
276
  search_language=self.config.search_language,
271
277
  scope_ids=self.config.scope_ids,
@@ -359,10 +365,12 @@ class InternalSearchService:
359
365
  capped_limit = min(self.config.limit, token_based_limit)
360
366
  if capped_limit < self.config.limit:
361
367
  self.logger.info(
362
- f"Search limit capped from {self.config.limit} to {capped_limit} (token budget)"
368
+ "Search limit capped from %s to %s (token budget)",
369
+ self.config.limit,
370
+ capped_limit,
363
371
  )
364
372
  else:
365
- self.logger.info(f"Search limit: {capped_limit} (within token budget)")
373
+ self.logger.info("Search limit: %s (within token budget)", capped_limit)
366
374
  return capped_limit
367
375
 
368
376