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
|
@@ -10,6 +10,7 @@ from .imagecontentpartschema import (
|
|
|
10
10
|
ImageContentPartSchema,
|
|
11
11
|
ImageContentPartSchemaTypedDict,
|
|
12
12
|
)
|
|
13
|
+
from .publicidentity import PublicIdentity, PublicIdentityTypedDict
|
|
13
14
|
from .reasoningpartschema import ReasoningPartSchema, ReasoningPartSchemaTypedDict
|
|
14
15
|
from .redactedreasoningpartschema import (
|
|
15
16
|
RedactedReasoningPartSchema,
|
|
@@ -98,6 +99,22 @@ class PrefixMessagesCacheControl(BaseModel):
|
|
|
98
99
|
Defaults to `5m`. Only supported by `Anthropic` Claude models.
|
|
99
100
|
"""
|
|
100
101
|
|
|
102
|
+
@model_serializer(mode="wrap")
|
|
103
|
+
def serialize_model(self, handler):
|
|
104
|
+
optional_fields = set(["ttl"])
|
|
105
|
+
serialized = handler(self)
|
|
106
|
+
m = {}
|
|
107
|
+
|
|
108
|
+
for n, f in type(self).model_fields.items():
|
|
109
|
+
k = f.alias or n
|
|
110
|
+
val = serialized.get(k)
|
|
111
|
+
|
|
112
|
+
if val != UNSET_SENTINEL:
|
|
113
|
+
if val is not None or k not in optional_fields:
|
|
114
|
+
m[k] = val
|
|
115
|
+
|
|
116
|
+
return m
|
|
117
|
+
|
|
101
118
|
|
|
102
119
|
class ToolMessageTypedDict(TypedDict):
|
|
103
120
|
role: InvokeDeploymentRequestPrefixMessages5Role
|
|
@@ -123,31 +140,26 @@ class ToolMessage(BaseModel):
|
|
|
123
140
|
|
|
124
141
|
@model_serializer(mode="wrap")
|
|
125
142
|
def serialize_model(self, handler):
|
|
126
|
-
optional_fields = ["cache_control"]
|
|
127
|
-
nullable_fields = ["tool_call_id"]
|
|
128
|
-
null_default_fields = []
|
|
129
|
-
|
|
143
|
+
optional_fields = set(["cache_control"])
|
|
144
|
+
nullable_fields = set(["tool_call_id"])
|
|
130
145
|
serialized = handler(self)
|
|
131
|
-
|
|
132
146
|
m = {}
|
|
133
147
|
|
|
134
148
|
for n, f in type(self).model_fields.items():
|
|
135
149
|
k = f.alias or n
|
|
136
150
|
val = serialized.get(k)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
):
|
|
150
|
-
m[k] = val
|
|
151
|
+
is_nullable_and_explicitly_set = (
|
|
152
|
+
k in nullable_fields
|
|
153
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
if val != UNSET_SENTINEL:
|
|
157
|
+
if (
|
|
158
|
+
val is not None
|
|
159
|
+
or k not in optional_fields
|
|
160
|
+
or is_nullable_and_explicitly_set
|
|
161
|
+
):
|
|
162
|
+
m[k] = val
|
|
151
163
|
|
|
152
164
|
return m
|
|
153
165
|
|
|
@@ -191,14 +203,14 @@ InvokeDeploymentRequestPrefixMessages4Role = Literal["assistant",]
|
|
|
191
203
|
r"""The role of the messages author, in this case `assistant`."""
|
|
192
204
|
|
|
193
205
|
|
|
194
|
-
class
|
|
206
|
+
class AudioModelTypedDict(TypedDict):
|
|
195
207
|
r"""Data about a previous audio response from the model."""
|
|
196
208
|
|
|
197
209
|
id: str
|
|
198
210
|
r"""Unique identifier for a previous audio response from the model."""
|
|
199
211
|
|
|
200
212
|
|
|
201
|
-
class
|
|
213
|
+
class AudioModel(BaseModel):
|
|
202
214
|
r"""Data about a previous audio response from the model."""
|
|
203
215
|
|
|
204
216
|
id: str
|
|
@@ -223,6 +235,22 @@ class PrefixMessagesFunction(BaseModel):
|
|
|
223
235
|
arguments: Optional[str] = None
|
|
224
236
|
r"""The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."""
|
|
225
237
|
|
|
238
|
+
@model_serializer(mode="wrap")
|
|
239
|
+
def serialize_model(self, handler):
|
|
240
|
+
optional_fields = set(["name", "arguments"])
|
|
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
|
+
|
|
226
254
|
|
|
227
255
|
class ToolCallsTypedDict(TypedDict):
|
|
228
256
|
id: str
|
|
@@ -246,6 +274,22 @@ class ToolCalls(BaseModel):
|
|
|
246
274
|
thought_signature: Optional[str] = None
|
|
247
275
|
r"""Encrypted representation of the model internal reasoning state during function calling. Required by Gemini 3 models when continuing a conversation after a tool call."""
|
|
248
276
|
|
|
277
|
+
@model_serializer(mode="wrap")
|
|
278
|
+
def serialize_model(self, handler):
|
|
279
|
+
optional_fields = set(["thought_signature"])
|
|
280
|
+
serialized = handler(self)
|
|
281
|
+
m = {}
|
|
282
|
+
|
|
283
|
+
for n, f in type(self).model_fields.items():
|
|
284
|
+
k = f.alias or n
|
|
285
|
+
val = serialized.get(k)
|
|
286
|
+
|
|
287
|
+
if val != UNSET_SENTINEL:
|
|
288
|
+
if val is not None or k not in optional_fields:
|
|
289
|
+
m[k] = val
|
|
290
|
+
|
|
291
|
+
return m
|
|
292
|
+
|
|
249
293
|
|
|
250
294
|
class AssistantMessageTypedDict(TypedDict):
|
|
251
295
|
role: InvokeDeploymentRequestPrefixMessages4Role
|
|
@@ -258,7 +302,7 @@ class AssistantMessageTypedDict(TypedDict):
|
|
|
258
302
|
r"""The refusal message by the assistant."""
|
|
259
303
|
name: NotRequired[str]
|
|
260
304
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
261
|
-
audio: NotRequired[Nullable[
|
|
305
|
+
audio: NotRequired[Nullable[AudioModelTypedDict]]
|
|
262
306
|
r"""Data about a previous audio response from the model."""
|
|
263
307
|
tool_calls: NotRequired[List[ToolCallsTypedDict]]
|
|
264
308
|
r"""The tool calls generated by the model, such as function calls."""
|
|
@@ -277,7 +321,7 @@ class AssistantMessage(BaseModel):
|
|
|
277
321
|
name: Optional[str] = None
|
|
278
322
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
279
323
|
|
|
280
|
-
audio: OptionalNullable[
|
|
324
|
+
audio: OptionalNullable[AudioModel] = UNSET
|
|
281
325
|
r"""Data about a previous audio response from the model."""
|
|
282
326
|
|
|
283
327
|
tool_calls: Optional[List[ToolCalls]] = None
|
|
@@ -285,31 +329,26 @@ class AssistantMessage(BaseModel):
|
|
|
285
329
|
|
|
286
330
|
@model_serializer(mode="wrap")
|
|
287
331
|
def serialize_model(self, handler):
|
|
288
|
-
optional_fields = ["content", "refusal", "name", "audio", "tool_calls"]
|
|
289
|
-
nullable_fields = ["content", "refusal", "audio"]
|
|
290
|
-
null_default_fields = []
|
|
291
|
-
|
|
332
|
+
optional_fields = set(["content", "refusal", "name", "audio", "tool_calls"])
|
|
333
|
+
nullable_fields = set(["content", "refusal", "audio"])
|
|
292
334
|
serialized = handler(self)
|
|
293
|
-
|
|
294
335
|
m = {}
|
|
295
336
|
|
|
296
337
|
for n, f in type(self).model_fields.items():
|
|
297
338
|
k = f.alias or n
|
|
298
339
|
val = serialized.get(k)
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
):
|
|
312
|
-
m[k] = val
|
|
340
|
+
is_nullable_and_explicitly_set = (
|
|
341
|
+
k in nullable_fields
|
|
342
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
if val != UNSET_SENTINEL:
|
|
346
|
+
if (
|
|
347
|
+
val is not None
|
|
348
|
+
or k not in optional_fields
|
|
349
|
+
or is_nullable_and_explicitly_set
|
|
350
|
+
):
|
|
351
|
+
m[k] = val
|
|
313
352
|
|
|
314
353
|
return m
|
|
315
354
|
|
|
@@ -365,6 +404,22 @@ class TwoCacheControl(BaseModel):
|
|
|
365
404
|
Defaults to `5m`. Only supported by `Anthropic` Claude models.
|
|
366
405
|
"""
|
|
367
406
|
|
|
407
|
+
@model_serializer(mode="wrap")
|
|
408
|
+
def serialize_model(self, handler):
|
|
409
|
+
optional_fields = set(["ttl"])
|
|
410
|
+
serialized = handler(self)
|
|
411
|
+
m = {}
|
|
412
|
+
|
|
413
|
+
for n, f in type(self).model_fields.items():
|
|
414
|
+
k = f.alias or n
|
|
415
|
+
val = serialized.get(k)
|
|
416
|
+
|
|
417
|
+
if val != UNSET_SENTINEL:
|
|
418
|
+
if val is not None or k not in optional_fields:
|
|
419
|
+
m[k] = val
|
|
420
|
+
|
|
421
|
+
return m
|
|
422
|
+
|
|
368
423
|
|
|
369
424
|
class FourTypedDict(TypedDict):
|
|
370
425
|
type: TwoType
|
|
@@ -383,6 +438,22 @@ class Four(BaseModel):
|
|
|
383
438
|
|
|
384
439
|
cache_control: Optional[TwoCacheControl] = None
|
|
385
440
|
|
|
441
|
+
@model_serializer(mode="wrap")
|
|
442
|
+
def serialize_model(self, handler):
|
|
443
|
+
optional_fields = set(["cache_control"])
|
|
444
|
+
serialized = handler(self)
|
|
445
|
+
m = {}
|
|
446
|
+
|
|
447
|
+
for n, f in type(self).model_fields.items():
|
|
448
|
+
k = f.alias or n
|
|
449
|
+
val = serialized.get(k)
|
|
450
|
+
|
|
451
|
+
if val != UNSET_SENTINEL:
|
|
452
|
+
if val is not None or k not in optional_fields:
|
|
453
|
+
m[k] = val
|
|
454
|
+
|
|
455
|
+
return m
|
|
456
|
+
|
|
386
457
|
|
|
387
458
|
TwoTypedDict = TypeAliasType(
|
|
388
459
|
"TwoTypedDict",
|
|
@@ -438,6 +509,22 @@ class UserMessage(BaseModel):
|
|
|
438
509
|
name: Optional[str] = None
|
|
439
510
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
440
511
|
|
|
512
|
+
@model_serializer(mode="wrap")
|
|
513
|
+
def serialize_model(self, handler):
|
|
514
|
+
optional_fields = set(["name"])
|
|
515
|
+
serialized = handler(self)
|
|
516
|
+
m = {}
|
|
517
|
+
|
|
518
|
+
for n, f in type(self).model_fields.items():
|
|
519
|
+
k = f.alias or n
|
|
520
|
+
val = serialized.get(k)
|
|
521
|
+
|
|
522
|
+
if val != UNSET_SENTINEL:
|
|
523
|
+
if val is not None or k not in optional_fields:
|
|
524
|
+
m[k] = val
|
|
525
|
+
|
|
526
|
+
return m
|
|
527
|
+
|
|
441
528
|
|
|
442
529
|
PrefixMessagesRole = Literal["developer",]
|
|
443
530
|
r"""The role of the messages author, in this case `developer`."""
|
|
@@ -474,6 +561,22 @@ class DeveloperMessage(BaseModel):
|
|
|
474
561
|
name: Optional[str] = None
|
|
475
562
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
476
563
|
|
|
564
|
+
@model_serializer(mode="wrap")
|
|
565
|
+
def serialize_model(self, handler):
|
|
566
|
+
optional_fields = set(["name"])
|
|
567
|
+
serialized = handler(self)
|
|
568
|
+
m = {}
|
|
569
|
+
|
|
570
|
+
for n, f in type(self).model_fields.items():
|
|
571
|
+
k = f.alias or n
|
|
572
|
+
val = serialized.get(k)
|
|
573
|
+
|
|
574
|
+
if val != UNSET_SENTINEL:
|
|
575
|
+
if val is not None or k not in optional_fields:
|
|
576
|
+
m[k] = val
|
|
577
|
+
|
|
578
|
+
return m
|
|
579
|
+
|
|
477
580
|
|
|
478
581
|
InvokeDeploymentRequestPrefixMessages1Role = Literal["system",]
|
|
479
582
|
r"""The role of the messages author, in this case `system`."""
|
|
@@ -512,6 +615,22 @@ class SystemMessage(BaseModel):
|
|
|
512
615
|
name: Optional[str] = None
|
|
513
616
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
514
617
|
|
|
618
|
+
@model_serializer(mode="wrap")
|
|
619
|
+
def serialize_model(self, handler):
|
|
620
|
+
optional_fields = set(["name"])
|
|
621
|
+
serialized = handler(self)
|
|
622
|
+
m = {}
|
|
623
|
+
|
|
624
|
+
for n, f in type(self).model_fields.items():
|
|
625
|
+
k = f.alias or n
|
|
626
|
+
val = serialized.get(k)
|
|
627
|
+
|
|
628
|
+
if val != UNSET_SENTINEL:
|
|
629
|
+
if val is not None or k not in optional_fields:
|
|
630
|
+
m[k] = val
|
|
631
|
+
|
|
632
|
+
return m
|
|
633
|
+
|
|
515
634
|
|
|
516
635
|
PrefixMessagesTypedDict = TypeAliasType(
|
|
517
636
|
"PrefixMessagesTypedDict",
|
|
@@ -604,6 +723,22 @@ class MessagesCacheControl(BaseModel):
|
|
|
604
723
|
Defaults to `5m`. Only supported by `Anthropic` Claude models.
|
|
605
724
|
"""
|
|
606
725
|
|
|
726
|
+
@model_serializer(mode="wrap")
|
|
727
|
+
def serialize_model(self, handler):
|
|
728
|
+
optional_fields = set(["ttl"])
|
|
729
|
+
serialized = handler(self)
|
|
730
|
+
m = {}
|
|
731
|
+
|
|
732
|
+
for n, f in type(self).model_fields.items():
|
|
733
|
+
k = f.alias or n
|
|
734
|
+
val = serialized.get(k)
|
|
735
|
+
|
|
736
|
+
if val != UNSET_SENTINEL:
|
|
737
|
+
if val is not None or k not in optional_fields:
|
|
738
|
+
m[k] = val
|
|
739
|
+
|
|
740
|
+
return m
|
|
741
|
+
|
|
607
742
|
|
|
608
743
|
class MessagesToolMessageTypedDict(TypedDict):
|
|
609
744
|
role: InvokeDeploymentRequestMessages5Role
|
|
@@ -629,31 +764,26 @@ class MessagesToolMessage(BaseModel):
|
|
|
629
764
|
|
|
630
765
|
@model_serializer(mode="wrap")
|
|
631
766
|
def serialize_model(self, handler):
|
|
632
|
-
optional_fields = ["cache_control"]
|
|
633
|
-
nullable_fields = ["tool_call_id"]
|
|
634
|
-
null_default_fields = []
|
|
635
|
-
|
|
767
|
+
optional_fields = set(["cache_control"])
|
|
768
|
+
nullable_fields = set(["tool_call_id"])
|
|
636
769
|
serialized = handler(self)
|
|
637
|
-
|
|
638
770
|
m = {}
|
|
639
771
|
|
|
640
772
|
for n, f in type(self).model_fields.items():
|
|
641
773
|
k = f.alias or n
|
|
642
774
|
val = serialized.get(k)
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
):
|
|
656
|
-
m[k] = val
|
|
775
|
+
is_nullable_and_explicitly_set = (
|
|
776
|
+
k in nullable_fields
|
|
777
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
778
|
+
)
|
|
779
|
+
|
|
780
|
+
if val != UNSET_SENTINEL:
|
|
781
|
+
if (
|
|
782
|
+
val is not None
|
|
783
|
+
or k not in optional_fields
|
|
784
|
+
or is_nullable_and_explicitly_set
|
|
785
|
+
):
|
|
786
|
+
m[k] = val
|
|
657
787
|
|
|
658
788
|
return m
|
|
659
789
|
|
|
@@ -730,6 +860,22 @@ class MessagesFunction(BaseModel):
|
|
|
730
860
|
arguments: Optional[str] = None
|
|
731
861
|
r"""The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."""
|
|
732
862
|
|
|
863
|
+
@model_serializer(mode="wrap")
|
|
864
|
+
def serialize_model(self, handler):
|
|
865
|
+
optional_fields = set(["name", "arguments"])
|
|
866
|
+
serialized = handler(self)
|
|
867
|
+
m = {}
|
|
868
|
+
|
|
869
|
+
for n, f in type(self).model_fields.items():
|
|
870
|
+
k = f.alias or n
|
|
871
|
+
val = serialized.get(k)
|
|
872
|
+
|
|
873
|
+
if val != UNSET_SENTINEL:
|
|
874
|
+
if val is not None or k not in optional_fields:
|
|
875
|
+
m[k] = val
|
|
876
|
+
|
|
877
|
+
return m
|
|
878
|
+
|
|
733
879
|
|
|
734
880
|
class MessagesToolCallsTypedDict(TypedDict):
|
|
735
881
|
id: str
|
|
@@ -753,6 +899,22 @@ class MessagesToolCalls(BaseModel):
|
|
|
753
899
|
thought_signature: Optional[str] = None
|
|
754
900
|
r"""Encrypted representation of the model internal reasoning state during function calling. Required by Gemini 3 models when continuing a conversation after a tool call."""
|
|
755
901
|
|
|
902
|
+
@model_serializer(mode="wrap")
|
|
903
|
+
def serialize_model(self, handler):
|
|
904
|
+
optional_fields = set(["thought_signature"])
|
|
905
|
+
serialized = handler(self)
|
|
906
|
+
m = {}
|
|
907
|
+
|
|
908
|
+
for n, f in type(self).model_fields.items():
|
|
909
|
+
k = f.alias or n
|
|
910
|
+
val = serialized.get(k)
|
|
911
|
+
|
|
912
|
+
if val != UNSET_SENTINEL:
|
|
913
|
+
if val is not None or k not in optional_fields:
|
|
914
|
+
m[k] = val
|
|
915
|
+
|
|
916
|
+
return m
|
|
917
|
+
|
|
756
918
|
|
|
757
919
|
class MessagesAssistantMessageTypedDict(TypedDict):
|
|
758
920
|
role: InvokeDeploymentRequestMessages4Role
|
|
@@ -790,31 +952,26 @@ class MessagesAssistantMessage(BaseModel):
|
|
|
790
952
|
|
|
791
953
|
@model_serializer(mode="wrap")
|
|
792
954
|
def serialize_model(self, handler):
|
|
793
|
-
optional_fields = ["content", "refusal", "name", "audio", "tool_calls"]
|
|
794
|
-
nullable_fields = ["content", "refusal", "audio"]
|
|
795
|
-
null_default_fields = []
|
|
796
|
-
|
|
955
|
+
optional_fields = set(["content", "refusal", "name", "audio", "tool_calls"])
|
|
956
|
+
nullable_fields = set(["content", "refusal", "audio"])
|
|
797
957
|
serialized = handler(self)
|
|
798
|
-
|
|
799
958
|
m = {}
|
|
800
959
|
|
|
801
960
|
for n, f in type(self).model_fields.items():
|
|
802
961
|
k = f.alias or n
|
|
803
962
|
val = serialized.get(k)
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
):
|
|
817
|
-
m[k] = val
|
|
963
|
+
is_nullable_and_explicitly_set = (
|
|
964
|
+
k in nullable_fields
|
|
965
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
966
|
+
)
|
|
967
|
+
|
|
968
|
+
if val != UNSET_SENTINEL:
|
|
969
|
+
if (
|
|
970
|
+
val is not None
|
|
971
|
+
or k not in optional_fields
|
|
972
|
+
or is_nullable_and_explicitly_set
|
|
973
|
+
):
|
|
974
|
+
m[k] = val
|
|
818
975
|
|
|
819
976
|
return m
|
|
820
977
|
|
|
@@ -870,6 +1027,22 @@ class InvokeDeploymentRequest2CacheControl(BaseModel):
|
|
|
870
1027
|
Defaults to `5m`. Only supported by `Anthropic` Claude models.
|
|
871
1028
|
"""
|
|
872
1029
|
|
|
1030
|
+
@model_serializer(mode="wrap")
|
|
1031
|
+
def serialize_model(self, handler):
|
|
1032
|
+
optional_fields = set(["ttl"])
|
|
1033
|
+
serialized = handler(self)
|
|
1034
|
+
m = {}
|
|
1035
|
+
|
|
1036
|
+
for n, f in type(self).model_fields.items():
|
|
1037
|
+
k = f.alias or n
|
|
1038
|
+
val = serialized.get(k)
|
|
1039
|
+
|
|
1040
|
+
if val != UNSET_SENTINEL:
|
|
1041
|
+
if val is not None or k not in optional_fields:
|
|
1042
|
+
m[k] = val
|
|
1043
|
+
|
|
1044
|
+
return m
|
|
1045
|
+
|
|
873
1046
|
|
|
874
1047
|
class Two4TypedDict(TypedDict):
|
|
875
1048
|
type: InvokeDeploymentRequest2Type
|
|
@@ -888,6 +1061,22 @@ class Two4(BaseModel):
|
|
|
888
1061
|
|
|
889
1062
|
cache_control: Optional[InvokeDeploymentRequest2CacheControl] = None
|
|
890
1063
|
|
|
1064
|
+
@model_serializer(mode="wrap")
|
|
1065
|
+
def serialize_model(self, handler):
|
|
1066
|
+
optional_fields = set(["cache_control"])
|
|
1067
|
+
serialized = handler(self)
|
|
1068
|
+
m = {}
|
|
1069
|
+
|
|
1070
|
+
for n, f in type(self).model_fields.items():
|
|
1071
|
+
k = f.alias or n
|
|
1072
|
+
val = serialized.get(k)
|
|
1073
|
+
|
|
1074
|
+
if val != UNSET_SENTINEL:
|
|
1075
|
+
if val is not None or k not in optional_fields:
|
|
1076
|
+
m[k] = val
|
|
1077
|
+
|
|
1078
|
+
return m
|
|
1079
|
+
|
|
891
1080
|
|
|
892
1081
|
InvokeDeploymentRequestContentMessages2TypedDict = TypeAliasType(
|
|
893
1082
|
"InvokeDeploymentRequestContentMessages2TypedDict",
|
|
@@ -944,6 +1133,22 @@ class MessagesUserMessage(BaseModel):
|
|
|
944
1133
|
name: Optional[str] = None
|
|
945
1134
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
946
1135
|
|
|
1136
|
+
@model_serializer(mode="wrap")
|
|
1137
|
+
def serialize_model(self, handler):
|
|
1138
|
+
optional_fields = set(["name"])
|
|
1139
|
+
serialized = handler(self)
|
|
1140
|
+
m = {}
|
|
1141
|
+
|
|
1142
|
+
for n, f in type(self).model_fields.items():
|
|
1143
|
+
k = f.alias or n
|
|
1144
|
+
val = serialized.get(k)
|
|
1145
|
+
|
|
1146
|
+
if val != UNSET_SENTINEL:
|
|
1147
|
+
if val is not None or k not in optional_fields:
|
|
1148
|
+
m[k] = val
|
|
1149
|
+
|
|
1150
|
+
return m
|
|
1151
|
+
|
|
947
1152
|
|
|
948
1153
|
InvokeDeploymentRequestMessagesRole = Literal["developer",]
|
|
949
1154
|
r"""The role of the messages author, in this case `developer`."""
|
|
@@ -981,6 +1186,22 @@ class MessagesDeveloperMessage(BaseModel):
|
|
|
981
1186
|
name: Optional[str] = None
|
|
982
1187
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
983
1188
|
|
|
1189
|
+
@model_serializer(mode="wrap")
|
|
1190
|
+
def serialize_model(self, handler):
|
|
1191
|
+
optional_fields = set(["name"])
|
|
1192
|
+
serialized = handler(self)
|
|
1193
|
+
m = {}
|
|
1194
|
+
|
|
1195
|
+
for n, f in type(self).model_fields.items():
|
|
1196
|
+
k = f.alias or n
|
|
1197
|
+
val = serialized.get(k)
|
|
1198
|
+
|
|
1199
|
+
if val != UNSET_SENTINEL:
|
|
1200
|
+
if val is not None or k not in optional_fields:
|
|
1201
|
+
m[k] = val
|
|
1202
|
+
|
|
1203
|
+
return m
|
|
1204
|
+
|
|
984
1205
|
|
|
985
1206
|
MessagesRole = Literal["system",]
|
|
986
1207
|
r"""The role of the messages author, in this case `system`."""
|
|
@@ -1021,6 +1242,22 @@ class MessagesSystemMessage(BaseModel):
|
|
|
1021
1242
|
name: Optional[str] = None
|
|
1022
1243
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
1023
1244
|
|
|
1245
|
+
@model_serializer(mode="wrap")
|
|
1246
|
+
def serialize_model(self, handler):
|
|
1247
|
+
optional_fields = set(["name"])
|
|
1248
|
+
serialized = handler(self)
|
|
1249
|
+
m = {}
|
|
1250
|
+
|
|
1251
|
+
for n, f in type(self).model_fields.items():
|
|
1252
|
+
k = f.alias or n
|
|
1253
|
+
val = serialized.get(k)
|
|
1254
|
+
|
|
1255
|
+
if val != UNSET_SENTINEL:
|
|
1256
|
+
if val is not None or k not in optional_fields:
|
|
1257
|
+
m[k] = val
|
|
1258
|
+
|
|
1259
|
+
return m
|
|
1260
|
+
|
|
1024
1261
|
|
|
1025
1262
|
MessagesTypedDict = TypeAliasType(
|
|
1026
1263
|
"MessagesTypedDict",
|
|
@@ -1069,6 +1306,22 @@ class InvokeDeploymentRequestMetadata(BaseModel):
|
|
|
1069
1306
|
page_number: Optional[float] = None
|
|
1070
1307
|
r"""The page number the text is from."""
|
|
1071
1308
|
|
|
1309
|
+
@model_serializer(mode="wrap")
|
|
1310
|
+
def serialize_model(self, handler):
|
|
1311
|
+
optional_fields = set(["file_name", "file_type", "page_number"])
|
|
1312
|
+
serialized = handler(self)
|
|
1313
|
+
m = {}
|
|
1314
|
+
|
|
1315
|
+
for n, f in type(self).model_fields.items():
|
|
1316
|
+
k = f.alias or n
|
|
1317
|
+
val = serialized.get(k)
|
|
1318
|
+
|
|
1319
|
+
if val != UNSET_SENTINEL:
|
|
1320
|
+
if val is not None or k not in optional_fields:
|
|
1321
|
+
m[k] = val
|
|
1322
|
+
|
|
1323
|
+
return m
|
|
1324
|
+
|
|
1072
1325
|
|
|
1073
1326
|
class DocumentsTypedDict(TypedDict):
|
|
1074
1327
|
text: str
|
|
@@ -1084,6 +1337,22 @@ class Documents(BaseModel):
|
|
|
1084
1337
|
metadata: Optional[InvokeDeploymentRequestMetadata] = None
|
|
1085
1338
|
r"""Metadata about the document"""
|
|
1086
1339
|
|
|
1340
|
+
@model_serializer(mode="wrap")
|
|
1341
|
+
def serialize_model(self, handler):
|
|
1342
|
+
optional_fields = set(["metadata"])
|
|
1343
|
+
serialized = handler(self)
|
|
1344
|
+
m = {}
|
|
1345
|
+
|
|
1346
|
+
for n, f in type(self).model_fields.items():
|
|
1347
|
+
k = f.alias or n
|
|
1348
|
+
val = serialized.get(k)
|
|
1349
|
+
|
|
1350
|
+
if val != UNSET_SENTINEL:
|
|
1351
|
+
if val is not None or k not in optional_fields:
|
|
1352
|
+
m[k] = val
|
|
1353
|
+
|
|
1354
|
+
return m
|
|
1355
|
+
|
|
1087
1356
|
|
|
1088
1357
|
class InvokeOptionsTypedDict(TypedDict):
|
|
1089
1358
|
include_retrievals: NotRequired[bool]
|
|
@@ -1104,6 +1373,22 @@ class InvokeOptions(BaseModel):
|
|
|
1104
1373
|
mock_response: Optional[str] = None
|
|
1105
1374
|
r"""A mock response to use instead of calling the LLM API. This is useful for testing purposes. When provided, the system will return a response object with this content as the completion, without making an actual API call to the LLM provider. This works for both streaming and non-streaming requests. Mock responses will not generate logs, traces or be counted for your plan usage."""
|
|
1106
1375
|
|
|
1376
|
+
@model_serializer(mode="wrap")
|
|
1377
|
+
def serialize_model(self, handler):
|
|
1378
|
+
optional_fields = set(["include_retrievals", "include_usage", "mock_response"])
|
|
1379
|
+
serialized = handler(self)
|
|
1380
|
+
m = {}
|
|
1381
|
+
|
|
1382
|
+
for n, f in type(self).model_fields.items():
|
|
1383
|
+
k = f.alias or n
|
|
1384
|
+
val = serialized.get(k)
|
|
1385
|
+
|
|
1386
|
+
if val != UNSET_SENTINEL:
|
|
1387
|
+
if val is not None or k not in optional_fields:
|
|
1388
|
+
m[k] = val
|
|
1389
|
+
|
|
1390
|
+
return m
|
|
1391
|
+
|
|
1107
1392
|
|
|
1108
1393
|
class ThreadTypedDict(TypedDict):
|
|
1109
1394
|
id: str
|
|
@@ -1119,6 +1404,22 @@ class Thread(BaseModel):
|
|
|
1119
1404
|
tags: Optional[List[str]] = None
|
|
1120
1405
|
r"""Optional tags to differentiate or categorize threads"""
|
|
1121
1406
|
|
|
1407
|
+
@model_serializer(mode="wrap")
|
|
1408
|
+
def serialize_model(self, handler):
|
|
1409
|
+
optional_fields = set(["tags"])
|
|
1410
|
+
serialized = handler(self)
|
|
1411
|
+
m = {}
|
|
1412
|
+
|
|
1413
|
+
for n, f in type(self).model_fields.items():
|
|
1414
|
+
k = f.alias or n
|
|
1415
|
+
val = serialized.get(k)
|
|
1416
|
+
|
|
1417
|
+
if val != UNSET_SENTINEL:
|
|
1418
|
+
if val is not None or k not in optional_fields:
|
|
1419
|
+
m[k] = val
|
|
1420
|
+
|
|
1421
|
+
return m
|
|
1422
|
+
|
|
1122
1423
|
|
|
1123
1424
|
class OrExistsTypedDict(TypedDict):
|
|
1124
1425
|
r"""Exists"""
|
|
@@ -1653,6 +1954,8 @@ class InvokeDeploymentRequestTypedDict(TypedDict):
|
|
|
1653
1954
|
r"""A list of messages to include after the `System` message, but before the `User` and `Assistant` pairs configured in your deployment."""
|
|
1654
1955
|
messages: NotRequired[List[MessagesTypedDict]]
|
|
1655
1956
|
r"""A list of messages to send to the deployment."""
|
|
1957
|
+
identity: NotRequired[PublicIdentityTypedDict]
|
|
1958
|
+
r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
|
|
1656
1959
|
file_ids: NotRequired[List[str]]
|
|
1657
1960
|
r"""A list of file IDs that are associated with the deployment request."""
|
|
1658
1961
|
metadata: NotRequired[Dict[str, Any]]
|
|
@@ -1688,6 +1991,9 @@ class InvokeDeploymentRequest(BaseModel):
|
|
|
1688
1991
|
messages: Optional[List[Messages]] = None
|
|
1689
1992
|
r"""A list of messages to send to the deployment."""
|
|
1690
1993
|
|
|
1994
|
+
identity: Optional[PublicIdentity] = None
|
|
1995
|
+
r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
|
|
1996
|
+
|
|
1691
1997
|
file_ids: Optional[List[str]] = None
|
|
1692
1998
|
r"""A list of file IDs that are associated with the deployment request."""
|
|
1693
1999
|
|
|
@@ -1706,3 +2012,35 @@ class InvokeDeploymentRequest(BaseModel):
|
|
|
1706
2012
|
|
|
1707
2013
|
knowledge_filter: Optional[KnowledgeFilter] = None
|
|
1708
2014
|
r"""A filter to apply to the knowledge base chunk metadata when using knowledge bases in the deployment."""
|
|
2015
|
+
|
|
2016
|
+
@model_serializer(mode="wrap")
|
|
2017
|
+
def serialize_model(self, handler):
|
|
2018
|
+
optional_fields = set(
|
|
2019
|
+
[
|
|
2020
|
+
"stream",
|
|
2021
|
+
"inputs",
|
|
2022
|
+
"context",
|
|
2023
|
+
"prefix_messages",
|
|
2024
|
+
"messages",
|
|
2025
|
+
"identity",
|
|
2026
|
+
"file_ids",
|
|
2027
|
+
"metadata",
|
|
2028
|
+
"extra_params",
|
|
2029
|
+
"documents",
|
|
2030
|
+
"invoke_options",
|
|
2031
|
+
"thread",
|
|
2032
|
+
"knowledge_filter",
|
|
2033
|
+
]
|
|
2034
|
+
)
|
|
2035
|
+
serialized = handler(self)
|
|
2036
|
+
m = {}
|
|
2037
|
+
|
|
2038
|
+
for n, f in type(self).model_fields.items():
|
|
2039
|
+
k = f.alias or n
|
|
2040
|
+
val = serialized.get(k)
|
|
2041
|
+
|
|
2042
|
+
if val != UNSET_SENTINEL:
|
|
2043
|
+
if val is not None or k not in optional_fields:
|
|
2044
|
+
m[k] = val
|
|
2045
|
+
|
|
2046
|
+
return m
|