unique_toolkit 0.6.4__py3-none-any.whl → 0.6.6__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/functions.py +80 -10
- unique_toolkit/content/service.py +63 -0
- unique_toolkit/language_model/infos.py +135 -45
- {unique_toolkit-0.6.4.dist-info → unique_toolkit-0.6.6.dist-info}/METADATA +9 -1
- {unique_toolkit-0.6.4.dist-info → unique_toolkit-0.6.6.dist-info}/RECORD +7 -7
- {unique_toolkit-0.6.4.dist-info → unique_toolkit-0.6.6.dist-info}/LICENSE +0 -0
- {unique_toolkit-0.6.4.dist-info → unique_toolkit-0.6.6.dist-info}/WHEEL +0 -0
@@ -204,6 +204,49 @@ def _upsert_content(
|
|
204
204
|
) # type: ignore
|
205
205
|
|
206
206
|
|
207
|
+
def upload_content_from_bytes(
|
208
|
+
user_id: str,
|
209
|
+
company_id: str,
|
210
|
+
content: bytes,
|
211
|
+
content_name: str,
|
212
|
+
mime_type: str,
|
213
|
+
scope_id: str | None = None,
|
214
|
+
chat_id: str | None = None,
|
215
|
+
skip_ingestion: bool = False,
|
216
|
+
):
|
217
|
+
"""
|
218
|
+
Uploads content to the knowledge base.
|
219
|
+
|
220
|
+
Args:
|
221
|
+
user_id (str): The user ID.
|
222
|
+
company_id (str): The company ID.
|
223
|
+
content (bytes): The content to upload.
|
224
|
+
content_name (str): The name of the content.
|
225
|
+
mime_type (str): The MIME type of the content.
|
226
|
+
scope_id (str | None): The scope ID. Defaults to None.
|
227
|
+
chat_id (str | None): The chat ID. Defaults to None.
|
228
|
+
skip_ingestion (bool): Whether to skip ingestion. Defaults to False.
|
229
|
+
|
230
|
+
Returns:
|
231
|
+
Content: The uploaded content.
|
232
|
+
"""
|
233
|
+
|
234
|
+
try:
|
235
|
+
return _trigger_upload_content(
|
236
|
+
user_id=user_id,
|
237
|
+
company_id=company_id,
|
238
|
+
content=content,
|
239
|
+
content_name=content_name,
|
240
|
+
mime_type=mime_type,
|
241
|
+
scope_id=scope_id,
|
242
|
+
chat_id=chat_id,
|
243
|
+
skip_ingestion=skip_ingestion,
|
244
|
+
)
|
245
|
+
except Exception as e:
|
246
|
+
logger.error(f"Error while uploading content: {e}")
|
247
|
+
raise e
|
248
|
+
|
249
|
+
|
207
250
|
def upload_content(
|
208
251
|
user_id: str,
|
209
252
|
company_id: str,
|
@@ -235,7 +278,7 @@ def upload_content(
|
|
235
278
|
return _trigger_upload_content(
|
236
279
|
user_id=user_id,
|
237
280
|
company_id=company_id,
|
238
|
-
|
281
|
+
content=path_to_content,
|
239
282
|
content_name=content_name,
|
240
283
|
mime_type=mime_type,
|
241
284
|
scope_id=scope_id,
|
@@ -250,7 +293,7 @@ def upload_content(
|
|
250
293
|
def _trigger_upload_content(
|
251
294
|
user_id: str,
|
252
295
|
company_id: str,
|
253
|
-
|
296
|
+
content: str | Path | bytes,
|
254
297
|
content_name: str,
|
255
298
|
mime_type: str,
|
256
299
|
scope_id: str | None = None,
|
@@ -263,7 +306,7 @@ def _trigger_upload_content(
|
|
263
306
|
Args:
|
264
307
|
user_id (str): The user ID.
|
265
308
|
company_id (str): The company ID.
|
266
|
-
|
309
|
+
content (str | Path | bytes): The content to upload. If string or Path, file will be read from disk.
|
267
310
|
content_name (str): The name of the content.
|
268
311
|
mime_type (str): The MIME type of the content.
|
269
312
|
scope_id (str | None): The scope ID. Defaults to None.
|
@@ -277,7 +320,9 @@ def _trigger_upload_content(
|
|
277
320
|
if not chat_id and not scope_id:
|
278
321
|
raise ValueError("chat_id or scope_id must be provided")
|
279
322
|
|
280
|
-
byte_size =
|
323
|
+
byte_size = (
|
324
|
+
os.path.getsize(content) if isinstance(content, (Path, str)) else len(content)
|
325
|
+
)
|
281
326
|
created_content = _upsert_content(
|
282
327
|
user_id=user_id,
|
283
328
|
company_id=company_id,
|
@@ -297,16 +342,24 @@ def _trigger_upload_content(
|
|
297
342
|
logger.error(error_msg)
|
298
343
|
raise ValueError(error_msg)
|
299
344
|
|
345
|
+
headers = {
|
346
|
+
"X-Ms-Blob-Content-Type": mime_type,
|
347
|
+
"X-Ms-Blob-Type": "BlockBlob",
|
348
|
+
}
|
300
349
|
# upload to azure blob storage SAS url uploadUrl the pdf file translatedFile make sure it is treated as a application/pdf
|
301
|
-
|
350
|
+
if isinstance(content, bytes):
|
302
351
|
requests.put(
|
303
352
|
url=write_url,
|
304
|
-
data=
|
305
|
-
headers=
|
306
|
-
"X-Ms-Blob-Content-Type": mime_type,
|
307
|
-
"X-Ms-Blob-Type": "BlockBlob",
|
308
|
-
},
|
353
|
+
data=content,
|
354
|
+
headers=headers,
|
309
355
|
)
|
356
|
+
else:
|
357
|
+
with open(content, "rb") as file:
|
358
|
+
requests.put(
|
359
|
+
url=write_url,
|
360
|
+
data=file,
|
361
|
+
headers=headers,
|
362
|
+
)
|
310
363
|
|
311
364
|
read_url = created_content["readUrl"]
|
312
365
|
|
@@ -431,6 +484,23 @@ def download_content_to_file_by_id(
|
|
431
484
|
return content_path
|
432
485
|
|
433
486
|
|
487
|
+
def download_content_to_bytes(
|
488
|
+
user_id: str,
|
489
|
+
company_id: str,
|
490
|
+
content_id: str,
|
491
|
+
chat_id: str | None,
|
492
|
+
) -> bytes:
|
493
|
+
logger.info(f"Downloading content with content_id: {content_id}")
|
494
|
+
response = request_content_by_id(user_id, company_id, content_id, chat_id)
|
495
|
+
|
496
|
+
if response.status_code != 200:
|
497
|
+
error_msg = f"Error downloading file: Status code {response.status_code}"
|
498
|
+
logger.error(error_msg)
|
499
|
+
raise Exception(error_msg)
|
500
|
+
|
501
|
+
return response.content
|
502
|
+
|
503
|
+
|
434
504
|
# TODO: Discuss if we should deprecate this method due to unclear use by content_name
|
435
505
|
def download_content(
|
436
506
|
user_id: str,
|
@@ -10,6 +10,7 @@ from unique_toolkit.content import DOMAIN_NAME
|
|
10
10
|
from unique_toolkit.content.constants import DEFAULT_SEARCH_LANGUAGE
|
11
11
|
from unique_toolkit.content.functions import (
|
12
12
|
download_content,
|
13
|
+
download_content_to_bytes,
|
13
14
|
download_content_to_file_by_id,
|
14
15
|
request_content_by_id,
|
15
16
|
search_content_chunks,
|
@@ -17,6 +18,7 @@ from unique_toolkit.content.functions import (
|
|
17
18
|
search_contents,
|
18
19
|
search_contents_async,
|
19
20
|
upload_content,
|
21
|
+
upload_content_from_bytes,
|
20
22
|
)
|
21
23
|
from unique_toolkit.content.schemas import (
|
22
24
|
Content,
|
@@ -222,6 +224,41 @@ class ContentService:
|
|
222
224
|
|
223
225
|
return self.search_contents(where)
|
224
226
|
|
227
|
+
def upload_content_from_bytes(
|
228
|
+
self,
|
229
|
+
content: bytes,
|
230
|
+
content_name: str,
|
231
|
+
mime_type: str,
|
232
|
+
scope_id: str | None = None,
|
233
|
+
chat_id: str | None = None,
|
234
|
+
skip_ingestion: bool = False,
|
235
|
+
) -> Content:
|
236
|
+
"""
|
237
|
+
Uploads content to the knowledge base.
|
238
|
+
|
239
|
+
Args:
|
240
|
+
content (bytes): The content to upload.
|
241
|
+
content_name (str): The name of the content.
|
242
|
+
mime_type (str): The MIME type of the content.
|
243
|
+
scope_id (str | None): The scope ID. Defaults to None.
|
244
|
+
chat_id (str | None): The chat ID. Defaults to None.
|
245
|
+
skip_ingestion (bool): Whether to skip ingestion. Defaults to False.
|
246
|
+
|
247
|
+
Returns:
|
248
|
+
Content: The uploaded content.
|
249
|
+
"""
|
250
|
+
|
251
|
+
return upload_content_from_bytes(
|
252
|
+
user_id=self.user_id,
|
253
|
+
company_id=self.company_id,
|
254
|
+
content=content,
|
255
|
+
content_name=content_name,
|
256
|
+
mime_type=mime_type,
|
257
|
+
scope_id=scope_id,
|
258
|
+
chat_id=chat_id,
|
259
|
+
skip_ingestion=skip_ingestion,
|
260
|
+
)
|
261
|
+
|
225
262
|
def upload_content(
|
226
263
|
self,
|
227
264
|
path_to_content: str,
|
@@ -344,3 +381,29 @@ class ContentService:
|
|
344
381
|
chat_id=chat_id,
|
345
382
|
dir_path=dir_path,
|
346
383
|
)
|
384
|
+
|
385
|
+
def download_content_to_bytes(
|
386
|
+
self,
|
387
|
+
content_id: str,
|
388
|
+
chat_id: str | None = None,
|
389
|
+
) -> bytes:
|
390
|
+
"""
|
391
|
+
Downloads content to memory
|
392
|
+
|
393
|
+
Args:
|
394
|
+
content_id (str): The id of the uploaded content.
|
395
|
+
chat_id (Optional[str]): The chat_id, defaults to None.
|
396
|
+
|
397
|
+
Returns:
|
398
|
+
bytes: The downloaded content.
|
399
|
+
|
400
|
+
Raises:
|
401
|
+
Exception: If the download fails.
|
402
|
+
"""
|
403
|
+
|
404
|
+
return download_content_to_bytes(
|
405
|
+
user_id=self.user_id,
|
406
|
+
company_id=self.company_id,
|
407
|
+
content_id=content_id,
|
408
|
+
chat_id=chat_id,
|
409
|
+
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from datetime import date
|
2
2
|
from enum import StrEnum
|
3
|
-
from typing import ClassVar, Optional
|
3
|
+
from typing import ClassVar, Optional, Self
|
4
4
|
|
5
5
|
from pydantic import BaseModel
|
6
6
|
from typing_extensions import deprecated
|
@@ -11,13 +11,14 @@ from unique_toolkit.language_model.schemas import LanguageModelTokenLimits
|
|
11
11
|
class LanguageModelName(StrEnum):
|
12
12
|
AZURE_GPT_35_TURBO_0125 = "AZURE_GPT_35_TURBO_0125"
|
13
13
|
AZURE_GPT_4_0613 = "AZURE_GPT_4_0613"
|
14
|
-
AZURE_GPT_4_TURBO_1106 = "AZURE_GPT_4_TURBO_1106"
|
15
|
-
AZURE_GPT_4_VISION_PREVIEW = "AZURE_GPT_4_VISION_PREVIEW"
|
16
14
|
AZURE_GPT_4_32K_0613 = "AZURE_GPT_4_32K_0613"
|
17
15
|
AZURE_GPT_4_TURBO_2024_0409 = "AZURE_GPT_4_TURBO_2024_0409"
|
18
16
|
AZURE_GPT_4o_2024_0513 = "AZURE_GPT_4o_2024_0513"
|
19
17
|
AZURE_GPT_4o_2024_0806 = "AZURE_GPT_4o_2024_0806"
|
20
18
|
AZURE_GPT_4o_MINI_2024_0718 = "AZURE_GPT_4o_MINI_2024_0718"
|
19
|
+
AZURE_GPT_o1_2024_1217 = "AZURE_GPT_o1_2024_1217"
|
20
|
+
AZURE_GPT_o1_MINI_2024_0912 = "AZURE_GPT_o1_MINI_2024_0912"
|
21
|
+
AZURE_GPT_o3_MINI_2025_0131 = "AZURE_GPT_o3_MINI_2025_0131"
|
21
22
|
|
22
23
|
|
23
24
|
class EncoderName(StrEnum):
|
@@ -25,15 +26,13 @@ class EncoderName(StrEnum):
|
|
25
26
|
CL100K_BASE = "cl100k_base"
|
26
27
|
|
27
28
|
|
28
|
-
def get_encoder_name(model_name: LanguageModelName) ->
|
29
|
+
def get_encoder_name(model_name: LanguageModelName) -> EncoderName:
|
29
30
|
LMN = LanguageModelName
|
30
31
|
match model_name:
|
31
32
|
case LMN.AZURE_GPT_35_TURBO_0125:
|
32
33
|
return EncoderName.CL100K_BASE
|
33
34
|
case (
|
34
35
|
LMN.AZURE_GPT_4_0613
|
35
|
-
| LMN.AZURE_GPT_4_TURBO_1106
|
36
|
-
| LMN.AZURE_GPT_4_VISION_PREVIEW
|
37
36
|
| LMN.AZURE_GPT_4_32K_0613
|
38
37
|
| LMN.AZURE_GPT_4_TURBO_2024_0409
|
39
38
|
):
|
@@ -45,8 +44,10 @@ def get_encoder_name(model_name: LanguageModelName) -> Optional[EncoderName]:
|
|
45
44
|
):
|
46
45
|
return EncoderName.O200K_BASE
|
47
46
|
case _:
|
48
|
-
print(
|
49
|
-
|
47
|
+
print(
|
48
|
+
f"{model_name} is not supported. Please add encoder information. Using default"
|
49
|
+
)
|
50
|
+
return EncoderName.CL100K_BASE
|
50
51
|
|
51
52
|
|
52
53
|
class LanguageModelProvider(StrEnum):
|
@@ -54,13 +55,28 @@ class LanguageModelProvider(StrEnum):
|
|
54
55
|
CUSTOM = "CUSTOM"
|
55
56
|
|
56
57
|
|
58
|
+
class ModelCapabilities(StrEnum):
|
59
|
+
FUNCTION_CALLING = "function_calling"
|
60
|
+
PARALLEL_FUNCTION_CALLING = "parallel_function_calling"
|
61
|
+
REPRODUCIBLE_OUTPUT = "reproducible_output"
|
62
|
+
STRUCTURED_OUTPUT = "structured_output"
|
63
|
+
VISION = "vision"
|
64
|
+
STREAMING = "streaming"
|
65
|
+
REASONING = "reasoning"
|
66
|
+
|
67
|
+
|
57
68
|
class LanguageModelInfo(BaseModel):
|
58
69
|
name: LanguageModelName | str
|
59
70
|
version: str
|
60
71
|
provider: LanguageModelProvider
|
61
72
|
|
62
|
-
encoder_name:
|
63
|
-
|
73
|
+
encoder_name: EncoderName = EncoderName.CL100K_BASE
|
74
|
+
|
75
|
+
# TODO: Discuss if this is a sensible defaut
|
76
|
+
token_limits: LanguageModelTokenLimits = LanguageModelTokenLimits(
|
77
|
+
token_limit_input=7_000, token_limit_output=1_000
|
78
|
+
)
|
79
|
+
capabilities: list[ModelCapabilities] = [ModelCapabilities.STREAMING]
|
64
80
|
|
65
81
|
info_cutoff_at: Optional[date] = None
|
66
82
|
published_at: Optional[date] = None
|
@@ -70,14 +86,20 @@ class LanguageModelInfo(BaseModel):
|
|
70
86
|
retirement_text: Optional[str] = None
|
71
87
|
|
72
88
|
@classmethod
|
73
|
-
def from_name(cls, model_name: LanguageModelName):
|
89
|
+
def from_name(cls, model_name: LanguageModelName) -> Self:
|
74
90
|
match model_name:
|
75
91
|
case LanguageModelName.AZURE_GPT_35_TURBO_0125:
|
76
92
|
return cls(
|
77
93
|
name=model_name,
|
78
94
|
provider=LanguageModelProvider.AZURE,
|
95
|
+
capabilities=[
|
96
|
+
ModelCapabilities.STRUCTURED_OUTPUT,
|
97
|
+
ModelCapabilities.FUNCTION_CALLING,
|
98
|
+
ModelCapabilities.PARALLEL_FUNCTION_CALLING,
|
99
|
+
ModelCapabilities.REPRODUCIBLE_OUTPUT,
|
100
|
+
],
|
79
101
|
version="0125",
|
80
|
-
encoder_name=
|
102
|
+
encoder_name=EncoderName.CL100K_BASE,
|
81
103
|
token_limits=LanguageModelTokenLimits(
|
82
104
|
token_limit_input=16385, token_limit_output=4096
|
83
105
|
),
|
@@ -90,43 +112,27 @@ class LanguageModelInfo(BaseModel):
|
|
90
112
|
name=model_name,
|
91
113
|
provider=LanguageModelProvider.AZURE,
|
92
114
|
version="0613",
|
93
|
-
encoder_name=
|
115
|
+
encoder_name=EncoderName.CL100K_BASE,
|
116
|
+
capabilities=[
|
117
|
+
ModelCapabilities.FUNCTION_CALLING,
|
118
|
+
ModelCapabilities.STREAMING,
|
119
|
+
],
|
94
120
|
token_limits=LanguageModelTokenLimits(token_limit=8192),
|
95
121
|
info_cutoff_at=date(2021, 9, 1),
|
96
122
|
published_at=date(2023, 6, 13),
|
97
123
|
deprecated_at=date(2024, 10, 1),
|
98
124
|
retirement_at=date(2025, 6, 6),
|
99
125
|
)
|
100
|
-
case LanguageModelName.AZURE_GPT_4_TURBO_1106:
|
101
|
-
return cls(
|
102
|
-
name=model_name,
|
103
|
-
provider=LanguageModelProvider.AZURE,
|
104
|
-
version="1106-preview",
|
105
|
-
encoder_name=get_encoder_name(model_name),
|
106
|
-
token_limits=LanguageModelTokenLimits(
|
107
|
-
token_limit_input=128000, token_limit_output=4096
|
108
|
-
),
|
109
|
-
info_cutoff_at=date(2023, 4, 1),
|
110
|
-
published_at=date(2023, 11, 6),
|
111
|
-
)
|
112
|
-
case LanguageModelName.AZURE_GPT_4_VISION_PREVIEW:
|
113
|
-
return cls(
|
114
|
-
name=model_name,
|
115
|
-
provider=LanguageModelProvider.AZURE,
|
116
|
-
version="vision-preview",
|
117
|
-
encoder_name=get_encoder_name(model_name),
|
118
|
-
token_limits=LanguageModelTokenLimits(
|
119
|
-
token_limit_input=128000, token_limit_output=4096
|
120
|
-
),
|
121
|
-
info_cutoff_at=date(2023, 4, 1),
|
122
|
-
published_at=date(2023, 11, 6),
|
123
|
-
)
|
124
126
|
case LanguageModelName.AZURE_GPT_4_32K_0613:
|
125
127
|
return cls(
|
126
128
|
name=model_name,
|
127
129
|
provider=LanguageModelProvider.AZURE,
|
128
130
|
version="1106-preview",
|
129
|
-
|
131
|
+
capabilities=[
|
132
|
+
ModelCapabilities.FUNCTION_CALLING,
|
133
|
+
ModelCapabilities.STREAMING,
|
134
|
+
],
|
135
|
+
encoder_name=EncoderName.CL100K_BASE,
|
130
136
|
token_limits=LanguageModelTokenLimits(token_limit=32768),
|
131
137
|
info_cutoff_at=date(2021, 9, 1),
|
132
138
|
published_at=date(2023, 6, 13),
|
@@ -136,7 +142,14 @@ class LanguageModelInfo(BaseModel):
|
|
136
142
|
case LanguageModelName.AZURE_GPT_4_TURBO_2024_0409:
|
137
143
|
return cls(
|
138
144
|
name=model_name,
|
139
|
-
encoder_name=
|
145
|
+
encoder_name=EncoderName.CL100K_BASE,
|
146
|
+
capabilities=[
|
147
|
+
ModelCapabilities.FUNCTION_CALLING,
|
148
|
+
ModelCapabilities.PARALLEL_FUNCTION_CALLING,
|
149
|
+
ModelCapabilities.STRUCTURED_OUTPUT,
|
150
|
+
ModelCapabilities.VISION,
|
151
|
+
ModelCapabilities.STREAMING,
|
152
|
+
],
|
140
153
|
provider=LanguageModelProvider.AZURE,
|
141
154
|
version="turbo-2024-04-09",
|
142
155
|
token_limits=LanguageModelTokenLimits(
|
@@ -148,11 +161,18 @@ class LanguageModelInfo(BaseModel):
|
|
148
161
|
case LanguageModelName.AZURE_GPT_4o_2024_0513:
|
149
162
|
return cls(
|
150
163
|
name=model_name,
|
151
|
-
encoder_name=
|
164
|
+
encoder_name=EncoderName.O200K_BASE,
|
165
|
+
capabilities=[
|
166
|
+
ModelCapabilities.STRUCTURED_OUTPUT,
|
167
|
+
ModelCapabilities.FUNCTION_CALLING,
|
168
|
+
ModelCapabilities.PARALLEL_FUNCTION_CALLING,
|
169
|
+
ModelCapabilities.STREAMING,
|
170
|
+
ModelCapabilities.VISION,
|
171
|
+
],
|
152
172
|
provider=LanguageModelProvider.AZURE,
|
153
173
|
version="2024-05-13",
|
154
174
|
token_limits=LanguageModelTokenLimits(
|
155
|
-
token_limit_input=
|
175
|
+
token_limit_input=128_000, token_limit_output=4_096
|
156
176
|
),
|
157
177
|
info_cutoff_at=date(2023, 10, 1),
|
158
178
|
published_at=date(2024, 5, 13),
|
@@ -160,11 +180,18 @@ class LanguageModelInfo(BaseModel):
|
|
160
180
|
case LanguageModelName.AZURE_GPT_4o_2024_0806:
|
161
181
|
return cls(
|
162
182
|
name=model_name,
|
163
|
-
encoder_name=
|
183
|
+
encoder_name=EncoderName.O200K_BASE,
|
184
|
+
capabilities=[
|
185
|
+
ModelCapabilities.STRUCTURED_OUTPUT,
|
186
|
+
ModelCapabilities.FUNCTION_CALLING,
|
187
|
+
ModelCapabilities.PARALLEL_FUNCTION_CALLING,
|
188
|
+
ModelCapabilities.STREAMING,
|
189
|
+
ModelCapabilities.VISION,
|
190
|
+
],
|
164
191
|
provider=LanguageModelProvider.AZURE,
|
165
192
|
version="2024-08-06",
|
166
193
|
token_limits=LanguageModelTokenLimits(
|
167
|
-
token_limit_input=
|
194
|
+
token_limit_input=128_000, token_limit_output=16_384
|
168
195
|
),
|
169
196
|
info_cutoff_at=date(2023, 10, 1),
|
170
197
|
published_at=date(2024, 8, 6),
|
@@ -172,15 +199,78 @@ class LanguageModelInfo(BaseModel):
|
|
172
199
|
case LanguageModelName.AZURE_GPT_4o_MINI_2024_0718:
|
173
200
|
return cls(
|
174
201
|
name=model_name,
|
202
|
+
capabilities=[
|
203
|
+
ModelCapabilities.STRUCTURED_OUTPUT,
|
204
|
+
ModelCapabilities.FUNCTION_CALLING,
|
205
|
+
ModelCapabilities.PARALLEL_FUNCTION_CALLING,
|
206
|
+
ModelCapabilities.STREAMING,
|
207
|
+
ModelCapabilities.VISION,
|
208
|
+
],
|
175
209
|
provider=LanguageModelProvider.AZURE,
|
176
210
|
version="2024-07-18",
|
177
|
-
encoder_name=
|
211
|
+
encoder_name=EncoderName.O200K_BASE,
|
178
212
|
token_limits=LanguageModelTokenLimits(
|
179
|
-
token_limit_input=
|
213
|
+
token_limit_input=128_000, token_limit_output=16_384
|
180
214
|
),
|
181
215
|
info_cutoff_at=date(2023, 10, 1),
|
182
216
|
published_at=date(2024, 7, 18),
|
183
217
|
)
|
218
|
+
case LanguageModelName.AZURE_GPT_o1_2024_1217:
|
219
|
+
return cls(
|
220
|
+
name=model_name,
|
221
|
+
capabilities=[
|
222
|
+
ModelCapabilities.STRUCTURED_OUTPUT,
|
223
|
+
ModelCapabilities.FUNCTION_CALLING,
|
224
|
+
ModelCapabilities.STREAMING,
|
225
|
+
ModelCapabilities.VISION,
|
226
|
+
ModelCapabilities.REASONING,
|
227
|
+
],
|
228
|
+
provider=LanguageModelProvider.AZURE,
|
229
|
+
version="2024-12-17",
|
230
|
+
encoder_name=EncoderName.O200K_BASE,
|
231
|
+
token_limits=LanguageModelTokenLimits(
|
232
|
+
token_limit_input=200_000, token_limit_output=100_000
|
233
|
+
),
|
234
|
+
info_cutoff_at=date(2023, 10, 1),
|
235
|
+
published_at=date(2024, 12, 17),
|
236
|
+
)
|
237
|
+
case LanguageModelName.AZURE_GPT_o1_MINI_2024_0912:
|
238
|
+
return cls(
|
239
|
+
name=model_name,
|
240
|
+
capabilities=[
|
241
|
+
ModelCapabilities.STRUCTURED_OUTPUT,
|
242
|
+
ModelCapabilities.FUNCTION_CALLING,
|
243
|
+
ModelCapabilities.STREAMING,
|
244
|
+
ModelCapabilities.VISION,
|
245
|
+
ModelCapabilities.REASONING,
|
246
|
+
],
|
247
|
+
provider=LanguageModelProvider.AZURE,
|
248
|
+
version="2024-09-12",
|
249
|
+
encoder_name=EncoderName.O200K_BASE,
|
250
|
+
token_limits=LanguageModelTokenLimits(
|
251
|
+
token_limit_input=128_000, token_limit_output=65_536
|
252
|
+
),
|
253
|
+
info_cutoff_at=date(2023, 10, 1),
|
254
|
+
published_at=date(2024, 9, 12),
|
255
|
+
)
|
256
|
+
case LanguageModelName.AZURE_GPT_o3_MINI_2025_0131:
|
257
|
+
return cls(
|
258
|
+
name=model_name,
|
259
|
+
capabilities=[
|
260
|
+
ModelCapabilities.STRUCTURED_OUTPUT,
|
261
|
+
ModelCapabilities.FUNCTION_CALLING,
|
262
|
+
ModelCapabilities.STREAMING,
|
263
|
+
ModelCapabilities.REASONING,
|
264
|
+
],
|
265
|
+
provider=LanguageModelProvider.AZURE,
|
266
|
+
version="2025-01-31",
|
267
|
+
encoder_name=EncoderName.O200K_BASE,
|
268
|
+
token_limits=LanguageModelTokenLimits(
|
269
|
+
token_limit_input=200_000, token_limit_output=100_000
|
270
|
+
),
|
271
|
+
info_cutoff_at=date(2023, 10, 1),
|
272
|
+
published_at=date(2025, 1, 31),
|
273
|
+
)
|
184
274
|
case _:
|
185
275
|
if isinstance(model_name, LanguageModelName):
|
186
276
|
raise ValueError(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unique_toolkit
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.6
|
4
4
|
Summary:
|
5
5
|
License: Proprietary
|
6
6
|
Author: Martin Fadler
|
@@ -111,6 +111,14 @@ 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.6.6] - 2025-03-10
|
115
|
+
- Add o1, o1-mini and o3-mini models
|
116
|
+
- Remove deprecated gpt4 models
|
117
|
+
- Make token_limits and encoder a required attribute of LanguageModelInfo
|
118
|
+
|
119
|
+
## [0.6.5] - 2025-03-04
|
120
|
+
- Add `upload_content_from_bytes` to `ContentService`
|
121
|
+
- Add `download_content_to_bytes` to `ContentService`
|
114
122
|
|
115
123
|
## [0.6.3] - 2025-02-27
|
116
124
|
- Simplified imports for services. `from unique_toolkit.language_model import LanguageModelService` -> `from unique_toolkit import LanguageModelService` to reduce number of import lines.
|
@@ -20,9 +20,9 @@ unique_toolkit/chat/state.py,sha256=Cjgwv_2vhDFbV69xxsn7SefhaoIAEqLx3ferdVFCnOg,
|
|
20
20
|
unique_toolkit/chat/utils.py,sha256=ihm-wQykBWhB4liR3LnwPVPt_qGW6ETq21Mw4HY0THE,854
|
21
21
|
unique_toolkit/content/__init__.py,sha256=EdJg_A_7loEtCQf4cah3QARQreJx6pdz89Rm96YbMVg,940
|
22
22
|
unique_toolkit/content/constants.py,sha256=1iy4Y67xobl5VTnJB6SxSyuoBWbdLl9244xfVMUZi5o,60
|
23
|
-
unique_toolkit/content/functions.py,sha256=
|
23
|
+
unique_toolkit/content/functions.py,sha256=yB87wrbtmHzr3jGJUHetmuhy-7RVtnqG2IQ6gqFAun8,17093
|
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=CyQNW3TJX4trMnQhm5Ec2XGE9GHIW_NSGGT7YuOZIHQ,14234
|
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
|
@@ -48,7 +48,7 @@ unique_toolkit/language_model/__init__.py,sha256=jWko_vQj48wjnpTtlkg8iNdef0SMI3F
|
|
48
48
|
unique_toolkit/language_model/builder.py,sha256=qP1SlUnYJHLqT-fpXs4lgUixnekhx8IIfuoXnMHvRKE,2408
|
49
49
|
unique_toolkit/language_model/constants.py,sha256=B-topqW0r83dkC_25DeQfnPk3n53qzIHUCBS7YJ0-1U,119
|
50
50
|
unique_toolkit/language_model/functions.py,sha256=I5jHhHsKoq7GwEQyTrM8LXB2n_6dvMAk7UklenjuHSY,7945
|
51
|
-
unique_toolkit/language_model/infos.py,sha256
|
51
|
+
unique_toolkit/language_model/infos.py,sha256=DRkF0HzVemtSsSvdtrdsajNKaQ46Xla0ZXzFhi7xMtc,16338
|
52
52
|
unique_toolkit/language_model/prompt.py,sha256=JSawaLjQg3VR-E2fK8engFyJnNdk21zaO8pPIodzN4Q,3991
|
53
53
|
unique_toolkit/language_model/schemas.py,sha256=rrwzUgKANFOrdehCULW8Hh03uRW3tsE5dXpWqxmClfg,8618
|
54
54
|
unique_toolkit/language_model/service.py,sha256=GupYD4uDZjy1TfVQW3jichmgQwiSgQCj350FtL4O0W4,5569
|
@@ -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=gdsVzoNqTXmLoBR_-p_lJlZDBo8L7Cr5EKchTNVJg1Q,5233
|
61
|
-
unique_toolkit-0.6.
|
62
|
-
unique_toolkit-0.6.
|
63
|
-
unique_toolkit-0.6.
|
64
|
-
unique_toolkit-0.6.
|
61
|
+
unique_toolkit-0.6.6.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
|
62
|
+
unique_toolkit-0.6.6.dist-info/METADATA,sha256=MAiqgLQcnD82DSwx5CmFbRLoCaAJVgbrHLYpr0AGb2Q,20003
|
63
|
+
unique_toolkit-0.6.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
64
|
+
unique_toolkit-0.6.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|