orq-ai-sdk 4.2.0rc28__py3-none-any.whl → 4.3.0rc7__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/_version.py +3 -3
- orq_ai_sdk/agents.py +186 -186
- 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 +438 -0
- orq_ai_sdk/contacts.py +43 -855
- orq_ai_sdk/deployments.py +61 -0
- orq_ai_sdk/edits.py +364 -0
- orq_ai_sdk/embeddings.py +344 -0
- orq_ai_sdk/generations.py +370 -0
- orq_ai_sdk/identities.py +1037 -0
- orq_ai_sdk/images.py +28 -0
- orq_ai_sdk/models/__init__.py +5746 -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 +1945 -383
- orq_ai_sdk/models/createagentresponse.py +147 -91
- orq_ai_sdk/models/createagentresponserequestop.py +111 -2
- orq_ai_sdk/models/createchatcompletionop.py +1381 -861
- orq_ai_sdk/models/createchunkop.py +46 -19
- orq_ai_sdk/models/createcompletionop.py +2078 -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 +579 -0
- orq_ai_sdk/models/createevalop.py +552 -24
- orq_ai_sdk/models/createidentityop.py +176 -0
- orq_ai_sdk/models/createimageeditop.py +715 -0
- orq_ai_sdk/models/createimageop.py +407 -128
- orq_ai_sdk/models/createimagevariationop.py +706 -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 +2759 -1251
- orq_ai_sdk/models/creatererankop.py +608 -0
- orq_ai_sdk/models/createresponseop.py +2567 -0
- orq_ai_sdk/models/createspeechop.py +466 -0
- orq_ai_sdk/models/createtoolop.py +537 -12
- orq_ai_sdk/models/createtranscriptionop.py +732 -0
- orq_ai_sdk/models/createtranslationop.py +702 -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 +1696 -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 +1679 -230
- orq_ai_sdk/models/getpromptversionop.py +1676 -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 +805 -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 +1690 -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 +799 -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 +1462 -196
- 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 +1439 -194
- 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 +1968 -397
- 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 +2854 -1448
- 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 +666 -0
- orq_ai_sdk/orq_responses.py +398 -0
- orq_ai_sdk/prompts.py +28 -36
- orq_ai_sdk/rerank.py +330 -0
- orq_ai_sdk/router.py +89 -641
- orq_ai_sdk/sdk.py +3 -0
- orq_ai_sdk/speech.py +333 -0
- orq_ai_sdk/transcriptions.py +416 -0
- orq_ai_sdk/translations.py +384 -0
- orq_ai_sdk/utils/__init__.py +13 -1
- orq_ai_sdk/variations.py +364 -0
- {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/METADATA +169 -148
- orq_ai_sdk-4.3.0rc7.dist-info/RECORD +263 -0
- {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/WHEEL +2 -1
- orq_ai_sdk-4.3.0rc7.dist-info/top_level.txt +1 -0
- orq_ai_sdk-4.2.0rc28.dist-info/RECORD +0 -233
|
@@ -0,0 +1,579 @@
|
|
|
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
|
+
class CreateEmbeddingRetryTypedDict(TypedDict):
|
|
41
|
+
r"""Retry configuration for the request"""
|
|
42
|
+
|
|
43
|
+
count: NotRequired[float]
|
|
44
|
+
r"""Number of retry attempts (1-5)"""
|
|
45
|
+
on_codes: NotRequired[List[float]]
|
|
46
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class CreateEmbeddingRetry(BaseModel):
|
|
50
|
+
r"""Retry configuration for the request"""
|
|
51
|
+
|
|
52
|
+
count: Optional[float] = 3
|
|
53
|
+
r"""Number of retry attempts (1-5)"""
|
|
54
|
+
|
|
55
|
+
on_codes: Optional[List[float]] = None
|
|
56
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
57
|
+
|
|
58
|
+
@model_serializer(mode="wrap")
|
|
59
|
+
def serialize_model(self, handler):
|
|
60
|
+
optional_fields = set(["count", "on_codes"])
|
|
61
|
+
serialized = handler(self)
|
|
62
|
+
m = {}
|
|
63
|
+
|
|
64
|
+
for n, f in type(self).model_fields.items():
|
|
65
|
+
k = f.alias or n
|
|
66
|
+
val = serialized.get(k)
|
|
67
|
+
|
|
68
|
+
if val != UNSET_SENTINEL:
|
|
69
|
+
if val is not None or k not in optional_fields:
|
|
70
|
+
m[k] = val
|
|
71
|
+
|
|
72
|
+
return m
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
CreateEmbeddingType = Literal["exact_match",]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class CreateEmbeddingCacheTypedDict(TypedDict):
|
|
79
|
+
r"""Cache configuration for the request."""
|
|
80
|
+
|
|
81
|
+
type: CreateEmbeddingType
|
|
82
|
+
ttl: NotRequired[float]
|
|
83
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class CreateEmbeddingCache(BaseModel):
|
|
87
|
+
r"""Cache configuration for the request."""
|
|
88
|
+
|
|
89
|
+
type: CreateEmbeddingType
|
|
90
|
+
|
|
91
|
+
ttl: Optional[float] = 1800
|
|
92
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
93
|
+
|
|
94
|
+
@model_serializer(mode="wrap")
|
|
95
|
+
def serialize_model(self, handler):
|
|
96
|
+
optional_fields = set(["ttl"])
|
|
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"""Load balancer configuration for the request."""
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
CreateEmbeddingLoadBalancer = CreateEmbeddingLoadBalancer1
|
|
161
|
+
r"""Load balancer configuration for the request."""
|
|
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 CreateEmbeddingRouterEmbeddingsFallbacksTypedDict(TypedDict):
|
|
179
|
+
model: str
|
|
180
|
+
r"""Fallback model identifier"""
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class CreateEmbeddingRouterEmbeddingsFallbacks(BaseModel):
|
|
184
|
+
model: str
|
|
185
|
+
r"""Fallback model identifier"""
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
CreateEmbeddingRouterEmbeddingsType = Literal["exact_match",]
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class CreateEmbeddingRouterEmbeddingsCacheTypedDict(TypedDict):
|
|
192
|
+
r"""Cache configuration for the request."""
|
|
193
|
+
|
|
194
|
+
type: CreateEmbeddingRouterEmbeddingsType
|
|
195
|
+
ttl: NotRequired[float]
|
|
196
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class CreateEmbeddingRouterEmbeddingsCache(BaseModel):
|
|
200
|
+
r"""Cache configuration for the request."""
|
|
201
|
+
|
|
202
|
+
type: CreateEmbeddingRouterEmbeddingsType
|
|
203
|
+
|
|
204
|
+
ttl: Optional[float] = 1800
|
|
205
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
206
|
+
|
|
207
|
+
@model_serializer(mode="wrap")
|
|
208
|
+
def serialize_model(self, handler):
|
|
209
|
+
optional_fields = set(["ttl"])
|
|
210
|
+
serialized = handler(self)
|
|
211
|
+
m = {}
|
|
212
|
+
|
|
213
|
+
for n, f in type(self).model_fields.items():
|
|
214
|
+
k = f.alias or n
|
|
215
|
+
val = serialized.get(k)
|
|
216
|
+
|
|
217
|
+
if val != UNSET_SENTINEL:
|
|
218
|
+
if val is not None or k not in optional_fields:
|
|
219
|
+
m[k] = val
|
|
220
|
+
|
|
221
|
+
return m
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class CreateEmbeddingRouterEmbeddingsRetryTypedDict(TypedDict):
|
|
225
|
+
r"""Retry configuration for the request"""
|
|
226
|
+
|
|
227
|
+
count: NotRequired[float]
|
|
228
|
+
r"""Number of retry attempts (1-5)"""
|
|
229
|
+
on_codes: NotRequired[List[float]]
|
|
230
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class CreateEmbeddingRouterEmbeddingsRetry(BaseModel):
|
|
234
|
+
r"""Retry configuration for the request"""
|
|
235
|
+
|
|
236
|
+
count: Optional[float] = 3
|
|
237
|
+
r"""Number of retry attempts (1-5)"""
|
|
238
|
+
|
|
239
|
+
on_codes: Optional[List[float]] = None
|
|
240
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
241
|
+
|
|
242
|
+
@model_serializer(mode="wrap")
|
|
243
|
+
def serialize_model(self, handler):
|
|
244
|
+
optional_fields = set(["count", "on_codes"])
|
|
245
|
+
serialized = handler(self)
|
|
246
|
+
m = {}
|
|
247
|
+
|
|
248
|
+
for n, f in type(self).model_fields.items():
|
|
249
|
+
k = f.alias or n
|
|
250
|
+
val = serialized.get(k)
|
|
251
|
+
|
|
252
|
+
if val != UNSET_SENTINEL:
|
|
253
|
+
if val is not None or k not in optional_fields:
|
|
254
|
+
m[k] = val
|
|
255
|
+
|
|
256
|
+
return m
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
CreateEmbeddingLoadBalancerRouterEmbeddingsType = Literal["weight_based",]
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class CreateEmbeddingLoadBalancerRouterEmbeddingsModelsTypedDict(TypedDict):
|
|
263
|
+
model: str
|
|
264
|
+
r"""Model identifier for load balancing"""
|
|
265
|
+
weight: NotRequired[float]
|
|
266
|
+
r"""Weight assigned to this model for load balancing"""
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
class CreateEmbeddingLoadBalancerRouterEmbeddingsModels(BaseModel):
|
|
270
|
+
model: str
|
|
271
|
+
r"""Model identifier for load balancing"""
|
|
272
|
+
|
|
273
|
+
weight: Optional[float] = 0.5
|
|
274
|
+
r"""Weight assigned to this model for load balancing"""
|
|
275
|
+
|
|
276
|
+
@model_serializer(mode="wrap")
|
|
277
|
+
def serialize_model(self, handler):
|
|
278
|
+
optional_fields = set(["weight"])
|
|
279
|
+
serialized = handler(self)
|
|
280
|
+
m = {}
|
|
281
|
+
|
|
282
|
+
for n, f in type(self).model_fields.items():
|
|
283
|
+
k = f.alias or n
|
|
284
|
+
val = serialized.get(k)
|
|
285
|
+
|
|
286
|
+
if val != UNSET_SENTINEL:
|
|
287
|
+
if val is not None or k not in optional_fields:
|
|
288
|
+
m[k] = val
|
|
289
|
+
|
|
290
|
+
return m
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
class CreateEmbeddingLoadBalancerRouterEmbeddings1TypedDict(TypedDict):
|
|
294
|
+
type: CreateEmbeddingLoadBalancerRouterEmbeddingsType
|
|
295
|
+
models: List[CreateEmbeddingLoadBalancerRouterEmbeddingsModelsTypedDict]
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
class CreateEmbeddingLoadBalancerRouterEmbeddings1(BaseModel):
|
|
299
|
+
type: CreateEmbeddingLoadBalancerRouterEmbeddingsType
|
|
300
|
+
|
|
301
|
+
models: List[CreateEmbeddingLoadBalancerRouterEmbeddingsModels]
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
CreateEmbeddingRouterEmbeddingsLoadBalancerTypedDict = (
|
|
305
|
+
CreateEmbeddingLoadBalancerRouterEmbeddings1TypedDict
|
|
306
|
+
)
|
|
307
|
+
r"""Array of models with weights for load balancing requests"""
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
CreateEmbeddingRouterEmbeddingsLoadBalancer = (
|
|
311
|
+
CreateEmbeddingLoadBalancerRouterEmbeddings1
|
|
312
|
+
)
|
|
313
|
+
r"""Array of models with weights for load balancing requests"""
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
class CreateEmbeddingRouterEmbeddingsTimeoutTypedDict(TypedDict):
|
|
317
|
+
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."""
|
|
318
|
+
|
|
319
|
+
call_timeout: float
|
|
320
|
+
r"""Timeout value in milliseconds"""
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
class CreateEmbeddingRouterEmbeddingsTimeout(BaseModel):
|
|
324
|
+
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."""
|
|
325
|
+
|
|
326
|
+
call_timeout: float
|
|
327
|
+
r"""Timeout value in milliseconds"""
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
class CreateEmbeddingOrqTypedDict(TypedDict):
|
|
331
|
+
name: NotRequired[str]
|
|
332
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
333
|
+
fallbacks: NotRequired[List[CreateEmbeddingRouterEmbeddingsFallbacksTypedDict]]
|
|
334
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
335
|
+
cache: NotRequired[CreateEmbeddingRouterEmbeddingsCacheTypedDict]
|
|
336
|
+
r"""Cache configuration for the request."""
|
|
337
|
+
retry: NotRequired[CreateEmbeddingRouterEmbeddingsRetryTypedDict]
|
|
338
|
+
r"""Retry configuration for the request"""
|
|
339
|
+
identity: NotRequired[PublicIdentityTypedDict]
|
|
340
|
+
r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
|
|
341
|
+
contact: NotRequired[PublicContactTypedDict]
|
|
342
|
+
r"""@deprecated Use identity instead. Information about the contact making the request."""
|
|
343
|
+
load_balancer: NotRequired[CreateEmbeddingRouterEmbeddingsLoadBalancerTypedDict]
|
|
344
|
+
r"""Array of models with weights for load balancing requests"""
|
|
345
|
+
timeout: NotRequired[CreateEmbeddingRouterEmbeddingsTimeoutTypedDict]
|
|
346
|
+
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."""
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
class CreateEmbeddingOrq(BaseModel):
|
|
350
|
+
name: Optional[str] = None
|
|
351
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
352
|
+
|
|
353
|
+
fallbacks: Optional[List[CreateEmbeddingRouterEmbeddingsFallbacks]] = None
|
|
354
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
355
|
+
|
|
356
|
+
cache: Optional[CreateEmbeddingRouterEmbeddingsCache] = None
|
|
357
|
+
r"""Cache configuration for the request."""
|
|
358
|
+
|
|
359
|
+
retry: Optional[CreateEmbeddingRouterEmbeddingsRetry] = None
|
|
360
|
+
r"""Retry configuration for the request"""
|
|
361
|
+
|
|
362
|
+
identity: Optional[PublicIdentity] = None
|
|
363
|
+
r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
|
|
364
|
+
|
|
365
|
+
contact: Annotated[
|
|
366
|
+
Optional[PublicContact],
|
|
367
|
+
pydantic.Field(
|
|
368
|
+
deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
369
|
+
),
|
|
370
|
+
] = None
|
|
371
|
+
r"""@deprecated Use identity instead. Information about the contact making the request."""
|
|
372
|
+
|
|
373
|
+
load_balancer: Optional[CreateEmbeddingRouterEmbeddingsLoadBalancer] = None
|
|
374
|
+
r"""Array of models with weights for load balancing requests"""
|
|
375
|
+
|
|
376
|
+
timeout: Optional[CreateEmbeddingRouterEmbeddingsTimeout] = None
|
|
377
|
+
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."""
|
|
378
|
+
|
|
379
|
+
@model_serializer(mode="wrap")
|
|
380
|
+
def serialize_model(self, handler):
|
|
381
|
+
optional_fields = set(
|
|
382
|
+
[
|
|
383
|
+
"name",
|
|
384
|
+
"fallbacks",
|
|
385
|
+
"cache",
|
|
386
|
+
"retry",
|
|
387
|
+
"identity",
|
|
388
|
+
"contact",
|
|
389
|
+
"load_balancer",
|
|
390
|
+
"timeout",
|
|
391
|
+
]
|
|
392
|
+
)
|
|
393
|
+
serialized = handler(self)
|
|
394
|
+
m = {}
|
|
395
|
+
|
|
396
|
+
for n, f in type(self).model_fields.items():
|
|
397
|
+
k = f.alias or n
|
|
398
|
+
val = serialized.get(k)
|
|
399
|
+
|
|
400
|
+
if val != UNSET_SENTINEL:
|
|
401
|
+
if val is not None or k not in optional_fields:
|
|
402
|
+
m[k] = val
|
|
403
|
+
|
|
404
|
+
return m
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
class CreateEmbeddingRequestBodyTypedDict(TypedDict):
|
|
408
|
+
r"""input"""
|
|
409
|
+
|
|
410
|
+
input: CreateEmbeddingInputTypedDict
|
|
411
|
+
r"""Input text to embed, encoded as a string or array of tokens."""
|
|
412
|
+
model: str
|
|
413
|
+
r"""ID of the model to use"""
|
|
414
|
+
encoding_format: NotRequired[EncodingFormat]
|
|
415
|
+
r"""Type of the document element"""
|
|
416
|
+
dimensions: NotRequired[float]
|
|
417
|
+
r"""The number of dimensions the resulting output embeddings should have."""
|
|
418
|
+
user: NotRequired[str]
|
|
419
|
+
r"""A unique identifier representing your end-user"""
|
|
420
|
+
name: NotRequired[str]
|
|
421
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
422
|
+
fallbacks: NotRequired[List[CreateEmbeddingFallbacksTypedDict]]
|
|
423
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
424
|
+
retry: NotRequired[CreateEmbeddingRetryTypedDict]
|
|
425
|
+
r"""Retry configuration for the request"""
|
|
426
|
+
cache: NotRequired[CreateEmbeddingCacheTypedDict]
|
|
427
|
+
r"""Cache configuration for the request."""
|
|
428
|
+
load_balancer: NotRequired[CreateEmbeddingLoadBalancerTypedDict]
|
|
429
|
+
r"""Load balancer configuration for the request."""
|
|
430
|
+
timeout: NotRequired[CreateEmbeddingTimeoutTypedDict]
|
|
431
|
+
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."""
|
|
432
|
+
orq: NotRequired[CreateEmbeddingOrqTypedDict]
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
class CreateEmbeddingRequestBody(BaseModel):
|
|
436
|
+
r"""input"""
|
|
437
|
+
|
|
438
|
+
input: CreateEmbeddingInput
|
|
439
|
+
r"""Input text to embed, encoded as a string or array of tokens."""
|
|
440
|
+
|
|
441
|
+
model: str
|
|
442
|
+
r"""ID of the model to use"""
|
|
443
|
+
|
|
444
|
+
encoding_format: Optional[EncodingFormat] = "float"
|
|
445
|
+
r"""Type of the document element"""
|
|
446
|
+
|
|
447
|
+
dimensions: Optional[float] = None
|
|
448
|
+
r"""The number of dimensions the resulting output embeddings should have."""
|
|
449
|
+
|
|
450
|
+
user: Optional[str] = None
|
|
451
|
+
r"""A unique identifier representing your end-user"""
|
|
452
|
+
|
|
453
|
+
name: Optional[str] = None
|
|
454
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
455
|
+
|
|
456
|
+
fallbacks: Optional[List[CreateEmbeddingFallbacks]] = None
|
|
457
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
458
|
+
|
|
459
|
+
retry: Optional[CreateEmbeddingRetry] = None
|
|
460
|
+
r"""Retry configuration for the request"""
|
|
461
|
+
|
|
462
|
+
cache: Optional[CreateEmbeddingCache] = None
|
|
463
|
+
r"""Cache configuration for the request."""
|
|
464
|
+
|
|
465
|
+
load_balancer: Optional[CreateEmbeddingLoadBalancer] = None
|
|
466
|
+
r"""Load balancer configuration for the request."""
|
|
467
|
+
|
|
468
|
+
timeout: Optional[CreateEmbeddingTimeout] = None
|
|
469
|
+
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."""
|
|
470
|
+
|
|
471
|
+
orq: Optional[CreateEmbeddingOrq] = None
|
|
472
|
+
|
|
473
|
+
@model_serializer(mode="wrap")
|
|
474
|
+
def serialize_model(self, handler):
|
|
475
|
+
optional_fields = set(
|
|
476
|
+
[
|
|
477
|
+
"encoding_format",
|
|
478
|
+
"dimensions",
|
|
479
|
+
"user",
|
|
480
|
+
"name",
|
|
481
|
+
"fallbacks",
|
|
482
|
+
"retry",
|
|
483
|
+
"cache",
|
|
484
|
+
"load_balancer",
|
|
485
|
+
"timeout",
|
|
486
|
+
"orq",
|
|
487
|
+
]
|
|
488
|
+
)
|
|
489
|
+
serialized = handler(self)
|
|
490
|
+
m = {}
|
|
491
|
+
|
|
492
|
+
for n, f in type(self).model_fields.items():
|
|
493
|
+
k = f.alias or n
|
|
494
|
+
val = serialized.get(k)
|
|
495
|
+
|
|
496
|
+
if val != UNSET_SENTINEL:
|
|
497
|
+
if val is not None or k not in optional_fields:
|
|
498
|
+
m[k] = val
|
|
499
|
+
|
|
500
|
+
return m
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
CreateEmbeddingObject = Literal["list",]
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
CreateEmbeddingRouterEmbeddingsObject = Literal["embedding",]
|
|
507
|
+
r"""The object type, which is always `embedding`."""
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
EmbeddingTypedDict = TypeAliasType("EmbeddingTypedDict", Union[List[float], str])
|
|
511
|
+
r"""The embedding vector, which is a list of floats. The length of vector depends on the model."""
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
Embedding = TypeAliasType("Embedding", Union[List[float], str])
|
|
515
|
+
r"""The embedding vector, which is a list of floats. The length of vector depends on the model."""
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
class CreateEmbeddingDataTypedDict(TypedDict):
|
|
519
|
+
object: CreateEmbeddingRouterEmbeddingsObject
|
|
520
|
+
r"""The object type, which is always `embedding`."""
|
|
521
|
+
embedding: EmbeddingTypedDict
|
|
522
|
+
r"""The embedding vector, which is a list of floats. The length of vector depends on the model."""
|
|
523
|
+
index: float
|
|
524
|
+
r"""The index of the embedding in the list of embeddings."""
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
class CreateEmbeddingData(BaseModel):
|
|
528
|
+
object: CreateEmbeddingRouterEmbeddingsObject
|
|
529
|
+
r"""The object type, which is always `embedding`."""
|
|
530
|
+
|
|
531
|
+
embedding: Embedding
|
|
532
|
+
r"""The embedding vector, which is a list of floats. The length of vector depends on the model."""
|
|
533
|
+
|
|
534
|
+
index: float
|
|
535
|
+
r"""The index of the embedding in the list of embeddings."""
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
class CreateEmbeddingUsageTypedDict(TypedDict):
|
|
539
|
+
r"""The usage information for the request."""
|
|
540
|
+
|
|
541
|
+
prompt_tokens: float
|
|
542
|
+
r"""The number of tokens used by the prompt."""
|
|
543
|
+
total_tokens: float
|
|
544
|
+
r"""The total number of tokens used by the request."""
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
class CreateEmbeddingUsage(BaseModel):
|
|
548
|
+
r"""The usage information for the request."""
|
|
549
|
+
|
|
550
|
+
prompt_tokens: float
|
|
551
|
+
r"""The number of tokens used by the prompt."""
|
|
552
|
+
|
|
553
|
+
total_tokens: float
|
|
554
|
+
r"""The total number of tokens used by the request."""
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
class CreateEmbeddingResponseBodyTypedDict(TypedDict):
|
|
558
|
+
r"""Returns the embedding vector."""
|
|
559
|
+
|
|
560
|
+
object: CreateEmbeddingObject
|
|
561
|
+
data: List[CreateEmbeddingDataTypedDict]
|
|
562
|
+
model: str
|
|
563
|
+
r"""ID of the model to used."""
|
|
564
|
+
usage: CreateEmbeddingUsageTypedDict
|
|
565
|
+
r"""The usage information for the request."""
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
class CreateEmbeddingResponseBody(BaseModel):
|
|
569
|
+
r"""Returns the embedding vector."""
|
|
570
|
+
|
|
571
|
+
object: CreateEmbeddingObject
|
|
572
|
+
|
|
573
|
+
data: List[CreateEmbeddingData]
|
|
574
|
+
|
|
575
|
+
model: str
|
|
576
|
+
r"""ID of the model to used."""
|
|
577
|
+
|
|
578
|
+
usage: CreateEmbeddingUsage
|
|
579
|
+
r"""The usage information for the request."""
|