unique_toolkit 0.5.11__py3-none-any.whl → 0.5.13__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.
@@ -0,0 +1,5 @@
1
+ from datetime import datetime
2
+
3
+
4
+ def get_datetime_now(format: str = "%Y-%m-%d %H:%M:%S.%f"):
5
+ return datetime.now().strftime(format)
@@ -21,7 +21,9 @@ class EventUserMessage(BaseModel):
21
21
 
22
22
  id: str
23
23
  text: str
24
+ original_text: str
24
25
  created_at: str
26
+ language: str
25
27
 
26
28
 
27
29
  class EventAssistantMessage(BaseModel):
@@ -5,6 +5,7 @@ from typing import Optional
5
5
  import unique_sdk
6
6
  from unique_sdk._list_object import ListObject
7
7
 
8
+ from unique_toolkit._common import _time_utils
8
9
  from unique_toolkit._common._base_service import BaseService
9
10
  from unique_toolkit.app.schemas import Event
10
11
  from unique_toolkit.chat.schemas import ChatMessage, ChatMessageRole
@@ -55,11 +56,12 @@ class ChatService(BaseService):
55
56
  message = unique_sdk.Message.modify(
56
57
  user_id=self.event.user_id,
57
58
  company_id=self.event.company_id,
58
- id=message_id, # type: ignore
59
+ id=message_id,
59
60
  chatId=self.event.payload.chat_id,
60
61
  text=content,
61
- references=self._map_references(references), # type: ignore
62
+ references=self._map_references(references),
62
63
  debugInfo=debug_info or {},
64
+ completedAt=_time_utils.get_datetime_now(), # type: ignore
63
65
  )
64
66
  except Exception as e:
65
67
  self.logger.error(f"Failed to modify assistant message: {e}")
@@ -94,11 +96,12 @@ class ChatService(BaseService):
94
96
  message = await unique_sdk.Message.modify_async(
95
97
  user_id=self.event.user_id,
96
98
  company_id=self.event.company_id,
97
- id=message_id, # type: ignore
99
+ id=message_id,
98
100
  chatId=self.event.payload.chat_id,
99
101
  text=content,
100
- references=self._map_references(references), # type: ignore
102
+ references=self._map_references(references),
101
103
  debugInfo=debug_info or {},
104
+ completedAt=_time_utils.get_datetime_now(), # type: ignore
102
105
  )
103
106
  except Exception as e:
104
107
  self.logger.error(f"Failed to modify assistant message: {e}")
@@ -1,6 +1,6 @@
1
1
  import json
2
2
  from enum import StrEnum
3
- from typing import Any, Optional
3
+ from typing import Any, Optional, Self
4
4
 
5
5
  from humps import camelize
6
6
  from pydantic import BaseModel, ConfigDict, RootModel, field_validator, model_validator
@@ -154,6 +154,7 @@ class LanguageModelToolParameterProperty(BaseModel):
154
154
  type: str
155
155
  description: str
156
156
  enum: Optional[list[Any]] = None
157
+ items: Optional[Self] = None
157
158
 
158
159
 
159
160
  class LanguageModelToolParameters(BaseModel):
@@ -166,3 +167,6 @@ class LanguageModelTool(BaseModel):
166
167
  name: str
167
168
  description: str
168
169
  parameters: LanguageModelToolParameters
