unique_toolkit 0.5.53__py3-none-any.whl → 0.5.55__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/chat/schemas.py +10 -4
- unique_toolkit/content/service.py +15 -0
- {unique_toolkit-0.5.53.dist-info → unique_toolkit-0.5.55.dist-info}/METADATA +7 -1
- {unique_toolkit-0.5.53.dist-info → unique_toolkit-0.5.55.dist-info}/RECORD +6 -6
- {unique_toolkit-0.5.53.dist-info → unique_toolkit-0.5.55.dist-info}/LICENSE +0 -0
- {unique_toolkit-0.5.53.dist-info → unique_toolkit-0.5.55.dist-info}/WHEEL +0 -0
unique_toolkit/chat/schemas.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
from datetime import datetime
|
2
2
|
from enum import StrEnum
|
3
|
-
from typing import Optional
|
4
3
|
|
5
4
|
from humps import camelize
|
6
5
|
from pydantic import (
|
@@ -39,15 +38,22 @@ class ToolCall(BaseModel):
|
|
39
38
|
|
40
39
|
|
41
40
|
class ChatMessage(BaseModel):
|
41
|
+
# This model should strictly meets https://github.com/Unique-AG/monorepo/blob/master/node/apps/node-chat/src/public-api/2023-12-06/dtos/message/public-message.dto.ts
|
42
42
|
model_config = model_config
|
43
43
|
|
44
44
|
id: str | None = None
|
45
|
+
chat_id: str
|
45
46
|
object: str | None = None
|
46
|
-
content: str = Field(alias="text")
|
47
|
+
content: str | None = Field(default=None, alias="text")
|
48
|
+
original_content: str | None = Field(default=None, alias="originalText")
|
47
49
|
role: ChatMessageRole
|
48
|
-
|
49
|
-
|
50
|
+
gpt_request: list[dict] | None = None
|
51
|
+
tool_calls: list[ToolCall] | None = None
|
52
|
+
tool_call_id: str | None = None
|
50
53
|
debug_info: dict | None = {}
|
54
|
+
created_at: datetime | None = None
|
55
|
+
completed_at: datetime | None = None
|
56
|
+
updated_at: datetime | None = None
|
51
57
|
|
52
58
|
# TODO make sdk return role consistently in lowercase
|
53
59
|
# Currently needed as sdk returns role in uppercase
|
@@ -64,6 +64,9 @@ class ContentService(BaseService):
|
|
64
64
|
if not scope_ids:
|
65
65
|
self.logger.warning("No scope IDs provided for search.")
|
66
66
|
|
67
|
+
if content_ids:
|
68
|
+
self.logger.info("Searching chunks for content IDs: %s", content_ids)
|
69
|
+
|
67
70
|
if metadata_filter is None:
|
68
71
|
metadata_filter = self.metadata_filter
|
69
72
|
|
@@ -128,6 +131,9 @@ class ContentService(BaseService):
|
|
128
131
|
if not scope_ids:
|
129
132
|
self.logger.warning("No scope IDs provided for search.")
|
130
133
|
|
134
|
+
if content_ids:
|
135
|
+
self.logger.info("Searching chunks for content IDs: %s", content_ids)
|
136
|
+
|
131
137
|
if metadata_filter is None:
|
132
138
|
metadata_filter = self.metadata_filter
|
133
139
|
|
@@ -175,6 +181,9 @@ class ContentService(BaseService):
|
|
175
181
|
Returns:
|
176
182
|
list[Content]: The search results.
|
177
183
|
"""
|
184
|
+
if where.get("contentId"):
|
185
|
+
self.logger.info("Searching content for content ID: %s", where["contentId"])
|
186
|
+
|
178
187
|
try:
|
179
188
|
contents = unique_sdk.Content.search(
|
180
189
|
user_id=self.event.user_id,
|
@@ -202,6 +211,9 @@ class ContentService(BaseService):
|
|
202
211
|
Returns:
|
203
212
|
list[Content]: The search results.
|
204
213
|
"""
|
214
|
+
if where.get("contentId"):
|
215
|
+
self.logger.info("Searching content for content ID: %s", where["contentId"])
|
216
|
+
|
205
217
|
try:
|
206
218
|
contents = await unique_sdk.Content.search_async(
|
207
219
|
user_id=self.event.user_id,
|
@@ -376,6 +388,7 @@ class ContentService(BaseService):
|
|
376
388
|
requests.Response: The response object containing the downloaded content.
|
377
389
|
|
378
390
|
"""
|
391
|
+
self.logger.info("Requesting content by ID: %s", content_id)
|
379
392
|
url = f"{unique_sdk.api_base}/content/{content_id}/file"
|
380
393
|
if chat_id:
|
381
394
|
url = f"{url}?chatId={chat_id}"
|
@@ -414,6 +427,7 @@ class ContentService(BaseService):
|
|
414
427
|
Exception: If the download fails or the filename cannot be determined.
|
415
428
|
"""
|
416
429
|
|
430
|
+
self.logger.info("Requesting content by ID: %s", content_id)
|
417
431
|
response = self.request_content_by_id(content_id, chat_id)
|
418
432
|
random_dir = tempfile.mkdtemp(dir=tmp_dir_path)
|
419
433
|
|
@@ -467,6 +481,7 @@ class ContentService(BaseService):
|
|
467
481
|
Exception: If the download fails.
|
468
482
|
"""
|
469
483
|
|
484
|
+
self.logger.info("Downloading content by ID: %s", content_id)
|
470
485
|
response = self.request_content_by_id(content_id, chat_id)
|
471
486
|
|
472
487
|
random_dir = tempfile.mkdtemp(dir=dir_path)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unique_toolkit
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.55
|
4
4
|
Summary:
|
5
5
|
License: Proprietary
|
6
6
|
Author: Martin Fadler
|
@@ -100,6 +100,12 @@ All notable changes to this project will be documented in this file.
|
|
100
100
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
101
101
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
102
102
|
|
103
|
+
## [0.5.55] - 2025-02-18
|
104
|
+
- Log `contentId` for better debugging
|
105
|
+
|
106
|
+
## [0.5.54] - 2025-02-10
|
107
|
+
- Add `created_at`, `completed_at`, `updated_at` and `gpt_request` to `ChatMessage` schema.
|
108
|
+
|
103
109
|
## [0.5.53] - 2025-02-01
|
104
110
|
- Correct `MessageAssessment` schemas
|
105
111
|
|
@@ -11,13 +11,13 @@ unique_toolkit/app/performance/async_wrapper.py,sha256=yVVcRDkcdyfjsxro-N29SBvi-
|
|
11
11
|
unique_toolkit/app/schemas.py,sha256=6RY7Ex-B3pOnFILlitHEi9sqJvupbpdxlN9xt33qRsM,1571
|
12
12
|
unique_toolkit/app/verification.py,sha256=mffa6wm0i4hJbwzofePrkaia46xumMzECwQ0T3eKAx0,1929
|
13
13
|
unique_toolkit/chat/__init__.py,sha256=4xS-Mcv7Oqdhprw1JEqD3nwGFflla4R2o7RNJyA5Wek,537
|
14
|
-
unique_toolkit/chat/schemas.py,sha256=
|
14
|
+
unique_toolkit/chat/schemas.py,sha256=PJ9Am-RKxUEo6o1jQ_DV100rt8rZD59GhWTPRgZuDow,2665
|
15
15
|
unique_toolkit/chat/service.py,sha256=9sQbfwgb2GoUuDL3xoG-7P9oOEj-TAssZleXwSZ3HiY,28121
|
16
16
|
unique_toolkit/chat/state.py,sha256=Cjgwv_2vhDFbV69xxsn7SefhaoIAEqLx3ferdVFCnOg,1445
|
17
17
|
unique_toolkit/chat/utils.py,sha256=ihm-wQykBWhB4liR3LnwPVPt_qGW6ETq21Mw4HY0THE,854
|
18
18
|
unique_toolkit/content/__init__.py,sha256=MSH2sxjQyKD2Sef92fzE5Dt9SihdzivB6yliSwJfTmQ,890
|
19
19
|
unique_toolkit/content/schemas.py,sha256=zks_Pkki2VhxICJJgHZyc-LPmRuj5dLbw3pgcUT7SW8,2362
|
20
|
-
unique_toolkit/content/service.py,sha256=
|
20
|
+
unique_toolkit/content/service.py,sha256=83gNLHxLB1hU2XUOpYdTeatpTozPh_GFGBUyUrvrpqQ,18383
|
21
21
|
unique_toolkit/content/utils.py,sha256=Lake671plRsqNvO3pN_rmyVcpwbdED_KQpLcCnc4lv4,6902
|
22
22
|
unique_toolkit/embedding/__init__.py,sha256=dr8M9jvslQTxPpxgaGwzxY0FildiWf-DidN_cahPAWw,191
|
23
23
|
unique_toolkit/embedding/schemas.py,sha256=1GvKCaSk4jixzVQ2PKq8yDqwGEVY_hWclYtoAr6CC2g,96
|
@@ -44,7 +44,7 @@ unique_toolkit/language_model/service.py,sha256=m4B4YD4wxfU8HNo_stqbfnlKXziYBAwq
|
|
44
44
|
unique_toolkit/language_model/utils.py,sha256=bPQ4l6_YO71w-zaIPanUUmtbXC1_hCvLK0tAFc3VCRc,1902
|
45
45
|
unique_toolkit/short_term_memory/schemas.py,sha256=OhfcXyF6ACdwIXW45sKzjtZX_gkcJs8FEZXcgQTNenw,1406
|
46
46
|
unique_toolkit/short_term_memory/service.py,sha256=Jd9P72-VvJy7hnqNrjmrmB5BHmsKuOpTiT0Jr-dBbsQ,1682
|
47
|
-
unique_toolkit-0.5.
|
48
|
-
unique_toolkit-0.5.
|
49
|
-
unique_toolkit-0.5.
|
50
|
-
unique_toolkit-0.5.
|
47
|
+
unique_toolkit-0.5.55.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
|
48
|
+
unique_toolkit-0.5.55.dist-info/METADATA,sha256=UwzR9G0BkKuD7R10nC7Klz8pjkJ-yL8ikJqt7mLKVxI,16540
|
49
|
+
unique_toolkit-0.5.55.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
50
|
+
unique_toolkit-0.5.55.dist-info/RECORD,,
|
File without changes
|
File without changes
|