unique_internal_search 2026.22.0.dev2__tar.gz → 2026.22.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.
Files changed (14) hide show
  1. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/PKG-INFO +2 -2
  2. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/pyproject.toml +2 -2
  3. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/unique_internal_search/uploaded_search/config.py +8 -0
  4. unique_internal_search-2026.22.0.dev2/unique_internal_search/uploaded_search/prompts.py → unique_internal_search-2026.22.0.dev3/unique_internal_search/uploaded_search/prompts/__init__.py +8 -15
  5. unique_internal_search-2026.22.0.dev3/unique_internal_search/uploaded_search/prompts/tool_description_for_system_prompt.j2 +21 -0
  6. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/unique_internal_search/uploaded_search/service.py +14 -36
  7. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/README.md +0 -0
  8. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/unique_internal_search/__init__.py +0 -0
  9. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/unique_internal_search/config.py +0 -0
  10. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/unique_internal_search/prompts.py +0 -0
  11. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/unique_internal_search/service.py +0 -0
  12. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/unique_internal_search/services/message_log.py +0 -0
  13. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/unique_internal_search/utils.py +0 -0
  14. {unique_internal_search-2026.22.0.dev2 → unique_internal_search-2026.22.0.dev3}/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.22.0.dev2
3
+ Version: 2026.22.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>
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.22.0.dev5,<2026.22.0rc0
10
+ Requires-Dist: unique-toolkit>=2026.22.0.dev7,<2026.22.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.22.0.dev2"
3
+ version = "2026.22.0.dev3"
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.22.0.dev5,<2026.22.0rc0",
17
+ "unique-toolkit>=2026.22.0.dev7,<2026.22.0rc0",
18
18
  ]
19
19
 
20
20
  [build-system]
@@ -1,5 +1,7 @@
1
1
  from typing import Annotated
2
2
 
3
+ from pydantic import Field
4
+ from pydantic.json_schema import SkipJsonSchema
3
5
  from unique_toolkit._common.pydantic.rjsf_tags import RJSFMetaTag
4
6
 
5
7
  from unique_internal_search.config import InternalSearchConfig
@@ -51,3 +53,9 @@ class UploadedSearchConfig(InternalSearchConfig):
51
53
  DEFAULT_TOOL_FORMAT_INFORMATION_FOR_SYSTEM_PROMPT,
52
54
  description="Tool format information for the system prompt.",
53
55
  )
