unique_toolkit 0.7.0__py3-none-any.whl → 0.7.1__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/content/service.py +36 -17
- {unique_toolkit-0.7.0.dist-info → unique_toolkit-0.7.1.dist-info}/METADATA +5 -2
- {unique_toolkit-0.7.0.dist-info → unique_toolkit-0.7.1.dist-info}/RECORD +5 -5
- {unique_toolkit-0.7.0.dist-info → unique_toolkit-0.7.1.dist-info}/LICENSE +0 -0
- {unique_toolkit-0.7.0.dist-info → unique_toolkit-0.7.1.dist-info}/WHEEL +0 -0
@@ -35,9 +35,10 @@ class ContentService:
|
|
35
35
|
Provides methods for searching, downloading and uploading content in the knowledge base.
|
36
36
|
|
37
37
|
Attributes:
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
event: BaseEvent | Event, this can be None ONLY if company_id and user_id are provided.
|
39
|
+
company_id (str): The company ID.
|
40
|
+
user_id (str): The user ID.
|
41
|
+
metadata_filter (dict | None): is only initialised from an Event(Deprecated) or ChatEvent.
|
41
42
|
"""
|
42
43
|
|
43
44
|
def __init__(
|
@@ -77,6 +78,7 @@ class ContentService:
|
|
77
78
|
search_type: ContentSearchType,
|
78
79
|
limit: int,
|
79
80
|
search_language: str = DEFAULT_SEARCH_LANGUAGE,
|
81
|
+
chat_id: str = "",
|
80
82
|
reranker_config: ContentRerankerConfig | None = None,
|
81
83
|
scope_ids: list[str] | None = None,
|
82
84
|
chat_only: bool | None = None,
|
@@ -90,24 +92,32 @@ class ContentService:
|
|
90
92
|
search_string (str): The search string.
|
91
93
|
search_type (ContentSearchType): The type of search to perform.
|
92
94
|
limit (int): The maximum number of results to return.
|
93
|
-
search_language (str): The language for the full-text search. Defaults to "english".
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
95
|
+
search_language (str, optional): The language for the full-text search. Defaults to "english".
|
96
|
+
chat_id (str, optional): The chat ID for context. Defaults to empty string.
|
97
|
+
reranker_config (ContentRerankerConfig | None, optional): The reranker configuration. Defaults to None.
|
98
|
+
scope_ids (list[str] | None, optional): The scope IDs to filter by. Defaults to None.
|
99
|
+
chat_only (bool | None, optional): Whether to search only in the current chat. Defaults to None.
|
100
|
+
metadata_filter (dict | None, optional): UniqueQL metadata filter. If unspecified/None, it tries to use the metadata filter from the event. Defaults to None.
|
101
|
+
content_ids (list[str] | None, optional): The content IDs to search within. Defaults to None.
|
102
|
+
|
99
103
|
Returns:
|
100
104
|
list[ContentChunk]: The search results.
|
105
|
+
|
106
|
+
Raises:
|
107
|
+
Exception: If there's an error during the search operation.
|
101
108
|
"""
|
102
109
|
|
103
110
|
if metadata_filter is None:
|
104
111
|
metadata_filter = self.metadata_filter
|
105
112
|
|
113
|
+
if chat_only and not chat_id:
|
114
|
+
raise ValueError("Please provide chat_id when limiting with chat_only")
|
115
|
+
|
106
116
|
try:
|
107
117
|
searches = search_content_chunks(
|
108
118
|
user_id=self.user_id,
|
109
119
|
company_id=self.company_id,
|
110
|
-
chat_id=
|
120
|
+
chat_id=chat_id,
|
111
121
|
search_string=search_string,
|
112
122
|
search_type=search_type,
|
113
123
|
limit=limit,
|
@@ -129,6 +139,7 @@ class ContentService:
|
|
129
139
|
search_type: ContentSearchType,
|
130
140
|
limit: int,
|
131
141
|
search_language: str = DEFAULT_SEARCH_LANGUAGE,
|
142
|
+
chat_id: str = "",
|
132
143
|
reranker_config: ContentRerankerConfig | None = None,
|
133
144
|
scope_ids: list[str] | None = None,
|
134
145
|
chat_only: bool | None = None,
|
@@ -142,23 +153,31 @@ class ContentService:
|
|
142
153
|
search_string (str): The search string.
|
143
154
|
search_type (ContentSearchType): The type of search to perform.
|
144
155
|
limit (int): The maximum number of results to return.
|
145
|
-
search_language (str): The language for the full-text search. Defaults to "english".
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
156
|
+
search_language (str, optional): The language for the full-text search. Defaults to "english".
|
157
|
+
chat_id (str, optional): The chat ID for context. Defaults to empty string.
|
158
|
+
reranker_config (ContentRerankerConfig | None, optional): The reranker configuration. Defaults to None.
|
159
|
+
scope_ids (list[str] | None, optional): The scope IDs to filter by. Defaults to None.
|
160
|
+
chat_only (bool | None, optional): Whether to search only in the current chat. Defaults to None.
|
161
|
+
metadata_filter (dict | None, optional): UniqueQL metadata filter. If unspecified/None, it tries to use the metadata filter from the event. Defaults to None.
|
162
|
+
content_ids (list[str] | None, optional): The content IDs to search within. Defaults to None.
|
163
|
+
|
151
164
|
Returns:
|
152
165
|
list[ContentChunk]: The search results.
|
166
|
+
|
167
|
+
Raises:
|
168
|
+
Exception: If there's an error during the search operation.
|
153
169
|
"""
|
154
170
|
if metadata_filter is None:
|
155
171
|
metadata_filter = self.metadata_filter
|
156
172
|
|
173
|
+
if chat_only and not chat_id:
|
174
|
+
raise ValueError("Please provide chat_id when limiting with chat_only.")
|
175
|
+
|
157
176
|
try:
|
158
177
|
searches = await search_content_chunks_async(
|
159
178
|
user_id=self.user_id,
|
160
179
|
company_id=self.company_id,
|
161
|
-
chat_id=
|
180
|
+
chat_id=chat_id,
|
162
181
|
search_string=search_string,
|
163
182
|
search_type=search_type,
|
164
183
|
limit=limit,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unique_toolkit
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.1
|
4
4
|
Summary:
|
5
5
|
License: Proprietary
|
6
6
|
Author: Martin Fadler
|
@@ -111,9 +111,12 @@ All notable changes to this project will be documented in this file.
|
|
111
111
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
112
112
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
113
113
|
|
114
|
+
## [0.7.1] - 2025-03-11
|
115
|
+
- Fix Breaking change: `ContentService.search_content_chunks` `ContentService.search_content_chunks` now accepts`chat_id` for the specific to handle chat_only instances
|
116
|
+
|
114
117
|
## [0.7.0] - 2025-03-11
|
115
118
|
- Fix the issue with `ShortTermMemoryService.create_memory_async` adding `self.chat_id` and `self.message_id` as part of the parameter.
|
116
|
-
- Breaking
|
119
|
+
- Breaking change: `ContentService.search_content_on_chat` now requires you pass in a `chat_id` for the specific chat instance
|
117
120
|
|
118
121
|
## [0.6.9] - 2025-03-11
|
119
122
|
- Add o1-preview as part of the language model info, make the name consistent across board.
|
@@ -22,7 +22,7 @@ unique_toolkit/content/__init__.py,sha256=EdJg_A_7loEtCQf4cah3QARQreJx6pdz89Rm96
|
|
22
22
|
unique_toolkit/content/constants.py,sha256=1iy4Y67xobl5VTnJB6SxSyuoBWbdLl9244xfVMUZi5o,60
|
23
23
|
unique_toolkit/content/functions.py,sha256=iuclQjuiupIJPk0-6ldl35EVkQ2h34_dxKxWisMrxWM,17001
|
24
24
|
unique_toolkit/content/schemas.py,sha256=zks_Pkki2VhxICJJgHZyc-LPmRuj5dLbw3pgcUT7SW8,2362
|
25
|
-
unique_toolkit/content/service.py,sha256=
|
25
|
+
unique_toolkit/content/service.py,sha256=jnXUtQ9ax8tS52lrUIOzMypYCJiRZ56XeIz87hIMur4,14988
|
26
26
|
unique_toolkit/content/utils.py,sha256=GUVPrkZfMoAj4MRoBs5BD_7vSuLZTZx69hyWzYFrI50,7747
|
27
27
|
unique_toolkit/embedding/__init__.py,sha256=uUyzjonPvuDCYsvXCIt7ErQXopLggpzX-MEQd3_e2kE,250
|
28
28
|
unique_toolkit/embedding/constants.py,sha256=Lj8-Lcy1FvuC31PM9Exq7vaFuxQV4pEI1huUMFX-J2M,52
|
@@ -58,7 +58,7 @@ unique_toolkit/short_term_memory/constants.py,sha256=698CL6-wjup2MvU19RxSmQk3gX7
|
|
58
58
|
unique_toolkit/short_term_memory/functions.py,sha256=3WiK-xatY5nh4Dr5zlDUye1k3E6kr41RiscwtTplw5k,4484
|
59
59
|
unique_toolkit/short_term_memory/schemas.py,sha256=OhfcXyF6ACdwIXW45sKzjtZX_gkcJs8FEZXcgQTNenw,1406
|
60
60
|
unique_toolkit/short_term_memory/service.py,sha256=0wrwuo6K17Edcuiwp5LMCvxFuBSDP82HF0_5qwi0nYc,5307
|
61
|
-
unique_toolkit-0.7.
|
62
|
-
unique_toolkit-0.7.
|
63
|
-
unique_toolkit-0.7.
|
64
|
-
unique_toolkit-0.7.
|
61
|
+
unique_toolkit-0.7.1.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
|
62
|
+
unique_toolkit-0.7.1.dist-info/METADATA,sha256=vEkFTjpS9QGRvfgIHvRt80Fxyi49Fh127CFKlmXjIqs,20756
|
63
|
+
unique_toolkit-0.7.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
64
|
+
unique_toolkit-0.7.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|