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,608 @@
|
|
|
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 (
|
|
7
|
+
BaseModel,
|
|
8
|
+
Nullable,
|
|
9
|
+
OptionalNullable,
|
|
10
|
+
UNSET,
|
|
11
|
+
UNSET_SENTINEL,
|
|
12
|
+
)
|
|
13
|
+
import pydantic
|
|
14
|
+
from pydantic import model_serializer
|
|
15
|
+
from typing import List, Literal, Optional
|
|
16
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CreateRerankFallbacksTypedDict(TypedDict):
|
|
20
|
+
model: str
|
|
21
|
+
r"""Fallback model identifier"""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CreateRerankFallbacks(BaseModel):
|
|
25
|
+
model: str
|
|
26
|
+
r"""Fallback model identifier"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CreateRerankRetryTypedDict(TypedDict):
|
|
30
|
+
r"""Retry configuration for the request"""
|
|
31
|
+
|
|
32
|
+
count: NotRequired[float]
|
|
33
|
+
r"""Number of retry attempts (1-5)"""
|
|
34
|
+
on_codes: NotRequired[List[float]]
|
|
35
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CreateRerankRetry(BaseModel):
|
|
39
|
+
r"""Retry configuration for the request"""
|
|
40
|
+
|
|
41
|
+
count: Optional[float] = 3
|
|
42
|
+
r"""Number of retry attempts (1-5)"""
|
|
43
|
+
|
|
44
|
+
on_codes: Optional[List[float]] = None
|
|
45
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
46
|
+
|
|
47
|
+
@model_serializer(mode="wrap")
|
|
48
|
+
def serialize_model(self, handler):
|
|
49
|
+
optional_fields = set(["count", "on_codes"])
|
|
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
|
+
|
|
63
|
+
|
|
64
|
+
CreateRerankType = Literal["exact_match",]
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class CreateRerankCacheTypedDict(TypedDict):
|
|
68
|
+
r"""Cache configuration for the request."""
|
|
69
|
+
|
|
70
|
+
type: CreateRerankType
|
|
71
|
+
ttl: NotRequired[float]
|
|
72
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class CreateRerankCache(BaseModel):
|
|
76
|
+
r"""Cache configuration for the request."""
|
|
77
|
+
|
|
78
|
+
type: CreateRerankType
|
|
79
|
+
|
|
80
|
+
ttl: Optional[float] = 1800
|
|
81
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
82
|
+
|
|
83
|
+
@model_serializer(mode="wrap")
|
|
84
|
+
def serialize_model(self, handler):
|
|
85
|
+
optional_fields = set(["ttl"])
|
|
86
|
+
serialized = handler(self)
|
|
87
|
+
m = {}
|
|
88
|
+
|
|
89
|
+
for n, f in type(self).model_fields.items():
|
|
90
|
+
k = f.alias or n
|
|
91
|
+
val = serialized.get(k)
|
|
92
|
+
|
|
93
|
+
if val != UNSET_SENTINEL:
|
|
94
|
+
if val is not None or k not in optional_fields:
|
|
95
|
+
m[k] = val
|
|
96
|
+
|
|
97
|
+
return m
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
CreateRerankLoadBalancerType = Literal["weight_based",]
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class CreateRerankLoadBalancerModelsTypedDict(TypedDict):
|
|
104
|
+
model: str
|
|
105
|
+
r"""Model identifier for load balancing"""
|
|
106
|
+
weight: NotRequired[float]
|
|
107
|
+
r"""Weight assigned to this model for load balancing"""
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class CreateRerankLoadBalancerModels(BaseModel):
|
|
111
|
+
model: str
|
|
112
|
+
r"""Model identifier for load balancing"""
|
|
113
|
+
|
|
114
|
+
weight: Optional[float] = 0.5
|
|
115
|
+
r"""Weight assigned to this model for load balancing"""
|
|
116
|
+
|
|
117
|
+
@model_serializer(mode="wrap")
|
|
118
|
+
def serialize_model(self, handler):
|
|
119
|
+
optional_fields = set(["weight"])
|
|
120
|
+
serialized = handler(self)
|
|
121
|
+
m = {}
|
|
122
|
+
|
|
123
|
+
for n, f in type(self).model_fields.items():
|
|
124
|
+
k = f.alias or n
|
|
125
|
+
val = serialized.get(k)
|
|
126
|
+
|
|
127
|
+
if val != UNSET_SENTINEL:
|
|
128
|
+
if val is not None or k not in optional_fields:
|
|
129
|
+
m[k] = val
|
|
130
|
+
|
|
131
|
+
return m
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class CreateRerankLoadBalancer1TypedDict(TypedDict):
|
|
135
|
+
type: CreateRerankLoadBalancerType
|
|
136
|
+
models: List[CreateRerankLoadBalancerModelsTypedDict]
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class CreateRerankLoadBalancer1(BaseModel):
|
|
140
|
+
type: CreateRerankLoadBalancerType
|
|
141
|
+
|
|
142
|
+
models: List[CreateRerankLoadBalancerModels]
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
CreateRerankLoadBalancerTypedDict = CreateRerankLoadBalancer1TypedDict
|
|
146
|
+
r"""Load balancer configuration for the request."""
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
CreateRerankLoadBalancer = CreateRerankLoadBalancer1
|
|
150
|
+
r"""Load balancer configuration for the request."""
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class CreateRerankTimeoutTypedDict(TypedDict):
|
|
154
|
+
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."""
|
|
155
|
+
|
|
156
|
+
call_timeout: float
|
|
157
|
+
r"""Timeout value in milliseconds"""
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class CreateRerankTimeout(BaseModel):
|
|
161
|
+
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."""
|
|
162
|
+
|
|
163
|
+
call_timeout: float
|
|
164
|
+
r"""Timeout value in milliseconds"""
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class CreateRerankRouterRerankFallbacksTypedDict(TypedDict):
|
|
168
|
+
model: str
|
|
169
|
+
r"""Fallback model identifier"""
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class CreateRerankRouterRerankFallbacks(BaseModel):
|
|
173
|
+
model: str
|
|
174
|
+
r"""Fallback model identifier"""
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
CreateRerankRouterRerankType = Literal["exact_match",]
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class CreateRerankRouterRerankCacheTypedDict(TypedDict):
|
|
181
|
+
r"""Cache configuration for the request."""
|
|
182
|
+
|
|
183
|
+
type: CreateRerankRouterRerankType
|
|
184
|
+
ttl: NotRequired[float]
|
|
185
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class CreateRerankRouterRerankCache(BaseModel):
|
|
189
|
+
r"""Cache configuration for the request."""
|
|
190
|
+
|
|
191
|
+
type: CreateRerankRouterRerankType
|
|
192
|
+
|
|
193
|
+
ttl: Optional[float] = 1800
|
|
194
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
195
|
+
|
|
196
|
+
@model_serializer(mode="wrap")
|
|
197
|
+
def serialize_model(self, handler):
|
|
198
|
+
optional_fields = set(["ttl"])
|
|
199
|
+
serialized = handler(self)
|
|
200
|
+
m = {}
|
|
201
|
+
|
|
202
|
+
for n, f in type(self).model_fields.items():
|
|
203
|
+
k = f.alias or n
|
|
204
|
+
val = serialized.get(k)
|
|
205
|
+
|
|
206
|
+
if val != UNSET_SENTINEL:
|
|
207
|
+
if val is not None or k not in optional_fields:
|
|
208
|
+
m[k] = val
|
|
209
|
+
|
|
210
|
+
return m
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
class CreateRerankRouterRerankRetryTypedDict(TypedDict):
|
|
214
|
+
r"""Retry configuration for the request"""
|
|
215
|
+
|
|
216
|
+
count: NotRequired[float]
|
|
217
|
+
r"""Number of retry attempts (1-5)"""
|
|
218
|
+
on_codes: NotRequired[List[float]]
|
|
219
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class CreateRerankRouterRerankRetry(BaseModel):
|
|
223
|
+
r"""Retry configuration for the request"""
|
|
224
|
+
|
|
225
|
+
count: Optional[float] = 3
|
|
226
|
+
r"""Number of retry attempts (1-5)"""
|
|
227
|
+
|
|
228
|
+
on_codes: Optional[List[float]] = None
|
|
229
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
230
|
+
|
|
231
|
+
@model_serializer(mode="wrap")
|
|
232
|
+
def serialize_model(self, handler):
|
|
233
|
+
optional_fields = set(["count", "on_codes"])
|
|
234
|
+
serialized = handler(self)
|
|
235
|
+
m = {}
|
|
236
|
+
|
|
237
|
+
for n, f in type(self).model_fields.items():
|
|
238
|
+
k = f.alias or n
|
|
239
|
+
val = serialized.get(k)
|
|
240
|
+
|
|
241
|
+
if val != UNSET_SENTINEL:
|
|
242
|
+
if val is not None or k not in optional_fields:
|
|
243
|
+
m[k] = val
|
|
244
|
+
|
|
245
|
+
return m
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
CreateRerankLoadBalancerRouterRerankType = Literal["weight_based",]
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
class CreateRerankLoadBalancerRouterRerankModelsTypedDict(TypedDict):
|
|
252
|
+
model: str
|
|
253
|
+
r"""Model identifier for load balancing"""
|
|
254
|
+
weight: NotRequired[float]
|
|
255
|
+
r"""Weight assigned to this model for load balancing"""
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class CreateRerankLoadBalancerRouterRerankModels(BaseModel):
|
|
259
|
+
model: str
|
|
260
|
+
r"""Model identifier for load balancing"""
|
|
261
|
+
|
|
262
|
+
weight: Optional[float] = 0.5
|
|
263
|
+
r"""Weight assigned to this model for load balancing"""
|
|
264
|
+
|
|
265
|
+
@model_serializer(mode="wrap")
|
|
266
|
+
def serialize_model(self, handler):
|
|
267
|
+
optional_fields = set(["weight"])
|
|
268
|
+
serialized = handler(self)
|
|
269
|
+
m = {}
|
|
270
|
+
|
|
271
|
+
for n, f in type(self).model_fields.items():
|
|
272
|
+
k = f.alias or n
|
|
273
|
+
val = serialized.get(k)
|
|
274
|
+
|
|
275
|
+
if val != UNSET_SENTINEL:
|
|
276
|
+
if val is not None or k not in optional_fields:
|
|
277
|
+
m[k] = val
|
|
278
|
+
|
|
279
|
+
return m
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
class CreateRerankLoadBalancerRouterRerank1TypedDict(TypedDict):
|
|
283
|
+
type: CreateRerankLoadBalancerRouterRerankType
|
|
284
|
+
models: List[CreateRerankLoadBalancerRouterRerankModelsTypedDict]
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class CreateRerankLoadBalancerRouterRerank1(BaseModel):
|
|
288
|
+
type: CreateRerankLoadBalancerRouterRerankType
|
|
289
|
+
|
|
290
|
+
models: List[CreateRerankLoadBalancerRouterRerankModels]
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
CreateRerankRouterRerankLoadBalancerTypedDict = (
|
|
294
|
+
CreateRerankLoadBalancerRouterRerank1TypedDict
|
|
295
|
+
)
|
|
296
|
+
r"""Array of models with weights for load balancing requests"""
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
CreateRerankRouterRerankLoadBalancer = CreateRerankLoadBalancerRouterRerank1
|
|
300
|
+
r"""Array of models with weights for load balancing requests"""
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
class CreateRerankRouterRerankTimeoutTypedDict(TypedDict):
|
|
304
|
+
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."""
|
|
305
|
+
|
|
306
|
+
call_timeout: float
|
|
307
|
+
r"""Timeout value in milliseconds"""
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
class CreateRerankRouterRerankTimeout(BaseModel):
|
|
311
|
+
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."""
|
|
312
|
+
|
|
313
|
+
call_timeout: float
|
|
314
|
+
r"""Timeout value in milliseconds"""
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
class CreateRerankOrqTypedDict(TypedDict):
|
|
318
|
+
name: NotRequired[str]
|
|
319
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
320
|
+
fallbacks: NotRequired[List[CreateRerankRouterRerankFallbacksTypedDict]]
|
|
321
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
322
|
+
cache: NotRequired[CreateRerankRouterRerankCacheTypedDict]
|
|
323
|
+
r"""Cache configuration for the request."""
|
|
324
|
+
retry: NotRequired[CreateRerankRouterRerankRetryTypedDict]
|
|
325
|
+
r"""Retry configuration for the request"""
|
|
326
|
+
identity: NotRequired[PublicIdentityTypedDict]
|
|
327
|
+
r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
|
|
328
|
+
contact: NotRequired[PublicContactTypedDict]
|
|
329
|
+
r"""@deprecated Use identity instead. Information about the contact making the request."""
|
|
330
|
+
load_balancer: NotRequired[CreateRerankRouterRerankLoadBalancerTypedDict]
|
|
331
|
+
r"""Array of models with weights for load balancing requests"""
|
|
332
|
+
timeout: NotRequired[CreateRerankRouterRerankTimeoutTypedDict]
|
|
333
|
+
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."""
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
class CreateRerankOrq(BaseModel):
|
|
337
|
+
name: Optional[str] = None
|
|
338
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
339
|
+
|
|
340
|
+
fallbacks: Optional[List[CreateRerankRouterRerankFallbacks]] = None
|
|
341
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
342
|
+
|
|
343
|
+
cache: Optional[CreateRerankRouterRerankCache] = None
|
|
344
|
+
r"""Cache configuration for the request."""
|
|
345
|
+
|
|
346
|
+
retry: Optional[CreateRerankRouterRerankRetry] = None
|
|
347
|
+
r"""Retry configuration for the request"""
|
|
348
|
+
|
|
349
|
+
identity: Optional[PublicIdentity] = None
|
|
350
|
+
r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
|
|
351
|
+
|
|
352
|
+
contact: Annotated[
|
|
353
|
+
Optional[PublicContact],
|
|
354
|
+
pydantic.Field(
|
|
355
|
+
deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
356
|
+
),
|
|
357
|
+
] = None
|
|
358
|
+
r"""@deprecated Use identity instead. Information about the contact making the request."""
|
|
359
|
+
|
|
360
|
+
load_balancer: Optional[CreateRerankRouterRerankLoadBalancer] = None
|
|
361
|
+
r"""Array of models with weights for load balancing requests"""
|
|
362
|
+
|
|
363
|
+
timeout: Optional[CreateRerankRouterRerankTimeout] = None
|
|
364
|
+
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."""
|
|
365
|
+
|
|
366
|
+
@model_serializer(mode="wrap")
|
|
367
|
+
def serialize_model(self, handler):
|
|
368
|
+
optional_fields = set(
|
|
369
|
+
[
|
|
370
|
+
"name",
|
|
371
|
+
"fallbacks",
|
|
372
|
+
"cache",
|
|
373
|
+
"retry",
|
|
374
|
+
"identity",
|
|
375
|
+
"contact",
|
|
376
|
+
"load_balancer",
|
|
377
|
+
"timeout",
|
|
378
|
+
]
|
|
379
|
+
)
|
|
380
|
+
serialized = handler(self)
|
|
381
|
+
m = {}
|
|
382
|
+
|
|
383
|
+
for n, f in type(self).model_fields.items():
|
|
384
|
+
k = f.alias or n
|
|
385
|
+
val = serialized.get(k)
|
|
386
|
+
|
|
387
|
+
if val != UNSET_SENTINEL:
|
|
388
|
+
if val is not None or k not in optional_fields:
|
|
389
|
+
m[k] = val
|
|
390
|
+
|
|
391
|
+
return m
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
class CreateRerankRequestBodyTypedDict(TypedDict):
|
|
395
|
+
r"""input"""
|
|
396
|
+
|
|
397
|
+
query: str
|
|
398
|
+
r"""The search query"""
|
|
399
|
+
documents: List[str]
|
|
400
|
+
r"""A list of texts that will be compared to the `query`. For optimal performance we recommend against sending more than 1,000 documents in a single request."""
|
|
401
|
+
model: str
|
|
402
|
+
r"""The identifier of the model to use"""
|
|
403
|
+
top_n: NotRequired[float]
|
|
404
|
+
r"""The number of most relevant documents or indices to return, defaults to the length of the documents"""
|
|
405
|
+
filename: NotRequired[Nullable[str]]
|
|
406
|
+
r"""The filename of the document to rerank"""
|
|
407
|
+
name: NotRequired[str]
|
|
408
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
409
|
+
fallbacks: NotRequired[List[CreateRerankFallbacksTypedDict]]
|
|
410
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
411
|
+
retry: NotRequired[CreateRerankRetryTypedDict]
|
|
412
|
+
r"""Retry configuration for the request"""
|
|
413
|
+
cache: NotRequired[CreateRerankCacheTypedDict]
|
|
414
|
+
r"""Cache configuration for the request."""
|
|
415
|
+
load_balancer: NotRequired[CreateRerankLoadBalancerTypedDict]
|
|
416
|
+
r"""Load balancer configuration for the request."""
|
|
417
|
+
timeout: NotRequired[CreateRerankTimeoutTypedDict]
|
|
418
|
+
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."""
|
|
419
|
+
orq: NotRequired[CreateRerankOrqTypedDict]
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
class CreateRerankRequestBody(BaseModel):
|
|
423
|
+
r"""input"""
|
|
424
|
+
|
|
425
|
+
query: str
|
|
426
|
+
r"""The search query"""
|
|
427
|
+
|
|
428
|
+
documents: List[str]
|
|
429
|
+
r"""A list of texts that will be compared to the `query`. For optimal performance we recommend against sending more than 1,000 documents in a single request."""
|
|
430
|
+
|
|
431
|
+
model: str
|
|
432
|
+
r"""The identifier of the model to use"""
|
|
433
|
+
|
|
434
|
+
top_n: Optional[float] = None
|
|
435
|
+
r"""The number of most relevant documents or indices to return, defaults to the length of the documents"""
|
|
436
|
+
|
|
437
|
+
filename: OptionalNullable[str] = UNSET
|
|
438
|
+
r"""The filename of the document to rerank"""
|
|
439
|
+
|
|
440
|
+
name: Optional[str] = None
|
|
441
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
442
|
+
|
|
443
|
+
fallbacks: Optional[List[CreateRerankFallbacks]] = None
|
|
444
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
445
|
+
|
|
446
|
+
retry: Optional[CreateRerankRetry] = None
|
|
447
|
+
r"""Retry configuration for the request"""
|
|
448
|
+
|
|
449
|
+
cache: Optional[CreateRerankCache] = None
|
|
450
|
+
r"""Cache configuration for the request."""
|
|
451
|
+
|
|
452
|
+
load_balancer: Optional[CreateRerankLoadBalancer] = None
|
|
453
|
+
r"""Load balancer configuration for the request."""
|
|
454
|
+
|
|
455
|
+
timeout: Optional[CreateRerankTimeout] = None
|
|
456
|
+
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."""
|
|
457
|
+
|
|
458
|
+
orq: Optional[CreateRerankOrq] = None
|
|
459
|
+
|
|
460
|
+
@model_serializer(mode="wrap")
|
|
461
|
+
def serialize_model(self, handler):
|
|
462
|
+
optional_fields = set(
|
|
463
|
+
[
|
|
464
|
+
"top_n",
|
|
465
|
+
"filename",
|
|
466
|
+
"name",
|
|
467
|
+
"fallbacks",
|
|
468
|
+
"retry",
|
|
469
|
+
"cache",
|
|
470
|
+
"load_balancer",
|
|
471
|
+
"timeout",
|
|
472
|
+
"orq",
|
|
473
|
+
]
|
|
474
|
+
)
|
|
475
|
+
nullable_fields = set(["filename"])
|
|
476
|
+
serialized = handler(self)
|
|
477
|
+
m = {}
|
|
478
|
+
|
|
479
|
+
for n, f in type(self).model_fields.items():
|
|
480
|
+
k = f.alias or n
|
|
481
|
+
val = serialized.get(k)
|
|
482
|
+
is_nullable_and_explicitly_set = (
|
|
483
|
+
k in nullable_fields
|
|
484
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
if val != UNSET_SENTINEL:
|
|
488
|
+
if (
|
|
489
|
+
val is not None
|
|
490
|
+
or k not in optional_fields
|
|
491
|
+
or is_nullable_and_explicitly_set
|
|
492
|
+
):
|
|
493
|
+
m[k] = val
|
|
494
|
+
|
|
495
|
+
return m
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
CreateRerankObject = Literal["list",]
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
CreateRerankRouterRerankObject = Literal["rerank",]
|
|
502
|
+
r"""The object type, which is always `rerank`."""
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
class CreateRerankDocumentTypedDict(TypedDict):
|
|
506
|
+
r"""If return_documents is set as false this will return none, if true it will return the documents passed in"""
|
|
507
|
+
|
|
508
|
+
text: str
|
|
509
|
+
r"""The text of the document to rerank"""
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
class CreateRerankDocument(BaseModel):
|
|
513
|
+
r"""If return_documents is set as false this will return none, if true it will return the documents passed in"""
|
|
514
|
+
|
|
515
|
+
text: str
|
|
516
|
+
r"""The text of the document to rerank"""
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
class CreateRerankResultsTypedDict(TypedDict):
|
|
520
|
+
object: CreateRerankRouterRerankObject
|
|
521
|
+
r"""The object type, which is always `rerank`."""
|
|
522
|
+
index: float
|
|
523
|
+
r"""Corresponds to the index in the original list of documents to which the ranked document belongs."""
|
|
524
|
+
relevance_score: float
|
|
525
|
+
r"""Relevance scores are normalized to be in the range [0, 1]. Scores close to 1 indicate a high relevance to the query, and scores closer to 0 indicate low relevance."""
|
|
526
|
+
document: NotRequired[CreateRerankDocumentTypedDict]
|
|
527
|
+
r"""If return_documents is set as false this will return none, if true it will return the documents passed in"""
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
class CreateRerankResults(BaseModel):
|
|
531
|
+
object: CreateRerankRouterRerankObject
|
|
532
|
+
r"""The object type, which is always `rerank`."""
|
|
533
|
+
|
|
534
|
+
index: float
|
|
535
|
+
r"""Corresponds to the index in the original list of documents to which the ranked document belongs."""
|
|
536
|
+
|
|
537
|
+
relevance_score: float
|
|
538
|
+
r"""Relevance scores are normalized to be in the range [0, 1]. Scores close to 1 indicate a high relevance to the query, and scores closer to 0 indicate low relevance."""
|
|
539
|
+
|
|
540
|
+
document: Optional[CreateRerankDocument] = None
|
|
541
|
+
r"""If return_documents is set as false this will return none, if true it will return the documents passed in"""
|
|
542
|
+
|
|
543
|
+
@model_serializer(mode="wrap")
|
|
544
|
+
def serialize_model(self, handler):
|
|
545
|
+
optional_fields = set(["document"])
|
|
546
|
+
serialized = handler(self)
|
|
547
|
+
m = {}
|
|
548
|
+
|
|
549
|
+
for n, f in type(self).model_fields.items():
|
|
550
|
+
k = f.alias or n
|
|
551
|
+
val = serialized.get(k)
|
|
552
|
+
|
|
553
|
+
if val != UNSET_SENTINEL:
|
|
554
|
+
if val is not None or k not in optional_fields:
|
|
555
|
+
m[k] = val
|
|
556
|
+
|
|
557
|
+
return m
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
class CreateRerankUsageTypedDict(TypedDict):
|
|
561
|
+
total_tokens: float
|
|
562
|
+
r"""The total number of tokens used in the rerank"""
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
class CreateRerankUsage(BaseModel):
|
|
566
|
+
total_tokens: float
|
|
567
|
+
r"""The total number of tokens used in the rerank"""
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
class CreateRerankResponseBodyTypedDict(TypedDict):
|
|
571
|
+
r"""Returns the reranked documents."""
|
|
572
|
+
|
|
573
|
+
object: CreateRerankObject
|
|
574
|
+
results: List[CreateRerankResultsTypedDict]
|
|
575
|
+
r"""An ordered list of ranked documents"""
|
|
576
|
+
id: NotRequired[str]
|
|
577
|
+
r"""A unique identifier for the rerank."""
|
|
578
|
+
usage: NotRequired[CreateRerankUsageTypedDict]
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
class CreateRerankResponseBody(BaseModel):
|
|
582
|
+
r"""Returns the reranked documents."""
|
|
583
|
+
|
|
584
|
+
object: CreateRerankObject
|
|
585
|
+
|
|
586
|
+
results: List[CreateRerankResults]
|
|
587
|
+
r"""An ordered list of ranked documents"""
|
|
588
|
+
|
|
589
|
+
id: Optional[str] = None
|
|
590
|
+
r"""A unique identifier for the rerank."""
|
|
591
|
+
|
|
592
|
+
usage: Optional[CreateRerankUsage] = None
|
|
593
|
+
|
|
594
|
+
@model_serializer(mode="wrap")
|
|
595
|
+
def serialize_model(self, handler):
|
|
596
|
+
optional_fields = set(["id", "usage"])
|
|
597
|
+
serialized = handler(self)
|
|
598
|
+
m = {}
|
|
599
|
+
|
|
600
|
+
for n, f in type(self).model_fields.items():
|
|
601
|
+
k = f.alias or n
|
|
602
|
+
val = serialized.get(k)
|
|
603
|
+
|
|
604
|
+
if val != UNSET_SENTINEL:
|
|
605
|
+
if val is not None or k not in optional_fields:
|
|
606
|
+
m[k] = val
|
|
607
|
+
|
|
608
|
+
return m
|