56
+ # This is a hack to ensure that the system reminder is enabled when the tool is forced,
57
+ # as we cannot at the moment easily pass extra values to the tool constructor
58
+ enable_tool_call_system_reminder: SkipJsonSchema[bool] = Field(
59
+ default=True,
60
+ description="Whether to attach the uploaded-search system reminder to tool responses.",
61
+ )
@@ -1,18 +1,11 @@
1
- DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT = (
2
- "You can use the UploadedSearch tool to access and analyze documents uploaded by users during a chat. This tool is designed to handle a variety of document-related tasks, including summarization, explanation, and detailed information retrieval. "
3
- "Use cases for the UploadedSearch tool include:\n"
4
- "- Document Analysis: When a user uploads a document and asks for a summary, explanation, or specific details, this tool can extract and provide the requested information.\n"
5
- "- Named Document Queries: If a user refers to a previously uploaded document by name (e.g., 'What does the Q2_Report.pdf say about revenue?'), this tool can locate and analyze the document to answer the query.\n"
6
- "- Policy and Procedure Verification: Use the tool to find the most current company policies, procedures, or guidelines within uploaded documents.\n"
7
- "- Project-Specific Information: Access project documents, reports, or meeting notes uploaded by users to provide precise details.\n"
8
- "- Confidential and Proprietary Information: Ensure that sensitive topics requiring proprietary knowledge or confidential data are sourced securely from uploaded documents.\n\n"
9
- "**Instruction Query Splitting**\n"
10
- "You should split the user question into multiple search strings when the user's question needs to be decomposed / rewritten to find different facts. Perform an individual tool call for each search string. Avoid overly broad queries that may return unrelated results. Ensure the search string is specific and relevant to the uploaded document(s).\n\n"
11
- "Examples:\n"
12
- 'User: "What does the Q2_Report.pdf say about revenue and expenses?" => search strings: ["Q2_Report.pdf revenue", "Q2_Report.pdf expenses"]\n'
13
- 'User: "Summarize the uploaded document." => search string: ["Summarize the uploaded document"]\n\n'
14
- "{system_prompt_valid_documents}"
15
- "{system_prompt_expired_documents}"
1
+ from pathlib import Path
2
+
3
+ from unique_toolkit._common.utils.jinja.helpers import load_template
4
+
5
+ _PROMPTS_DIR = Path(__file__).parent
6
+
7
+ DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT = load_template(
8
+ _PROMPTS_DIR, "tool_description_for_system_prompt.j2"
16
9
  )
17
10
 
18
11
  DEFAULT_TOOL_FORMAT_INFORMATION_FOR_SYSTEM_PROMPT = (
@@ -0,0 +1,21 @@
1
+ You can use the UploadedSearch tool to access and analyze documents uploaded by users during a chat. This tool is designed to handle a variety of document-related tasks, including summarization, explanation, and detailed information retrieval. Use cases for the UploadedSearch tool include:
2
+ - Document Analysis: When a user uploads a document and asks for a summary, explanation, or specific details, this tool can extract and provide the requested information.
3
+ - Named Document Queries: If a user refers to a previously uploaded document by name (e.g., 'What does the Q2_Report.pdf say about revenue?'), this tool can locate and analyze the document to answer the query.
4
+ - Policy and Procedure Verification: Use the tool to find the most current company policies, procedures, or guidelines within uploaded documents.
5
+ - Project-Specific Information: Access project documents, reports, or meeting notes uploaded by users to provide precise details.
6
+ - Confidential and Proprietary Information: Ensure that sensitive topics requiring proprietary knowledge or confidential data are sourced securely from uploaded documents.
7
+
8
+ **Instruction Query Splitting**
9
+ You should split the user question into multiple search strings when the user's question needs to be decomposed / rewritten to find different facts. Perform an individual tool call for each search string. Avoid overly broad queries that may return unrelated results. Ensure the search string is specific and relevant to the uploaded document(s).
10
+
11
+ Examples:
12
+ User: "What does the Q2_Report.pdf say about revenue and expenses?" => search strings: ["Q2_Report.pdf revenue", "Q2_Report.pdf expenses"]
13
+ User: "Summarize the uploaded document." => search string: ["Summarize the uploaded document"]
14
+
15
+ {% if valid_documents %}
16
+ **The currently uploaded and searchable documents are the following**
17
+ {% for document in valid_documents %}
18
+ - {{ document.name }} (content_id: {{ document.id }})
19
+ {% endfor %}
20
+
21
+ {% endif %}
@@ -1,6 +1,7 @@
1
1
  from pydantic import Field, create_model
2
2
  from typing_extensions import override
3
3
  from unique_toolkit import ContentService
4
+ from unique_toolkit._common.utils.jinja.render import render_template
4
5
  from unique_toolkit.agentic.evaluation.schemas import EvaluationMetricName
5
6
  from unique_toolkit.agentic.feature_flags import feature_flags
6
7
  from unique_toolkit.agentic.tools.factory import ToolFactory
@@ -82,45 +83,19 @@ class UploadedSearchTool(Tool[UploadedSearchConfig]):
82
83
  ]
83
84
 
84
85
  valid_documents = []
85
- expired_documents = []
86
86
  for doc in documents:
87
- if not doc.is_ingested(default_if_unknown=True):
87
+ if not doc.is_ingested(default_if_unknown=True) or doc.is_expired():
88
88
  continue
89
- if doc.is_expired():
90
- expired_documents.append(doc)
91
- else:
92
- valid_documents.append(doc)
93
-
94
- system_prompt_valid_documents = ""
95
- system_prompt_expired_documents = ""
96
- if valid_documents:
97
- system_prompt_valid_documents = (
98
- "**The currently uploaded and valid documents are the following**\n"
99
- )
100
- system_prompt_valid_documents = (
101
- system_prompt_valid_documents
102
- + "\n".join(
103
- f"- {doc.title or doc.key} (content_id: {doc.id})"
104
- for doc in valid_documents
105
- )
106
- + "\n"
89
+ valid_documents.append(
90
+ {
91
+ "name": doc.title or doc.key,
92
+ "id": doc.id,
93
+ }
107
94
  )
108
95
 
109
- if expired_documents:
110
- system_prompt_expired_documents = (
111
- "**The currently uploaded and expired documents are the following**\n"
112
- )
113
- system_prompt_expired_documents = (
114
- system_prompt_expired_documents
115
- + "\n".join(
116
- f"- {doc.title or doc.key} (content_id: {doc.id})"
117
- for doc in expired_documents
118
- )
119
- )
120
-
121
- return self._config.tool_description_for_system_prompt.format(
122
- system_prompt_valid_documents=system_prompt_valid_documents,
123
- system_prompt_expired_documents=system_prompt_expired_documents,
96
+ return render_template(
97
+ self._config.tool_description_for_system_prompt,
98
+ valid_documents=valid_documents,
124
99
  )
125
100
 
126
101
  def tool_format_information_for_system_prompt(self) -> str:
@@ -153,7 +128,10 @@ class UploadedSearchTool(Tool[UploadedSearchConfig]):
153
128
  state=ProgressState.FINISHED,
154
129
  )
155
130
  tool_response.name = self.name
156
- tool_response.system_reminder = self._get_tool_call_response_system_reminder()
131
+ if self._config.enable_tool_call_system_reminder:
132
+ tool_response.system_reminder = (
133
+ self._get_tool_call_response_system_reminder()
134
+ )
157
135
  return tool_response
158
136
 
159
137
  def _get_tool_call_response_system_reminder(self) -> str: