orq-ai-sdk 4.2.0rc28__py3-none-any.whl → 4.2.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.
- orq_ai_sdk/_hooks/globalhook.py +0 -1
- orq_ai_sdk/_version.py +3 -3
- orq_ai_sdk/audio.py +30 -0
- orq_ai_sdk/basesdk.py +20 -6
- orq_ai_sdk/chat.py +22 -0
- orq_ai_sdk/completions.py +332 -0
- orq_ai_sdk/contacts.py +43 -855
- orq_ai_sdk/deployments.py +61 -0
- orq_ai_sdk/edits.py +258 -0
- orq_ai_sdk/embeddings.py +238 -0
- orq_ai_sdk/generations.py +272 -0
- orq_ai_sdk/identities.py +1037 -0
- orq_ai_sdk/images.py +28 -0
- orq_ai_sdk/models/__init__.py +5341 -737
- orq_ai_sdk/models/actionreviewedstreamingevent.py +18 -1
- orq_ai_sdk/models/actionreviewrequestedstreamingevent.py +44 -1
- orq_ai_sdk/models/agenterroredstreamingevent.py +18 -1
- orq_ai_sdk/models/agentinactivestreamingevent.py +168 -70
- orq_ai_sdk/models/agentmessagecreatedstreamingevent.py +18 -2
- orq_ai_sdk/models/agentresponsemessage.py +18 -2
- orq_ai_sdk/models/agentstartedstreamingevent.py +127 -2
- orq_ai_sdk/models/agentthoughtstreamingevent.py +178 -211
- orq_ai_sdk/models/conversationresponse.py +31 -20
- orq_ai_sdk/models/conversationwithmessagesresponse.py +31 -20
- orq_ai_sdk/models/createagentrequestop.py +1922 -384
- orq_ai_sdk/models/createagentresponse.py +147 -91
- orq_ai_sdk/models/createagentresponserequestop.py +111 -2
- orq_ai_sdk/models/createchatcompletionop.py +1375 -861
- orq_ai_sdk/models/createchunkop.py +46 -19
- orq_ai_sdk/models/createcompletionop.py +1890 -0
- orq_ai_sdk/models/createcontactop.py +45 -56
- orq_ai_sdk/models/createconversationop.py +61 -39
- orq_ai_sdk/models/createconversationresponseop.py +68 -4
- orq_ai_sdk/models/createdatasetitemop.py +424 -80
- orq_ai_sdk/models/createdatasetop.py +19 -2
- orq_ai_sdk/models/createdatasourceop.py +92 -26
- orq_ai_sdk/models/createembeddingop.py +384 -0
- orq_ai_sdk/models/createevalop.py +552 -24
- orq_ai_sdk/models/createidentityop.py +176 -0
- orq_ai_sdk/models/createimageeditop.py +504 -0
- orq_ai_sdk/models/createimageop.py +208 -117
- orq_ai_sdk/models/createimagevariationop.py +486 -0
- orq_ai_sdk/models/createknowledgeop.py +186 -121
- orq_ai_sdk/models/creatememorydocumentop.py +50 -1
- orq_ai_sdk/models/creatememoryop.py +34 -21
- orq_ai_sdk/models/creatememorystoreop.py +34 -1
- orq_ai_sdk/models/createmoderationop.py +521 -0
- orq_ai_sdk/models/createpromptop.py +2748 -1252
- orq_ai_sdk/models/creatererankop.py +416 -0
- orq_ai_sdk/models/createresponseop.py +2567 -0
- orq_ai_sdk/models/createspeechop.py +316 -0
- orq_ai_sdk/models/createtoolop.py +537 -12
- orq_ai_sdk/models/createtranscriptionop.py +562 -0
- orq_ai_sdk/models/createtranslationop.py +540 -0
- orq_ai_sdk/models/datapart.py +18 -1
- orq_ai_sdk/models/deletechunksop.py +34 -1
- orq_ai_sdk/models/{deletecontactop.py → deleteidentityop.py} +9 -9
- orq_ai_sdk/models/deletepromptop.py +26 -0
- orq_ai_sdk/models/deploymentcreatemetricop.py +362 -76
- orq_ai_sdk/models/deploymentgetconfigop.py +635 -194
- orq_ai_sdk/models/deploymentinvokeop.py +168 -173
- orq_ai_sdk/models/deploymentsop.py +195 -58
- orq_ai_sdk/models/deploymentstreamop.py +652 -304
- orq_ai_sdk/models/errorpart.py +18 -1
- orq_ai_sdk/models/filecontentpartschema.py +18 -1
- orq_ai_sdk/models/filegetop.py +19 -2
- orq_ai_sdk/models/filelistop.py +35 -2
- orq_ai_sdk/models/filepart.py +50 -1
- orq_ai_sdk/models/fileuploadop.py +51 -2
- orq_ai_sdk/models/generateconversationnameop.py +31 -20
- orq_ai_sdk/models/get_v2_evaluators_id_versionsop.py +34 -1
- orq_ai_sdk/models/get_v2_tools_tool_id_versions_version_id_op.py +18 -1
- orq_ai_sdk/models/get_v2_tools_tool_id_versionsop.py +34 -1
- orq_ai_sdk/models/getallmemoriesop.py +34 -21
- orq_ai_sdk/models/getallmemorydocumentsop.py +42 -1
- orq_ai_sdk/models/getallmemorystoresop.py +34 -1
- orq_ai_sdk/models/getallpromptsop.py +1690 -230
- orq_ai_sdk/models/getalltoolsop.py +325 -8
- orq_ai_sdk/models/getchunkscountop.py +34 -1
- orq_ai_sdk/models/getevalsop.py +395 -43
- orq_ai_sdk/models/getonechunkop.py +14 -19
- orq_ai_sdk/models/getoneknowledgeop.py +116 -96
- orq_ai_sdk/models/getonepromptop.py +1673 -230
- orq_ai_sdk/models/getpromptversionop.py +1670 -216
- orq_ai_sdk/models/imagecontentpartschema.py +50 -1
- orq_ai_sdk/models/internal/globals.py +18 -1
- orq_ai_sdk/models/invokeagentop.py +140 -2
- orq_ai_sdk/models/invokedeploymentrequest.py +418 -80
- orq_ai_sdk/models/invokeevalop.py +160 -131
- orq_ai_sdk/models/listagentsop.py +793 -166
- orq_ai_sdk/models/listchunksop.py +32 -19
- orq_ai_sdk/models/listchunkspaginatedop.py +46 -19
- orq_ai_sdk/models/listconversationsop.py +18 -1
- orq_ai_sdk/models/listdatasetdatapointsop.py +252 -42
- orq_ai_sdk/models/listdatasetsop.py +35 -2
- orq_ai_sdk/models/listdatasourcesop.py +35 -26
- orq_ai_sdk/models/{listcontactsop.py → listidentitiesop.py} +89 -79
- orq_ai_sdk/models/listknowledgebasesop.py +132 -96
- orq_ai_sdk/models/listmodelsop.py +1 -0
- orq_ai_sdk/models/listpromptversionsop.py +1684 -216
- orq_ai_sdk/models/parseop.py +161 -17
- orq_ai_sdk/models/partdoneevent.py +19 -2
- orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
- orq_ai_sdk/models/publiccontact.py +27 -4
- orq_ai_sdk/models/publicidentity.py +62 -0
- orq_ai_sdk/models/reasoningpart.py +19 -2
- orq_ai_sdk/models/refusalpartschema.py +18 -1
- orq_ai_sdk/models/remoteconfigsgetconfigop.py +34 -1
- orq_ai_sdk/models/responsedoneevent.py +114 -84
- orq_ai_sdk/models/responsestartedevent.py +18 -1
- orq_ai_sdk/models/retrieveagentrequestop.py +787 -166
- orq_ai_sdk/models/retrievedatapointop.py +236 -42
- orq_ai_sdk/models/retrievedatasetop.py +19 -2
- orq_ai_sdk/models/retrievedatasourceop.py +17 -26
- orq_ai_sdk/models/{retrievecontactop.py → retrieveidentityop.py} +38 -41
- orq_ai_sdk/models/retrievememorydocumentop.py +18 -1
- orq_ai_sdk/models/retrievememoryop.py +18 -21
- orq_ai_sdk/models/retrievememorystoreop.py +18 -1
- orq_ai_sdk/models/retrievetoolop.py +309 -8
- orq_ai_sdk/models/runagentop.py +1451 -197
- orq_ai_sdk/models/searchknowledgeop.py +108 -1
- orq_ai_sdk/models/security.py +18 -1
- orq_ai_sdk/models/streamagentop.py +93 -2
- orq_ai_sdk/models/streamrunagentop.py +1428 -195
- orq_ai_sdk/models/textcontentpartschema.py +34 -1
- orq_ai_sdk/models/thinkingconfigenabledschema.py +18 -1
- orq_ai_sdk/models/toolcallpart.py +18 -1
- orq_ai_sdk/models/tooldoneevent.py +18 -1
- orq_ai_sdk/models/toolexecutionfailedstreamingevent.py +50 -1
- orq_ai_sdk/models/toolexecutionfinishedstreamingevent.py +34 -1
- orq_ai_sdk/models/toolexecutionstartedstreamingevent.py +34 -1
- orq_ai_sdk/models/toolresultpart.py +18 -1
- orq_ai_sdk/models/toolreviewrequestedevent.py +18 -1
- orq_ai_sdk/models/toolstartedevent.py +18 -1
- orq_ai_sdk/models/updateagentop.py +1951 -404
- orq_ai_sdk/models/updatechunkop.py +46 -19
- orq_ai_sdk/models/updateconversationop.py +61 -39
- orq_ai_sdk/models/updatedatapointop.py +424 -80
- orq_ai_sdk/models/updatedatasetop.py +51 -2
- orq_ai_sdk/models/updatedatasourceop.py +17 -26
- orq_ai_sdk/models/updateevalop.py +577 -16
- orq_ai_sdk/models/{updatecontactop.py → updateidentityop.py} +78 -68
- orq_ai_sdk/models/updateknowledgeop.py +234 -190
- orq_ai_sdk/models/updatememorydocumentop.py +50 -1
- orq_ai_sdk/models/updatememoryop.py +50 -21
- orq_ai_sdk/models/updatememorystoreop.py +66 -1
- orq_ai_sdk/models/updatepromptop.py +2844 -1450
- orq_ai_sdk/models/updatetoolop.py +592 -9
- orq_ai_sdk/models/usermessagerequest.py +18 -2
- orq_ai_sdk/moderations.py +218 -0
- orq_ai_sdk/orq_completions.py +660 -0
- orq_ai_sdk/orq_responses.py +398 -0
- orq_ai_sdk/prompts.py +28 -36
- orq_ai_sdk/rerank.py +232 -0
- orq_ai_sdk/router.py +89 -641
- orq_ai_sdk/sdk.py +3 -0
- orq_ai_sdk/speech.py +251 -0
- orq_ai_sdk/transcriptions.py +326 -0
- orq_ai_sdk/translations.py +298 -0
- orq_ai_sdk/utils/__init__.py +13 -1
- orq_ai_sdk/variations.py +254 -0
- orq_ai_sdk-4.2.6.dist-info/METADATA +888 -0
- orq_ai_sdk-4.2.6.dist-info/RECORD +263 -0
- {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.2.6.dist-info}/WHEEL +2 -1
- orq_ai_sdk-4.2.6.dist-info/top_level.txt +1 -0
- orq_ai_sdk-4.2.0rc28.dist-info/METADATA +0 -867
- orq_ai_sdk-4.2.0rc28.dist-info/RECORD +0 -233
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from datetime import datetime
|
|
5
|
-
from orq_ai_sdk.types import BaseModel
|
|
5
|
+
from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
|
|
6
6
|
from orq_ai_sdk.utils import parse_datetime
|
|
7
7
|
import pydantic
|
|
8
|
+
from pydantic import model_serializer
|
|
8
9
|
from typing import Optional
|
|
9
10
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
10
11
|
|
|
@@ -93,5 +94,21 @@ class CreateDatasetResponseBody(BaseModel):
|
|
|
93
94
|
created: Optional[datetime] = None
|
|
94
95
|
r"""The date and time the resource was created"""
|
|
95
96
|
|
|
96
|
-
updated: Optional[datetime] = parse_datetime("2026-01-
|
|
97
|
+
updated: Optional[datetime] = parse_datetime("2026-01-25T15:02:07.185Z")
|
|
97
98
|
r"""The date and time the resource was last updated"""
|
|
99
|
+
|
|
100
|
+
@model_serializer(mode="wrap")
|
|
101
|
+
def serialize_model(self, handler):
|
|
102
|
+
optional_fields = set(["created_by_id", "updated_by_id", "created", "updated"])
|
|
103
|
+
serialized = handler(self)
|
|
104
|
+
m = {}
|
|
105
|
+
|
|
106
|
+
for n, f in type(self).model_fields.items():
|
|
107
|
+
k = f.alias or n
|
|
108
|
+
val = serialized.get(k)
|
|
109
|
+
|
|
110
|
+
if val != UNSET_SENTINEL:
|
|
111
|
+
if val is not None or k not in optional_fields:
|
|
112
|
+
m[k] = val
|
|
113
|
+
|
|
114
|
+
return m
|
|
@@ -44,6 +44,22 @@ class ChunkingConfiguration2(BaseModel):
|
|
|
44
44
|
chunk_overlap: Optional[float] = 0
|
|
45
45
|
r"""Specifies the number of characters to overlap between consecutive chunks. This overlap helps maintain semantic continuity when splitting large text elements."""
|
|
46
46
|
|
|
47
|
+
@model_serializer(mode="wrap")
|
|
48
|
+
def serialize_model(self, handler):
|
|
49
|
+
optional_fields = set(["chunk_max_characters", "chunk_overlap"])
|
|
50
|
+
serialized = handler(self)
|
|
51
|
+
m = {}
|
|
52
|
+
|
|
53
|
+
for n, f in type(self).model_fields.items():
|
|
54
|
+
k = f.alias or n
|
|
55
|
+
val = serialized.get(k)
|
|
56
|
+
|
|
57
|
+
if val != UNSET_SENTINEL:
|
|
58
|
+
if val is not None or k not in optional_fields:
|
|
59
|
+
m[k] = val
|
|
60
|
+
|
|
61
|
+
return m
|
|
62
|
+
|
|
47
63
|
|
|
48
64
|
ChunkingConfigurationType = Literal["default",]
|
|
49
65
|
|
|
@@ -125,6 +141,33 @@ class ChunkingCleanupOptions(BaseModel):
|
|
|
125
141
|
clean_whitespaces: Optional[bool] = None
|
|
126
142
|
r"""Trims and normalizes excessive whitespace throughout the text."""
|
|
127
143
|
|
|
144
|
+
@model_serializer(mode="wrap")
|
|
145
|
+
def serialize_model(self, handler):
|
|
146
|
+
optional_fields = set(
|
|
147
|
+
[
|
|
148
|
+
"delete_emails",
|
|
149
|
+
"delete_credit_cards",
|
|
150
|
+
"delete_phone_numbers",
|
|
151
|
+
"clean_bullet_points",
|
|
152
|
+
"clean_numbered_list",
|
|
153
|
+
"clean_unicode",
|
|
154
|
+
"clean_dashes",
|
|
155
|
+
"clean_whitespaces",
|
|
156
|
+
]
|
|
157
|
+
)
|
|
158
|
+
serialized = handler(self)
|
|
159
|
+
m = {}
|
|
160
|
+
|
|
161
|
+
for n, f in type(self).model_fields.items():
|
|
162
|
+
k = f.alias or n
|
|
163
|
+
val = serialized.get(k)
|
|
164
|
+
|
|
165
|
+
if val != UNSET_SENTINEL:
|
|
166
|
+
if val is not None or k not in optional_fields:
|
|
167
|
+
m[k] = val
|
|
168
|
+
|
|
169
|
+
return m
|
|
170
|
+
|
|
128
171
|
|
|
129
172
|
class ChunkingOptionsTypedDict(TypedDict):
|
|
130
173
|
r"""Configuration options specifying how the datasource file is chunked. Required if `file_id` is specified. Defaults to standard chunking options if omitted."""
|
|
@@ -144,6 +187,22 @@ class ChunkingOptions(BaseModel):
|
|
|
144
187
|
chunking_cleanup_options: Optional[ChunkingCleanupOptions] = None
|
|
145
188
|
r"""The cleanup options applied to the datasource content. All options are enabled by default to ensure enhanced security and optimal chunk quality. Defaults to system-standard cleanup options if not specified."""
|
|
146
189
|
|
|
190
|
+
@model_serializer(mode="wrap")
|
|
191
|
+
def serialize_model(self, handler):
|
|
192
|
+
optional_fields = set(["chunking_configuration", "chunking_cleanup_options"])
|
|
193
|
+
serialized = handler(self)
|
|
194
|
+
m = {}
|
|
195
|
+
|
|
196
|
+
for n, f in type(self).model_fields.items():
|
|
197
|
+
k = f.alias or n
|
|
198
|
+
val = serialized.get(k)
|
|
199
|
+
|
|
200
|
+
if val != UNSET_SENTINEL:
|
|
201
|
+
if val is not None or k not in optional_fields:
|
|
202
|
+
m[k] = val
|
|
203
|
+
|
|
204
|
+
return m
|
|
205
|
+
|
|
147
206
|
|
|
148
207
|
class CreateDatasourceRequestBodyTypedDict(TypedDict):
|
|
149
208
|
display_name: NotRequired[str]
|
|
@@ -164,6 +223,22 @@ class CreateDatasourceRequestBody(BaseModel):
|
|
|
164
223
|
chunking_options: Optional[ChunkingOptions] = None
|
|
165
224
|
r"""Configuration options specifying how the datasource file is chunked. Required if `file_id` is specified. Defaults to standard chunking options if omitted."""
|
|
166
225
|
|
|
226
|
+
@model_serializer(mode="wrap")
|
|
227
|
+
def serialize_model(self, handler):
|
|
228
|
+
optional_fields = set(["display_name", "file_id", "chunking_options"])
|
|
229
|
+
serialized = handler(self)
|
|
230
|
+
m = {}
|
|
231
|
+
|
|
232
|
+
for n, f in type(self).model_fields.items():
|
|
233
|
+
k = f.alias or n
|
|
234
|
+
val = serialized.get(k)
|
|
235
|
+
|
|
236
|
+
if val != UNSET_SENTINEL:
|
|
237
|
+
if val is not None or k not in optional_fields:
|
|
238
|
+
m[k] = val
|
|
239
|
+
|
|
240
|
+
return m
|
|
241
|
+
|
|
167
242
|
|
|
168
243
|
class CreateDatasourceRequestTypedDict(TypedDict):
|
|
169
244
|
knowledge_id: str
|
|
@@ -239,7 +314,7 @@ class CreateDatasourceResponseBody(BaseModel):
|
|
|
239
314
|
r"""The number of chunks in the datasource"""
|
|
240
315
|
|
|
241
316
|
id: Annotated[Optional[str], pydantic.Field(alias="_id")] = (
|
|
242
|
-
"
|
|
317
|
+
"01KFTTTRHXGP67Y2P1W8B66Q4Y"
|
|
243
318
|
)
|
|
244
319
|
r"""The unique identifier of the data source"""
|
|
245
320
|
|
|
@@ -257,36 +332,27 @@ class CreateDatasourceResponseBody(BaseModel):
|
|
|
257
332
|
|
|
258
333
|
@model_serializer(mode="wrap")
|
|
259
334
|
def serialize_model(self, handler):
|
|
260
|
-
optional_fields =
|
|
261
|
-
"_id",
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
"created_by_id",
|
|
265
|
-
"update_by_id",
|
|
266
|
-
]
|
|
267
|
-
nullable_fields = ["file_id", "created_by_id", "update_by_id"]
|
|
268
|
-
null_default_fields = []
|
|
269
|
-
|
|
335
|
+
optional_fields = set(
|
|
336
|
+
["_id", "description", "file_id", "created_by_id", "update_by_id"]
|
|
337
|
+
)
|
|
338
|
+
nullable_fields = set(["file_id", "created_by_id", "update_by_id"])
|
|
270
339
|
serialized = handler(self)
|
|
271
|
-
|
|
272
340
|
m = {}
|
|
273
341
|
|
|
274
342
|
for n, f in type(self).model_fields.items():
|
|
275
343
|
k = f.alias or n
|
|
276
344
|
val = serialized.get(k)
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
):
|
|
290
|
-
m[k] = val
|
|
345
|
+
is_nullable_and_explicitly_set = (
|
|
346
|
+
k in nullable_fields
|
|
347
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
if val != UNSET_SENTINEL:
|
|
351
|
+
if (
|
|
352
|
+
val is not None
|
|
353
|
+
or k not in optional_fields
|
|
354
|
+
or is_nullable_and_explicitly_set
|
|
355
|
+
):
|
|
356
|
+
m[k] = val
|
|
291
357
|
|
|
292
358
|
return m
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .publiccontact import PublicContact, PublicContactTypedDict
|
|
5
|
+
from .publicidentity import PublicIdentity, PublicIdentityTypedDict
|
|
6
|
+
from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
|
|
7
|
+
import pydantic
|
|
8
|
+
from pydantic import model_serializer
|
|
9
|
+
from typing import List, Literal, Optional, Union
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
CreateEmbeddingInputTypedDict = TypeAliasType(
|
|
14
|
+
"CreateEmbeddingInputTypedDict", Union[str, List[str]]
|
|
15
|
+
)
|
|
16
|
+
r"""Input text to embed, encoded as a string or array of tokens."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
CreateEmbeddingInput = TypeAliasType("CreateEmbeddingInput", Union[str, List[str]])
|
|
20
|
+
r"""Input text to embed, encoded as a string or array of tokens."""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
EncodingFormat = Literal[
|
|
24
|
+
"base64",
|
|
25
|
+
"float",
|
|
26
|
+
]
|
|
27
|
+
r"""Type of the document element"""
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class CreateEmbeddingFallbacksTypedDict(TypedDict):
|
|
31
|
+
model: str
|
|
32
|
+
r"""Fallback model identifier"""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class CreateEmbeddingFallbacks(BaseModel):
|
|
36
|
+
model: str
|
|
37
|
+
r"""Fallback model identifier"""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
CreateEmbeddingType = Literal["exact_match",]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class CreateEmbeddingCacheTypedDict(TypedDict):
|
|
44
|
+
r"""Cache configuration for the request."""
|
|
45
|
+
|
|
46
|
+
type: CreateEmbeddingType
|
|
47
|
+
ttl: NotRequired[float]
|
|
48
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class CreateEmbeddingCache(BaseModel):
|
|
52
|
+
r"""Cache configuration for the request."""
|
|
53
|
+
|
|
54
|
+
type: CreateEmbeddingType
|
|
55
|
+
|
|
56
|
+
ttl: Optional[float] = 1800
|
|
57
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
58
|
+
|
|
59
|
+
@model_serializer(mode="wrap")
|
|
60
|
+
def serialize_model(self, handler):
|
|
61
|
+
optional_fields = set(["ttl"])
|
|
62
|
+
serialized = handler(self)
|
|
63
|
+
m = {}
|
|
64
|
+
|
|
65
|
+
for n, f in type(self).model_fields.items():
|
|
66
|
+
k = f.alias or n
|
|
67
|
+
val = serialized.get(k)
|
|
68
|
+
|
|
69
|
+
if val != UNSET_SENTINEL:
|
|
70
|
+
if val is not None or k not in optional_fields:
|
|
71
|
+
m[k] = val
|
|
72
|
+
|
|
73
|
+
return m
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class CreateEmbeddingRetryTypedDict(TypedDict):
|
|
77
|
+
r"""Retry configuration for the request"""
|
|
78
|
+
|
|
79
|
+
count: NotRequired[float]
|
|
80
|
+
r"""Number of retry attempts (1-5)"""
|
|
81
|
+
on_codes: NotRequired[List[float]]
|
|
82
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class CreateEmbeddingRetry(BaseModel):
|
|
86
|
+
r"""Retry configuration for the request"""
|
|
87
|
+
|
|
88
|
+
count: Optional[float] = 3
|
|
89
|
+
r"""Number of retry attempts (1-5)"""
|
|
90
|
+
|
|
91
|
+
on_codes: Optional[List[float]] = None
|
|
92
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
93
|
+
|
|
94
|
+
@model_serializer(mode="wrap")
|
|
95
|
+
def serialize_model(self, handler):
|
|
96
|
+
optional_fields = set(["count", "on_codes"])
|
|
97
|
+
serialized = handler(self)
|
|
98
|
+
m = {}
|
|
99
|
+
|
|
100
|
+
for n, f in type(self).model_fields.items():
|
|
101
|
+
k = f.alias or n
|
|
102
|
+
val = serialized.get(k)
|
|
103
|
+
|
|
104
|
+
if val != UNSET_SENTINEL:
|
|
105
|
+
if val is not None or k not in optional_fields:
|
|
106
|
+
m[k] = val
|
|
107
|
+
|
|
108
|
+
return m
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
CreateEmbeddingLoadBalancerType = Literal["weight_based",]
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class CreateEmbeddingLoadBalancerModelsTypedDict(TypedDict):
|
|
115
|
+
model: str
|
|
116
|
+
r"""Model identifier for load balancing"""
|
|
117
|
+
weight: NotRequired[float]
|
|
118
|
+
r"""Weight assigned to this model for load balancing"""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class CreateEmbeddingLoadBalancerModels(BaseModel):
|
|
122
|
+
model: str
|
|
123
|
+
r"""Model identifier for load balancing"""
|
|
124
|
+
|
|
125
|
+
weight: Optional[float] = 0.5
|
|
126
|
+
r"""Weight assigned to this model for load balancing"""
|
|
127
|
+
|
|
128
|
+
@model_serializer(mode="wrap")
|
|
129
|
+
def serialize_model(self, handler):
|
|
130
|
+
optional_fields = set(["weight"])
|
|
131
|
+
serialized = handler(self)
|
|
132
|
+
m = {}
|
|
133
|
+
|
|
134
|
+
for n, f in type(self).model_fields.items():
|
|
135
|
+
k = f.alias or n
|
|
136
|
+
val = serialized.get(k)
|
|
137
|
+
|
|
138
|
+
if val != UNSET_SENTINEL:
|
|
139
|
+
if val is not None or k not in optional_fields:
|
|
140
|
+
m[k] = val
|
|
141
|
+
|
|
142
|
+
return m
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class CreateEmbeddingLoadBalancer1TypedDict(TypedDict):
|
|
146
|
+
type: CreateEmbeddingLoadBalancerType
|
|
147
|
+
models: List[CreateEmbeddingLoadBalancerModelsTypedDict]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class CreateEmbeddingLoadBalancer1(BaseModel):
|
|
151
|
+
type: CreateEmbeddingLoadBalancerType
|
|
152
|
+
|
|
153
|
+
models: List[CreateEmbeddingLoadBalancerModels]
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
CreateEmbeddingLoadBalancerTypedDict = CreateEmbeddingLoadBalancer1TypedDict
|
|
157
|
+
r"""Array of models with weights for load balancing requests"""
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
CreateEmbeddingLoadBalancer = CreateEmbeddingLoadBalancer1
|
|
161
|
+
r"""Array of models with weights for load balancing requests"""
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class CreateEmbeddingTimeoutTypedDict(TypedDict):
|
|
165
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
166
|
+
|
|
167
|
+
call_timeout: float
|
|
168
|
+
r"""Timeout value in milliseconds"""
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class CreateEmbeddingTimeout(BaseModel):
|
|
172
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
173
|
+
|
|
174
|
+
call_timeout: float
|
|
175
|
+
r"""Timeout value in milliseconds"""
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class CreateEmbeddingOrqTypedDict(TypedDict):
|
|
179
|
+
name: NotRequired[str]
|
|
180
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
181
|
+
fallbacks: NotRequired[List[CreateEmbeddingFallbacksTypedDict]]
|
|
182
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
183
|
+
cache: NotRequired[CreateEmbeddingCacheTypedDict]
|
|
184
|
+
r"""Cache configuration for the request."""
|
|
185
|
+
retry: NotRequired[CreateEmbeddingRetryTypedDict]
|
|
186
|
+
r"""Retry configuration for the request"""
|
|
187
|
+
identity: NotRequired[PublicIdentityTypedDict]
|
|
188
|
+
r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
|
|
189
|
+
contact: NotRequired[PublicContactTypedDict]
|
|
190
|
+
r"""@deprecated Use identity instead. Information about the contact making the request."""
|
|
191
|
+
load_balancer: NotRequired[CreateEmbeddingLoadBalancerTypedDict]
|
|
192
|
+
r"""Array of models with weights for load balancing requests"""
|
|
193
|
+
timeout: NotRequired[CreateEmbeddingTimeoutTypedDict]
|
|
194
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class CreateEmbeddingOrq(BaseModel):
|
|
198
|
+
name: Optional[str] = None
|
|
199
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
200
|
+
|
|
201
|
+
fallbacks: Optional[List[CreateEmbeddingFallbacks]] = None
|
|
202
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
203
|
+
|
|
204
|
+
cache: Optional[CreateEmbeddingCache] = None
|
|
205
|
+
r"""Cache configuration for the request."""
|
|
206
|
+
|
|
207
|
+
retry: Optional[CreateEmbeddingRetry] = None
|
|
208
|
+
r"""Retry configuration for the request"""
|
|
209
|
+
|
|
210
|
+
identity: Optional[PublicIdentity] = None
|
|
211
|
+
r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
|
|
212
|
+
|
|
213
|
+
contact: Annotated[
|
|
214
|
+
Optional[PublicContact],
|
|
215
|
+
pydantic.Field(
|
|
216
|
+
deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
217
|
+
),
|
|
218
|
+
] = None
|
|
219
|
+
r"""@deprecated Use identity instead. Information about the contact making the request."""
|
|
220
|
+
|
|
221
|
+
load_balancer: Optional[CreateEmbeddingLoadBalancer] = None
|
|
222
|
+
r"""Array of models with weights for load balancing requests"""
|
|
223
|
+
|
|
224
|
+
timeout: Optional[CreateEmbeddingTimeout] = None
|
|
225
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
226
|
+
|
|
227
|
+
@model_serializer(mode="wrap")
|
|
228
|
+
def serialize_model(self, handler):
|
|
229
|
+
optional_fields = set(
|
|
230
|
+
[
|
|
231
|
+
"name",
|
|
232
|
+
"fallbacks",
|
|
233
|
+
"cache",
|
|
234
|
+
"retry",
|
|
235
|
+
"identity",
|
|
236
|
+
"contact",
|
|
237
|
+
"load_balancer",
|
|
238
|
+
"timeout",
|
|
239
|
+
]
|
|
240
|
+
)
|
|
241
|
+
serialized = handler(self)
|
|
242
|
+
m = {}
|
|
243
|
+
|
|
244
|
+
for n, f in type(self).model_fields.items():
|
|
245
|
+
k = f.alias or n
|
|
246
|
+
val = serialized.get(k)
|
|
247
|
+
|
|
248
|
+
if val != UNSET_SENTINEL:
|
|
249
|
+
if val is not None or k not in optional_fields:
|
|
250
|
+
m[k] = val
|
|
251
|
+
|
|
252
|
+
return m
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class CreateEmbeddingRequestBodyTypedDict(TypedDict):
|
|
256
|
+
r"""input"""
|
|
257
|
+
|
|
258
|
+
input: CreateEmbeddingInputTypedDict
|
|
259
|
+
r"""Input text to embed, encoded as a string or array of tokens."""
|
|
260
|
+
model: str
|
|
261
|
+
r"""ID of the model to use"""
|
|
262
|
+
encoding_format: NotRequired[EncodingFormat]
|
|
263
|
+
r"""Type of the document element"""
|
|
264
|
+
dimensions: NotRequired[float]
|
|
265
|
+
r"""The number of dimensions the resulting output embeddings should have."""
|
|
266
|
+
user: NotRequired[str]
|
|
267
|
+
r"""A unique identifier representing your end-user"""
|
|
268
|
+
orq: NotRequired[CreateEmbeddingOrqTypedDict]
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
class CreateEmbeddingRequestBody(BaseModel):
|
|
272
|
+
r"""input"""
|
|
273
|
+
|
|
274
|
+
input: CreateEmbeddingInput
|
|
275
|
+
r"""Input text to embed, encoded as a string or array of tokens."""
|
|
276
|
+
|
|
277
|
+
model: str
|
|
278
|
+
r"""ID of the model to use"""
|
|
279
|
+
|
|
280
|
+
encoding_format: Optional[EncodingFormat] = "float"
|
|
281
|
+
r"""Type of the document element"""
|
|
282
|
+
|
|
283
|
+
dimensions: Optional[float] = None
|
|
284
|
+
r"""The number of dimensions the resulting output embeddings should have."""
|
|
285
|
+
|
|
286
|
+
user: Optional[str] = None
|
|
287
|
+
r"""A unique identifier representing your end-user"""
|
|
288
|
+
|
|
289
|
+
orq: Optional[CreateEmbeddingOrq] = None
|
|
290
|
+
|
|
291
|
+
@model_serializer(mode="wrap")
|
|
292
|
+
def serialize_model(self, handler):
|
|
293
|
+
optional_fields = set(["encoding_format", "dimensions", "user", "orq"])
|
|
294
|
+
serialized = handler(self)
|
|
295
|
+
m = {}
|
|
296
|
+
|
|
297
|
+
for n, f in type(self).model_fields.items():
|
|
298
|
+
k = f.alias or n
|
|
299
|
+
val = serialized.get(k)
|
|
300
|
+
|
|
301
|
+
if val != UNSET_SENTINEL:
|
|
302
|
+
if val is not None or k not in optional_fields:
|
|
303
|
+
m[k] = val
|
|
304
|
+
|
|
305
|
+
return m
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
CreateEmbeddingObject = Literal["list",]
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
CreateEmbeddingRouterEmbeddingsObject = Literal["embedding",]
|
|
312
|
+
r"""The object type, which is always `embedding`."""
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
EmbeddingTypedDict = TypeAliasType("EmbeddingTypedDict", Union[List[float], str])
|
|
316
|
+
r"""The embedding vector, which is a list of floats. The length of vector depends on the model."""
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
Embedding = TypeAliasType("Embedding", Union[List[float], str])
|
|
320
|
+
r"""The embedding vector, which is a list of floats. The length of vector depends on the model."""
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
class CreateEmbeddingDataTypedDict(TypedDict):
|
|
324
|
+
object: CreateEmbeddingRouterEmbeddingsObject
|
|
325
|
+
r"""The object type, which is always `embedding`."""
|
|
326
|
+
embedding: EmbeddingTypedDict
|
|
327
|
+
r"""The embedding vector, which is a list of floats. The length of vector depends on the model."""
|
|
328
|
+
index: float
|
|
329
|
+
r"""The index of the embedding in the list of embeddings."""
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class CreateEmbeddingData(BaseModel):
|
|
333
|
+
object: CreateEmbeddingRouterEmbeddingsObject
|
|
334
|
+
r"""The object type, which is always `embedding`."""
|
|
335
|
+
|
|
336
|
+
embedding: Embedding
|
|
337
|
+
r"""The embedding vector, which is a list of floats. The length of vector depends on the model."""
|
|
338
|
+
|
|
339
|
+
index: float
|
|
340
|
+
r"""The index of the embedding in the list of embeddings."""
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
class CreateEmbeddingUsageTypedDict(TypedDict):
|
|
344
|
+
r"""The usage information for the request."""
|
|
345
|
+
|
|
346
|
+
prompt_tokens: float
|
|
347
|
+
r"""The number of tokens used by the prompt."""
|
|
348
|
+
total_tokens: float
|
|
349
|
+
r"""The total number of tokens used by the request."""
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
class CreateEmbeddingUsage(BaseModel):
|
|
353
|
+
r"""The usage information for the request."""
|
|
354
|
+
|
|
355
|
+
prompt_tokens: float
|
|
356
|
+
r"""The number of tokens used by the prompt."""
|
|
357
|
+
|
|
358
|
+
total_tokens: float
|
|
359
|
+
r"""The total number of tokens used by the request."""
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
class CreateEmbeddingResponseBodyTypedDict(TypedDict):
|
|
363
|
+
r"""Returns the embedding vector."""
|
|
364
|
+
|
|
365
|
+
object: CreateEmbeddingObject
|
|
366
|
+
data: List[CreateEmbeddingDataTypedDict]
|
|
367
|
+
model: str
|
|
368
|
+
r"""ID of the model to used."""
|
|
369
|
+
usage: CreateEmbeddingUsageTypedDict
|
|
370
|
+
r"""The usage information for the request."""
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
class CreateEmbeddingResponseBody(BaseModel):
|
|
374
|
+
r"""Returns the embedding vector."""
|
|
375
|
+
|
|
376
|
+
object: CreateEmbeddingObject
|
|
377
|
+
|
|
378
|
+
data: List[CreateEmbeddingData]
|
|
379
|
+
|
|
380
|
+
model: str
|
|
381
|
+
r"""ID of the model to used."""
|
|
382
|
+
|
|
383
|
+
usage: CreateEmbeddingUsage
|
|
384
|
+
r"""The usage information for the request."""
|