unique_toolkit 0.7.8__tar.gz → 0.7.10__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.
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/CHANGELOG.md +6 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/PKG-INFO +7 -1
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/pyproject.toml +1 -1
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/chat/service.py +277 -95
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/content/service.py +142 -38
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/embedding/service.py +60 -8
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/language_model/infos.py +19 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/language_model/service.py +114 -10
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/short_term_memory/service.py +136 -32
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/LICENSE +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/README.md +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/__init__.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/_common/_base_service.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/_common/_time_utils.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/_common/exception.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/_common/validate_required_values.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/_common/validators.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/app/__init__.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/app/init_logging.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/app/init_sdk.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/app/performance/async_tasks.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/app/performance/async_wrapper.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/app/schemas.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/app/verification.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/chat/__init__.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/chat/constants.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/chat/functions.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/chat/schemas.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/chat/state.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/chat/utils.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/content/__init__.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/content/constants.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/content/functions.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/content/schemas.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/content/utils.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/embedding/__init__.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/embedding/constants.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/embedding/functions.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/embedding/schemas.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/embedding/utils.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/__init__.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/config.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/constants.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/context_relevancy/constants.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/context_relevancy/prompts.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/context_relevancy/service.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/context_relevancy/utils.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/exception.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/hallucination/constants.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/hallucination/prompts.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/hallucination/service.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/hallucination/utils.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/output_parser.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/evaluators/schemas.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/language_model/__init__.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/language_model/builder.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/language_model/constants.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/language_model/functions.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/language_model/prompt.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/language_model/schemas.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/language_model/utils.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/short_term_memory/__init__.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/short_term_memory/constants.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/short_term_memory/functions.py +0 -0
- {unique_toolkit-0.7.8 → unique_toolkit-0.7.10}/unique_toolkit/short_term_memory/schemas.py +0 -0
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [0.7.10] - 2025-04-22
|
9
|
+
- Deprecate internal variables of services
|
10
|
+
|
11
|
+
## [0.7.9] - 2025-04-17
|
12
|
+
- add `AZURE_GPT_41_2025_0414` as part of the models
|
13
|
+
|
8
14
|
## [0.7.8] - 2025-04-08
|
9
15
|
- add `AZURE_GPT_4o_2024_1120` as part of the models
|
10
16
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unique_toolkit
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.10
|
4
4
|
Summary:
|
5
5
|
License: Proprietary
|
6
6
|
Author: Martin Fadler
|
@@ -111,6 +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.10] - 2025-04-22
|
115
|
+
- Deprecate internal variables of services
|
116
|
+
|
117
|
+
## [0.7.9] - 2025-04-17
|
118
|
+
- add `AZURE_GPT_41_2025_0414` as part of the models
|
119
|
+
|
114
120
|
## [0.7.8] - 2025-04-08
|
115
121
|
- add `AZURE_GPT_4o_2024_1120` as part of the models
|
116
122
|
|
@@ -69,13 +69,13 @@ class ChatService:
|
|
69
69
|
|
70
70
|
def __init__(self, event: ChatEvent | Event):
|
71
71
|
self._event = event
|
72
|
-
self.
|
73
|
-
self.
|
74
|
-
self.
|
75
|
-
self.
|
76
|
-
self.
|
77
|
-
self.
|
78
|
-
self.
|
72
|
+
self._company_id = event.company_id
|
73
|
+
self._user_id = event.user_id
|
74
|
+
self._assistant_message_id = event.payload.assistant_message.id
|
75
|
+
self._user_message_id = event.payload.user_message.id
|
76
|
+
self._chat_id = event.payload.chat_id
|
77
|
+
self._assistant_id = event.payload.assistant_id
|
78
|
+
self._user_message_text = event.payload.user_message.text
|
79
79
|
|
80
80
|
@property
|
81
81
|
@deprecated(
|
@@ -90,6 +90,188 @@ class ChatService:
|
|
90
90
|
"""
|
91
91
|
return self._event
|
92
92
|
|
93
|
+
@property
|
94
|
+
@deprecated(
|
95
|
+
"The company_id property is deprecated and will be removed in a future version."
|
96
|
+
)
|
97
|
+
def company_id(self) -> str | None:
|
98
|
+
"""
|
99
|
+
Get the company identifier (deprecated).
|
100
|
+
|
101
|
+
Returns:
|
102
|
+
str | None: The company identifier.
|
103
|
+
"""
|
104
|
+
return self._company_id
|
105
|
+
|
106
|
+
@company_id.setter
|
107
|
+
@deprecated(
|
108
|
+
"The company_id setter is deprecated and will be removed in a future version."
|
109
|
+
)
|
110
|
+
def company_id(self, value: str | None) -> None:
|
111
|
+
"""
|
112
|
+
Set the company identifier (deprecated).
|
113
|
+
|
114
|
+
Args:
|
115
|
+
value (str | None): The company identifier.
|
116
|
+
"""
|
117
|
+
self._company_id = value
|
118
|
+
|
119
|
+
@property
|
120
|
+
@deprecated(
|
121
|
+
"The user_id property is deprecated and will be removed in a future version."
|
122
|
+
)
|
123
|
+
def user_id(self) -> str | None:
|
124
|
+
"""
|
125
|
+
Get the user identifier (deprecated).
|
126
|
+
|
127
|
+
Returns:
|
128
|
+
str | None: The user identifier.
|
129
|
+
"""
|
130
|
+
return self._user_id
|
131
|
+
|
132
|
+
@user_id.setter
|
133
|
+
@deprecated(
|
134
|
+
"The user_id setter is deprecated and will be removed in a future version."
|
135
|
+
)
|
136
|
+
def user_id(self, value: str | None) -> None:
|
137
|
+
"""
|
138
|
+
Set the user identifier (deprecated).
|
139
|
+
|
140
|
+
Args:
|
141
|
+
value (str | None): The user identifier.
|
142
|
+
"""
|
143
|
+
self._user_id = value
|
144
|
+
|
145
|
+
@property
|
146
|
+
@deprecated(
|
147
|
+
"The assistant_message_id property is deprecated and will be removed in a future version."
|
148
|
+
)
|
149
|
+
def assistant_message_id(self) -> str | None:
|
150
|
+
"""
|
151
|
+
Get the assistant message identifier (deprecated).
|
152
|
+
|
153
|
+
Returns:
|
154
|
+
str | None: The assistant message identifier.
|
155
|
+
"""
|
156
|
+
return self._assistant_message_id
|
157
|
+
|
158
|
+
@assistant_message_id.setter
|
159
|
+
@deprecated(
|
160
|
+
"The assistant_message_id setter is deprecated and will be removed in a future version."
|
161
|
+
)
|
162
|
+
def assistant_message_id(self, value: str | None) -> None:
|
163
|
+
"""
|
164
|
+
Set the assistant message identifier (deprecated).
|
165
|
+
|
166
|
+
Args:
|
167
|
+
value (str | None): The assistant message identifier.
|
168
|
+
"""
|
169
|
+
self._assistant_message_id = value
|
170
|
+
|
171
|
+
@property
|
172
|
+
@deprecated(
|
173
|
+
"The user_message_id property is deprecated and will be removed in a future version."
|
174
|
+
)
|
175
|
+
def user_message_id(self) -> str | None:
|
176
|
+
"""
|
177
|
+
Get the user message identifier (deprecated).
|
178
|
+
|
179
|
+
Returns:
|
180
|
+
str | None: The user message identifier.
|
181
|
+
"""
|
182
|
+
return self._user_message_id
|
183
|
+
|
184
|
+
@user_message_id.setter
|
185
|
+
@deprecated(
|
186
|
+
"The user_message_id setter is deprecated and will be removed in a future version."
|
187
|
+
)
|
188
|
+
def user_message_id(self, value: str | None) -> None:
|
189
|
+
"""
|
190
|
+
Set the user message identifier (deprecated).
|
191
|
+
|
192
|
+
Args:
|
193
|
+
value (str | None): The user message identifier.
|
194
|
+
"""
|
195
|
+
self._user_message_id = value
|
196
|
+
|
197
|
+
@property
|
198
|
+
@deprecated(
|
199
|
+
"The chat_id property is deprecated and will be removed in a future version."
|
200
|
+
)
|
201
|
+
def chat_id(self) -> str | None:
|
202
|
+
"""
|
203
|
+
Get the chat identifier (deprecated).
|
204
|
+
|
205
|
+
Returns:
|
206
|
+
str | None: The chat identifier.
|
207
|
+
"""
|
208
|
+
return self._chat_id
|
209
|
+
|
210
|
+
@chat_id.setter
|
211
|
+
@deprecated(
|
212
|
+
"The chat_id setter is deprecated and will be removed in a future version."
|
213
|
+
)
|
214
|
+
def chat_id(self, value: str | None) -> None:
|
215
|
+
"""
|
216
|
+
Set the chat identifier (deprecated).
|
217
|
+
|
218
|
+
Args:
|
219
|
+
value (str | None): The chat identifier.
|
220
|
+
"""
|
221
|
+
self._chat_id = value
|
222
|
+
|
223
|
+
@property
|
224
|
+
@deprecated(
|
225
|
+
"The assistant_id property is deprecated and will be removed in a future version."
|
226
|
+
)
|
227
|
+
def assistant_id(self) -> str | None:
|
228
|
+
"""
|
229
|
+
Get the assistant identifier (deprecated).
|
230
|
+
|
231
|
+
Returns:
|
232
|
+
str | None: The assistant identifier.
|
233
|
+
"""
|
234
|
+
return self._assistant_id
|
235
|
+
|
236
|
+
@assistant_id.setter
|
237
|
+
@deprecated(
|
238
|
+
"The assistant_id setter is deprecated and will be removed in a future version."
|
239
|
+
)
|
240
|
+
def assistant_id(self, value: str | None) -> None:
|
241
|
+
"""
|
242
|
+
Set the assistant identifier (deprecated).
|
243
|
+
|
244
|
+
Args:
|
245
|
+
value (str | None): The assistant identifier.
|
246
|
+
"""
|
247
|
+
self._assistant_id = value
|
248
|
+
|
249
|
+
@property
|
250
|
+
@deprecated(
|
251
|
+
"The user_message_text property is deprecated and will be removed in a future version."
|
252
|
+
)
|
253
|
+
def user_message_text(self) -> str | None:
|
254
|
+
"""
|
255
|
+
Get the user message text (deprecated).
|
256
|
+
|
257
|
+
Returns:
|
258
|
+
str | None: The user message text.
|
259
|
+
"""
|
260
|
+
return self._user_message_text
|
261
|
+
|
262
|
+
@user_message_text.setter
|
263
|
+
@deprecated(
|
264
|
+
"The user_message_text setter is deprecated and will be removed in a future version."
|
265
|
+
)
|
266
|
+
def user_message_text(self, value: str | None) -> None:
|
267
|
+
"""
|
268
|
+
Set the user message text (deprecated).
|
269
|
+
|
270
|
+
Args:
|
271
|
+
value (str | None): The user message text.
|
272
|
+
"""
|
273
|
+
self._user_message_text = value
|
274
|
+
|
93
275
|
async def update_debug_info_async(self, debug_info: dict):
|
94
276
|
"""
|
95
277
|
Updates the debug information for the chat session.
|
@@ -99,12 +281,12 @@ class ChatService:
|
|
99
281
|
"""
|
100
282
|
|
101
283
|
return await modify_message_async(
|
102
|
-
user_id=self.
|
103
|
-
company_id=self.
|
104
|
-
assistant_message_id=self.
|
105
|
-
chat_id=self.
|
106
|
-
user_message_id=self.
|
107
|
-
user_message_text=self.
|
284
|
+
user_id=self._user_id,
|
285
|
+
company_id=self._company_id,
|
286
|
+
assistant_message_id=self._assistant_message_id,
|
287
|
+
chat_id=self._chat_id,
|
288
|
+
user_message_id=self._user_message_id,
|
289
|
+
user_message_text=self._user_message_text,
|
108
290
|
assistant=False,
|
109
291
|
debug_info=debug_info,
|
110
292
|
)
|
@@ -118,12 +300,12 @@ class ChatService:
|
|
118
300
|
"""
|
119
301
|
|
120
302
|
return modify_message(
|
121
|
-
user_id=self.
|
122
|
-
company_id=self.
|
123
|
-
assistant_message_id=self.
|
124
|
-
chat_id=self.
|
125
|
-
user_message_id=self.
|
126
|
-
user_message_text=self.
|
303
|
+
user_id=self._user_id,
|
304
|
+
company_id=self._company_id,
|
305
|
+
assistant_message_id=self._assistant_message_id,
|
306
|
+
chat_id=self._chat_id,
|
307
|
+
user_message_id=self._user_message_id,
|
308
|
+
user_message_text=self._user_message_text,
|
127
309
|
assistant=False,
|
128
310
|
debug_info=debug_info,
|
129
311
|
)
|
@@ -153,12 +335,12 @@ class ChatService:
|
|
153
335
|
Exception: If the modification fails.
|
154
336
|
"""
|
155
337
|
return modify_message(
|
156
|
-
user_id=self.
|
157
|
-
company_id=self.
|
158
|
-
assistant_message_id=self.
|
159
|
-
chat_id=self.
|
160
|
-
user_message_id=self.
|
161
|
-
user_message_text=self.
|
338
|
+
user_id=self._user_id,
|
339
|
+
company_id=self._company_id,
|
340
|
+
assistant_message_id=self._assistant_message_id,
|
341
|
+
chat_id=self._chat_id,
|
342
|
+
user_message_id=self._user_message_id,
|
343
|
+
user_message_text=self._user_message_text,
|
162
344
|
assistant=False,
|
163
345
|
content=content,
|
164
346
|
references=references,
|
@@ -192,12 +374,12 @@ class ChatService:
|
|
192
374
|
Exception: If the modification fails.
|
193
375
|
"""
|
194
376
|
return await modify_message_async(
|
195
|
-
user_id=self.
|
196
|
-
company_id=self.
|
197
|
-
assistant_message_id=self.
|
198
|
-
chat_id=self.
|
199
|
-
user_message_id=self.
|
200
|
-
user_message_text=self.
|
377
|
+
user_id=self._user_id,
|
378
|
+
company_id=self._company_id,
|
379
|
+
assistant_message_id=self._assistant_message_id,
|
380
|
+
chat_id=self._chat_id,
|
381
|
+
user_message_id=self._user_message_id,
|
382
|
+
user_message_text=self._user_message_text,
|
201
383
|
assistant=False,
|
202
384
|
content=content,
|
203
385
|
references=references,
|
@@ -233,12 +415,12 @@ class ChatService:
|
|
233
415
|
Exception: If the modification fails.
|
234
416
|
"""
|
235
417
|
return modify_message(
|
236
|
-
user_id=self.
|
237
|
-
company_id=self.
|
238
|
-
assistant_message_id=self.
|
239
|
-
chat_id=self.
|
240
|
-
user_message_id=self.
|
241
|
-
user_message_text=self.
|
418
|
+
user_id=self._user_id,
|
419
|
+
company_id=self._company_id,
|
420
|
+
assistant_message_id=self._assistant_message_id,
|
421
|
+
chat_id=self._chat_id,
|
422
|
+
user_message_id=self._user_message_id,
|
423
|
+
user_message_text=self._user_message_text,
|
242
424
|
assistant=True,
|
243
425
|
content=content,
|
244
426
|
original_content=original_content,
|
@@ -276,12 +458,12 @@ class ChatService:
|
|
276
458
|
"""
|
277
459
|
|
278
460
|
return await modify_message_async(
|
279
|
-
user_id=self.
|
280
|
-
company_id=self.
|
281
|
-
assistant_message_id=self.
|
282
|
-
chat_id=self.
|
283
|
-
user_message_id=self.
|
284
|
-
user_message_text=self.
|
461
|
+
user_id=self._user_id,
|
462
|
+
company_id=self._company_id,
|
463
|
+
assistant_message_id=self._assistant_message_id,
|
464
|
+
chat_id=self._chat_id,
|
465
|
+
user_message_id=self._user_message_id,
|
466
|
+
user_message_text=self._user_message_text,
|
285
467
|
assistant=True,
|
286
468
|
content=content,
|
287
469
|
original_content=original_content,
|
@@ -302,9 +484,9 @@ class ChatService:
|
|
302
484
|
Exception: If the loading fails.
|
303
485
|
"""
|
304
486
|
return get_full_history(
|
305
|
-
event_user_id=self.
|
306
|
-
event_company_id=self.
|
307
|
-
event_payload_chat_id=self.
|
487
|
+
event_user_id=self._user_id,
|
488
|
+
event_company_id=self._company_id,
|
489
|
+
event_payload_chat_id=self._chat_id,
|
308
490
|
)
|
309
491
|
|
310
492
|
async def get_full_history_async(self) -> list[ChatMessage]:
|
@@ -318,9 +500,9 @@ class ChatService:
|
|
318
500
|
Exception: If the loading fails.
|
319
501
|
"""
|
320
502
|
return await get_full_history_async(
|
321
|
-
event_user_id=self.
|
322
|
-
event_company_id=self.
|
323
|
-
event_payload_chat_id=self.
|
503
|
+
event_user_id=self._user_id,
|
504
|
+
event_company_id=self._company_id,
|
505
|
+
event_payload_chat_id=self._chat_id,
|
324
506
|
)
|
325
507
|
|
326
508
|
def get_full_and_selected_history(
|
@@ -344,9 +526,9 @@ class ChatService:
|
|
344
526
|
Exception: If the loading fails.
|
345
527
|
"""
|
346
528
|
full_history = get_full_history(
|
347
|
-
event_user_id=self.
|
348
|
-
event_company_id=self.
|
349
|
-
event_payload_chat_id=self.
|
529
|
+
event_user_id=self._user_id,
|
530
|
+
event_company_id=self._company_id,
|
531
|
+
event_payload_chat_id=self._chat_id,
|
350
532
|
)
|
351
533
|
selected_history = get_selection_from_history(
|
352
534
|
full_history=full_history,
|
@@ -377,9 +559,9 @@ class ChatService:
|
|
377
559
|
Exception: If the loading fails.
|
378
560
|
"""
|
379
561
|
full_history = await get_full_history_async(
|
380
|
-
event_user_id=self.
|
381
|
-
event_company_id=self.
|
382
|
-
event_payload_chat_id=self.
|
562
|
+
event_user_id=self._user_id,
|
563
|
+
event_company_id=self._company_id,
|
564
|
+
event_payload_chat_id=self._chat_id,
|
383
565
|
)
|
384
566
|
selected_history = get_selection_from_history(
|
385
567
|
full_history=full_history,
|
@@ -414,10 +596,10 @@ class ChatService:
|
|
414
596
|
Exception: If the creation fails.
|
415
597
|
"""
|
416
598
|
chat_message = create_message(
|
417
|
-
user_id=self.
|
418
|
-
company_id=self.
|
419
|
-
chat_id=self.
|
420
|
-
assistant_id=self.
|
599
|
+
user_id=self._user_id,
|
600
|
+
company_id=self._company_id,
|
601
|
+
chat_id=self._chat_id,
|
602
|
+
assistant_id=self._assistant_id,
|
421
603
|
role=ChatMessageRole.ASSISTANT,
|
422
604
|
content=content,
|
423
605
|
original_content=original_content,
|
@@ -426,7 +608,7 @@ class ChatService:
|
|
426
608
|
set_completed_at=set_completed_at,
|
427
609
|
)
|
428
610
|
# Update the assistant message id
|
429
|
-
self.
|
611
|
+
self._assistant_message_id = chat_message.id
|
430
612
|
return chat_message
|
431
613
|
|
432
614
|
async def create_assistant_message_async(
|
@@ -455,10 +637,10 @@ class ChatService:
|
|
455
637
|
"""
|
456
638
|
|
457
639
|
chat_message = await create_message_async(
|
458
|
-
user_id=self.
|
459
|
-
company_id=self.
|
460
|
-
chat_id=self.
|
461
|
-
assistant_id=self.
|
640
|
+
user_id=self._user_id,
|
641
|
+
company_id=self._company_id,
|
642
|
+
chat_id=self._chat_id,
|
643
|
+
assistant_id=self._assistant_id,
|
462
644
|
role=ChatMessageRole.ASSISTANT,
|
463
645
|
content=content,
|
464
646
|
original_content=original_content,
|
@@ -467,7 +649,7 @@ class ChatService:
|
|
467
649
|
set_completed_at=set_completed_at,
|
468
650
|
)
|
469
651
|
# Update the assistant message id
|
470
|
-
self.
|
652
|
+
self._assistant_message_id = chat_message.id
|
471
653
|
return chat_message
|
472
654
|
|
473
655
|
def create_user_message(
|
@@ -495,10 +677,10 @@ class ChatService:
|
|
495
677
|
Exception: If the creation fails.
|
496
678
|
"""
|
497
679
|
chat_message = create_message(
|
498
|
-
user_id=self.
|
499
|
-
company_id=self.
|
500
|
-
chat_id=self.
|
501
|
-
assistant_id=self.
|
680
|
+
user_id=self._user_id,
|
681
|
+
company_id=self._company_id,
|
682
|
+
chat_id=self._chat_id,
|
683
|
+
assistant_id=self._assistant_id,
|
502
684
|
role=ChatMessageRole.USER,
|
503
685
|
content=content,
|
504
686
|
original_content=original_content,
|
@@ -507,7 +689,7 @@ class ChatService:
|
|
507
689
|
set_completed_at=set_completed_at,
|
508
690
|
)
|
509
691
|
# Update the user message id
|
510
|
-
self.
|
692
|
+
self._user_message_id = chat_message.id
|
511
693
|
return chat_message
|
512
694
|
|
513
695
|
async def create_user_message_async(
|
@@ -536,10 +718,10 @@ class ChatService:
|
|
536
718
|
"""
|
537
719
|
|
538
720
|
chat_message = await create_message_async(
|
539
|
-
user_id=self.
|
540
|
-
company_id=self.
|
541
|
-
chat_id=self.
|
542
|
-
assistant_id=self.
|
721
|
+
user_id=self._user_id,
|
722
|
+
company_id=self._company_id,
|
723
|
+
chat_id=self._chat_id,
|
724
|
+
assistant_id=self._assistant_id,
|
543
725
|
role=ChatMessageRole.USER,
|
544
726
|
content=content,
|
545
727
|
original_content=original_content,
|
@@ -548,7 +730,7 @@ class ChatService:
|
|
548
730
|
set_completed_at=set_completed_at,
|
549
731
|
)
|
550
732
|
# Update the user message id
|
551
|
-
self.
|
733
|
+
self._user_message_id = chat_message.id
|
552
734
|
return chat_message
|
553
735
|
|
554
736
|
def create_message_assessment(
|
@@ -580,8 +762,8 @@ class ChatService:
|
|
580
762
|
Exception: If the creation fails
|
581
763
|
"""
|
582
764
|
return create_message_assessment(
|
583
|
-
user_id=self.
|
584
|
-
company_id=self.
|
765
|
+
user_id=self._user_id,
|
766
|
+
company_id=self._company_id,
|
585
767
|
assistant_message_id=assistant_message_id,
|
586
768
|
status=status,
|
587
769
|
type=type,
|
@@ -620,8 +802,8 @@ class ChatService:
|
|
620
802
|
Exception: If the creation fails
|
621
803
|
"""
|
622
804
|
return await create_message_assessment_async(
|
623
|
-
user_id=self.
|
624
|
-
company_id=self.
|
805
|
+
user_id=self._user_id,
|
806
|
+
company_id=self._company_id,
|
625
807
|
assistant_message_id=assistant_message_id,
|
626
808
|
status=status,
|
627
809
|
type=type,
|
@@ -658,8 +840,8 @@ class ChatService:
|
|
658
840
|
Exception: If the modification fails
|
659
841
|
"""
|
660
842
|
return modify_message_assessment(
|
661
|
-
user_id=self.
|
662
|
-
company_id=self.
|
843
|
+
user_id=self._user_id,
|
844
|
+
company_id=self._company_id,
|
663
845
|
assistant_message_id=assistant_message_id,
|
664
846
|
status=status,
|
665
847
|
type=type,
|
@@ -695,8 +877,8 @@ class ChatService:
|
|
695
877
|
Exception: If the modification fails
|
696
878
|
"""
|
697
879
|
return await modify_message_assessment_async(
|
698
|
-
user_id=self.
|
699
|
-
company_id=self.
|
880
|
+
user_id=self._user_id,
|
881
|
+
company_id=self._company_id,
|
700
882
|
assistant_message_id=assistant_message_id,
|
701
883
|
status=status,
|
702
884
|
type=type,
|
@@ -729,12 +911,12 @@ class ChatService:
|
|
729
911
|
assistant_id,
|
730
912
|
] = validate_required_values(
|
731
913
|
[
|
732
|
-
self.
|
733
|
-
self.
|
734
|
-
self.
|
735
|
-
self.
|
736
|
-
self.
|
737
|
-
self.
|
914
|
+
self._company_id,
|
915
|
+
self._user_id,
|
916
|
+
self._assistant_message_id,
|
917
|
+
self._user_message_id,
|
918
|
+
self._chat_id,
|
919
|
+
self._assistant_id,
|
738
920
|
]
|
739
921
|
)
|
740
922
|
|
@@ -781,12 +963,12 @@ class ChatService:
|
|
781
963
|
assistant_id,
|
782
964
|
] = validate_required_values(
|
783
965
|
[
|
784
|
-
self.
|
785
|
-
self.
|
786
|
-
self.
|
787
|
-
self.
|
788
|
-
self.
|
789
|
-
self.
|
966
|
+
self._company_id,
|
967
|
+
self._user_id,
|
968
|
+
self._assistant_message_id,
|
969
|
+
self._user_message_id,
|
970
|
+
self._chat_id,
|
971
|
+
self._assistant_id,
|
790
972
|
]
|
791
973
|
)
|
792
974
|
|