170
+ returns: LanguageModelToolParameterProperty | LanguageModelToolParameters | None = (
171
+ None
172
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 0.5.11
3
+ Version: 0.5.13
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.12
13
13
  Requires-Dist: numpy (>=1.26.4,<2.0.0)
14
14
  Requires-Dist: pydantic (>=2.8.2,<3.0.0)
15
15
  Requires-Dist: pyhumps (>=3.8.0,<4.0.0)
16
+ Requires-Dist: pytest-mock (>=3.14.0,<4.0.0)
16
17
  Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
17
18
  Requires-Dist: regex (>=2024.5.15,<2025.0.0)
18
19
  Requires-Dist: tiktoken (>=0.7.0,<0.8.0)
@@ -100,6 +101,15 @@ All notable changes to this project will be documented in this file.
100
101
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
101
102
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
102
103
 
104
+ ## [0.5.13] - 2024-08-19
105
+ - Added `items` to `LanguageModelToolParameterProperty` schema to add support for parameters with list types.
106
+ - Added `returns` to `LanguageModelTool` schema to describe the return types of tool calls.
107
+
108
+
109
+ ## [0.5.12] - 2024-08-7
110
+ - added `completedAt` datetime to `unique_sdk.Message.modify` and `unique_sdk.Message.modify_async`
111
+ - added `original_text` and `language` to `EventUserMessage`
112
+
103
113
  ## [0.5.11] - 2024-08-6
104
114
  - made all domain specific functions and classes directly importable from `unique_toolkit.[DOMAIN_NAME]`
105
115
  - renamed `RerankerConfig` to `ContentRerankerConfig`
@@ -1,15 +1,16 @@
1
1
  unique_toolkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  unique_toolkit/_common/_base_service.py,sha256=S8H0rAebx7GsOldA7xInLp3aQJt9yEPDQdsGSFRJsGg,276
3
+ unique_toolkit/_common/_time_utils.py,sha256=ztmTovTvr-3w71Ns2VwXC65OKUUh-sQlzbHdKTQWm-w,135
3
4
  unique_toolkit/app/__init__.py,sha256=sZyGrz74jBlAjv6OcHgcp6VtP6-AKKpaVYjakr1Xk60,735
4
5
  unique_toolkit/app/init_logging.py,sha256=Sh26SRxOj8i8dzobKhYha2lLrkrMTHfB1V4jR3h23gQ,678
5
6
  unique_toolkit/app/init_sdk.py,sha256=Nv4Now4pMfM0AgRhbtatLpm_39rKxn0WmRLwmPhRl-8,1285
6
7
  unique_toolkit/app/performance/async_tasks.py,sha256=H0l3OAcosLwNHZ8d2pd-Di4wHIXfclEvagi5kfqLFPA,1941
7
8
  unique_toolkit/app/performance/async_wrapper.py,sha256=yVVcRDkcdyfjsxro-N29SBvi-7773wnfDplef6-y8xw,1077
8
- unique_toolkit/app/schemas.py,sha256=oNZBLyzQR4jRAIXtrcfJ3N0euoLuTVLTPL6wFhIKLRA,1323
9
+ unique_toolkit/app/schemas.py,sha256=_PIROOUtdKvZFZdvkCORhj-MVWvfkopIQW7VIFmguRg,1364
9
10
  unique_toolkit/app/verification.py,sha256=UZqTHg3PX_QxMjeLH_BVBYoMVqMnMpeMoqvyTBKDqj8,1996
10
11
  unique_toolkit/chat/__init__.py,sha256=1prdTVfLOf6NgU-Aa1VIO-XiR6OYuRm51LaVRfKDCqc,267
11
12
  unique_toolkit/chat/schemas.py,sha256=ff4M-XMagF0Evn3FcKHHP5xzDEyufZgq9Dmit3i8r_E,802
12
- unique_toolkit/chat/service.py,sha256=gIj5tNkwveQ3Rv9-B83Hw1lZRx2mYEmK7megI5paJNc,13409
13
+ unique_toolkit/chat/service.py,sha256=mjzj0GCpIbGMX_k1aei8BY-132DCPv53FI7TqbXfaKk,13544
13
14
  unique_toolkit/chat/state.py,sha256=Cjgwv_2vhDFbV69xxsn7SefhaoIAEqLx3ferdVFCnOg,1445
14
15
  unique_toolkit/chat/utils.py,sha256=ihm-wQykBWhB4liR3LnwPVPt_qGW6ETq21Mw4HY0THE,854
15
16
  unique_toolkit/content/__init__.py,sha256=MSH2sxjQyKD2Sef92fzE5Dt9SihdzivB6yliSwJfTmQ,890
@@ -22,10 +23,10 @@ unique_toolkit/embedding/service.py,sha256=Iiw-sbdkjuWlWMfLM9qyC4GNTJOotQAaVjkYv
22
23
  unique_toolkit/embedding/utils.py,sha256=v86lo__bCJbxZBQ3OcLu5SuwT6NbFfWlcq8iyk6BuzQ,279
23
24
  unique_toolkit/language_model/__init__.py,sha256=QgU_uwpVh1URQyVs6l-6Am4UwmEEhuGXNic3dUZ0FCc,1701
24
25
  unique_toolkit/language_model/infos.py,sha256=W74PiBkAIEdTdgygdVoq_EWlziVOOfhSuETq4dKX7LM,8934
25
- unique_toolkit/language_model/schemas.py,sha256=6PySftHNX1e00ncieRn4h35T4VneOO8j-mfpkC8Cvk8,4447
26
+ unique_toolkit/language_model/schemas.py,sha256=h5zjZNk7O-wLKtRuiNtMCIbp5hEVXrAOviKonQcjFuI,4594
26
27
  unique_toolkit/language_model/service.py,sha256=JjsOOcGDcR7db3yF3_oDXclEGfxqmwWpL5jor7Q42cU,10470
27
28
  unique_toolkit/language_model/utils.py,sha256=WBPj1XKkDgxy_-T8HCZvsfkkSzj_1w4UZzNmyvdbBLY,1081
28
- unique_toolkit-0.5.11.dist-info/LICENSE,sha256=bIeCWCYuoUU_MzNdg48-ubJSVm7qxakaRbzTiJ5uxrs,1065
29
- unique_toolkit-0.5.11.dist-info/METADATA,sha256=NlvoVokeI_H7krp1oJVXHs6IJmMrkI2pHoLBWPNmuCo,9581
30
- unique_toolkit-0.5.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
31
- unique_toolkit-0.5.11.dist-info/RECORD,,
29
+ unique_toolkit-0.5.13.dist-info/LICENSE,sha256=bIeCWCYuoUU_MzNdg48-ubJSVm7qxakaRbzTiJ5uxrs,1065
30
+ unique_toolkit-0.5.13.dist-info/METADATA,sha256=7SZ9_BbfL1M0Esja2QmEpsKvyx9Bva04cmgGeRkFaSw,10041
31
+ unique_toolkit-0.5.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
+ unique_toolkit-0.5.13.dist-info/RECORD,,