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
|
@@ -58,6 +58,22 @@ class DeploymentCreateMetricUsage(BaseModel):
|
|
|
58
58
|
total_tokens: Optional[float] = None
|
|
59
59
|
r"""Total number of tokens used in the request (prompt + completion)."""
|
|
60
60
|
|
|
61
|
+
@model_serializer(mode="wrap")
|
|
62
|
+
def serialize_model(self, handler):
|
|
63
|
+
optional_fields = set(["total_tokens"])
|
|
64
|
+
serialized = handler(self)
|
|
65
|
+
m = {}
|
|
66
|
+
|
|
67
|
+
for n, f in type(self).model_fields.items():
|
|
68
|
+
k = f.alias or n
|
|
69
|
+
val = serialized.get(k)
|
|
70
|
+
|
|
71
|
+
if val != UNSET_SENTINEL:
|
|
72
|
+
if val is not None or k not in optional_fields:
|
|
73
|
+
m[k] = val
|
|
74
|
+
|
|
75
|
+
return m
|
|
76
|
+
|
|
61
77
|
|
|
62
78
|
class PerformanceTypedDict(TypedDict):
|
|
63
79
|
latency: float
|
|
@@ -73,6 +89,22 @@ class Performance(BaseModel):
|
|
|
73
89
|
time_to_first_token: Optional[float] = None
|
|
74
90
|
r"""Total time in milliseconds to generate the first token of the completion."""
|
|
75
91
|
|
|
92
|
+
@model_serializer(mode="wrap")
|
|
93
|
+
def serialize_model(self, handler):
|
|
94
|
+
optional_fields = set(["time_to_first_token"])
|
|
95
|
+
serialized = handler(self)
|
|
96
|
+
m = {}
|
|
97
|
+
|
|
98
|
+
for n, f in type(self).model_fields.items():
|
|
99
|
+
k = f.alias or n
|
|
100
|
+
val = serialized.get(k)
|
|
101
|
+
|
|
102
|
+
if val != UNSET_SENTINEL:
|
|
103
|
+
if val is not None or k not in optional_fields:
|
|
104
|
+
m[k] = val
|
|
105
|
+
|
|
106
|
+
return m
|
|
107
|
+
|
|
76
108
|
|
|
77
109
|
DeploymentCreateMetricMessagesDeploymentsMetricsRequestRequestBody5Role = Literal[
|
|
78
110
|
"tool",
|
|
@@ -147,6 +179,22 @@ class DeploymentCreateMetricMessagesCacheControl(BaseModel):
|
|
|
147
179
|
Defaults to `5m`. Only supported by `Anthropic` Claude models.
|
|
148
180
|
"""
|
|
149
181
|
|
|
182
|
+
@model_serializer(mode="wrap")
|
|
183
|
+
def serialize_model(self, handler):
|
|
184
|
+
optional_fields = set(["ttl"])
|
|
185
|
+
serialized = handler(self)
|
|
186
|
+
m = {}
|
|
187
|
+
|
|
188
|
+
for n, f in type(self).model_fields.items():
|
|
189
|
+
k = f.alias or n
|
|
190
|
+
val = serialized.get(k)
|
|
191
|
+
|
|
192
|
+
if val != UNSET_SENTINEL:
|
|
193
|
+
if val is not None or k not in optional_fields:
|
|
194
|
+
m[k] = val
|
|
195
|
+
|
|
196
|
+
return m
|
|
197
|
+
|
|
150
198
|
|
|
151
199
|
class DeploymentCreateMetricMessagesToolMessageTypedDict(TypedDict):
|
|
152
200
|
role: DeploymentCreateMetricMessagesDeploymentsMetricsRequestRequestBody5Role
|
|
@@ -172,31 +220,26 @@ class DeploymentCreateMetricMessagesToolMessage(BaseModel):
|
|
|
172
220
|
|
|
173
221
|
@model_serializer(mode="wrap")
|
|
174
222
|
def serialize_model(self, handler):
|
|
175
|
-
optional_fields = ["cache_control"]
|
|
176
|
-
nullable_fields = ["tool_call_id"]
|
|
177
|
-
null_default_fields = []
|
|
178
|
-
|
|
223
|
+
optional_fields = set(["cache_control"])
|
|
224
|
+
nullable_fields = set(["tool_call_id"])
|
|
179
225
|
serialized = handler(self)
|
|
180
|
-
|
|
181
226
|
m = {}
|
|
182
227
|
|
|
183
228
|
for n, f in type(self).model_fields.items():
|
|
184
229
|
k = f.alias or n
|
|
185
230
|
val = serialized.get(k)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
):
|
|
199
|
-
m[k] = val
|
|
231
|
+
is_nullable_and_explicitly_set = (
|
|
232
|
+
k in nullable_fields
|
|
233
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
if val != UNSET_SENTINEL:
|
|
237
|
+
if (
|
|
238
|
+
val is not None
|
|
239
|
+
or k not in optional_fields
|
|
240
|
+
or is_nullable_and_explicitly_set
|
|
241
|
+
):
|
|
242
|
+
m[k] = val
|
|
200
243
|
|
|
201
244
|
return m
|
|
202
245
|
|
|
@@ -277,6 +320,22 @@ class DeploymentCreateMetricMessagesFunction(BaseModel):
|
|
|
277
320
|
arguments: Optional[str] = None
|
|
278
321
|
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."""
|
|
279
322
|
|
|
323
|
+
@model_serializer(mode="wrap")
|
|
324
|
+
def serialize_model(self, handler):
|
|
325
|
+
optional_fields = set(["name", "arguments"])
|
|
326
|
+
serialized = handler(self)
|
|
327
|
+
m = {}
|
|
328
|
+
|
|
329
|
+
for n, f in type(self).model_fields.items():
|
|
330
|
+
k = f.alias or n
|
|
331
|
+
val = serialized.get(k)
|
|
332
|
+
|
|
333
|
+
if val != UNSET_SENTINEL:
|
|
334
|
+
if val is not None or k not in optional_fields:
|
|
335
|
+
m[k] = val
|
|
336
|
+
|
|
337
|
+
return m
|
|
338
|
+
|
|
280
339
|
|
|
281
340
|
class DeploymentCreateMetricMessagesToolCallsTypedDict(TypedDict):
|
|
282
341
|
id: str
|
|
@@ -300,6 +359,22 @@ class DeploymentCreateMetricMessagesToolCalls(BaseModel):
|
|
|
300
359
|
thought_signature: Optional[str] = None
|
|
301
360
|
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."""
|
|
302
361
|
|
|
362
|
+
@model_serializer(mode="wrap")
|
|
363
|
+
def serialize_model(self, handler):
|
|
364
|
+
optional_fields = set(["thought_signature"])
|
|
365
|
+
serialized = handler(self)
|
|
366
|
+
m = {}
|
|
367
|
+
|
|
368
|
+
for n, f in type(self).model_fields.items():
|
|
369
|
+
k = f.alias or n
|
|
370
|
+
val = serialized.get(k)
|
|
371
|
+
|
|
372
|
+
if val != UNSET_SENTINEL:
|
|
373
|
+
if val is not None or k not in optional_fields:
|
|
374
|
+
m[k] = val
|
|
375
|
+
|
|
376
|
+
return m
|
|
377
|
+
|
|
303
378
|
|
|
304
379
|
class DeploymentCreateMetricMessagesAssistantMessageTypedDict(TypedDict):
|
|
305
380
|
role: DeploymentCreateMetricMessagesDeploymentsMetricsRequestRequestBodyRole
|
|
@@ -343,31 +418,26 @@ class DeploymentCreateMetricMessagesAssistantMessage(BaseModel):
|
|
|
343
418
|
|
|
344
419
|
@model_serializer(mode="wrap")
|
|
345
420
|
def serialize_model(self, handler):
|
|
346
|
-
optional_fields = ["content", "refusal", "name", "audio", "tool_calls"]
|
|
347
|
-
nullable_fields = ["content", "refusal", "audio"]
|
|
348
|
-
null_default_fields = []
|
|
349
|
-
|
|
421
|
+
optional_fields = set(["content", "refusal", "name", "audio", "tool_calls"])
|
|
422
|
+
nullable_fields = set(["content", "refusal", "audio"])
|
|
350
423
|
serialized = handler(self)
|
|
351
|
-
|
|
352
424
|
m = {}
|
|
353
425
|
|
|
354
426
|
for n, f in type(self).model_fields.items():
|
|
355
427
|
k = f.alias or n
|
|
356
428
|
val = serialized.get(k)
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
):
|
|
370
|
-
m[k] = val
|
|
429
|
+
is_nullable_and_explicitly_set = (
|
|
430
|
+
k in nullable_fields
|
|
431
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
if val != UNSET_SENTINEL:
|
|
435
|
+
if (
|
|
436
|
+
val is not None
|
|
437
|
+
or k not in optional_fields
|
|
438
|
+
or is_nullable_and_explicitly_set
|
|
439
|
+
):
|
|
440
|
+
m[k] = val
|
|
371
441
|
|
|
372
442
|
return m
|
|
373
443
|
|
|
@@ -423,6 +493,22 @@ class DeploymentCreateMetric2CacheControl(BaseModel):
|
|
|
423
493
|
Defaults to `5m`. Only supported by `Anthropic` Claude models.
|
|
424
494
|
"""
|
|
425
495
|
|
|
496
|
+
@model_serializer(mode="wrap")
|
|
497
|
+
def serialize_model(self, handler):
|
|
498
|
+
optional_fields = set(["ttl"])
|
|
499
|
+
serialized = handler(self)
|
|
500
|
+
m = {}
|
|
501
|
+
|
|
502
|
+
for n, f in type(self).model_fields.items():
|
|
503
|
+
k = f.alias or n
|
|
504
|
+
val = serialized.get(k)
|
|
505
|
+
|
|
506
|
+
if val != UNSET_SENTINEL:
|
|
507
|
+
if val is not None or k not in optional_fields:
|
|
508
|
+
m[k] = val
|
|
509
|
+
|
|
510
|
+
return m
|
|
511
|
+
|
|
426
512
|
|
|
427
513
|
class DeploymentCreateMetric24TypedDict(TypedDict):
|
|
428
514
|
type: DeploymentCreateMetric2Type
|
|
@@ -441,6 +527,22 @@ class DeploymentCreateMetric24(BaseModel):
|
|
|
441
527
|
|
|
442
528
|
cache_control: Optional[DeploymentCreateMetric2CacheControl] = None
|
|
443
529
|
|
|
530
|
+
@model_serializer(mode="wrap")
|
|
531
|
+
def serialize_model(self, handler):
|
|
532
|
+
optional_fields = set(["cache_control"])
|
|
533
|
+
serialized = handler(self)
|
|
534
|
+
m = {}
|
|
535
|
+
|
|
536
|
+
for n, f in type(self).model_fields.items():
|
|
537
|
+
k = f.alias or n
|
|
538
|
+
val = serialized.get(k)
|
|
539
|
+
|
|
540
|
+
if val != UNSET_SENTINEL:
|
|
541
|
+
if val is not None or k not in optional_fields:
|
|
542
|
+
m[k] = val
|
|
543
|
+
|
|
544
|
+
return m
|
|
545
|
+
|
|
444
546
|
|
|
445
547
|
DeploymentCreateMetricContent2TypedDict = TypeAliasType(
|
|
446
548
|
"DeploymentCreateMetricContent2TypedDict",
|
|
@@ -497,6 +599,22 @@ class DeploymentCreateMetricMessagesUserMessage(BaseModel):
|
|
|
497
599
|
name: Optional[str] = None
|
|
498
600
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
499
601
|
|
|
602
|
+
@model_serializer(mode="wrap")
|
|
603
|
+
def serialize_model(self, handler):
|
|
604
|
+
optional_fields = set(["name"])
|
|
605
|
+
serialized = handler(self)
|
|
606
|
+
m = {}
|
|
607
|
+
|
|
608
|
+
for n, f in type(self).model_fields.items():
|
|
609
|
+
k = f.alias or n
|
|
610
|
+
val = serialized.get(k)
|
|
611
|
+
|
|
612
|
+
if val != UNSET_SENTINEL:
|
|
613
|
+
if val is not None or k not in optional_fields:
|
|
614
|
+
m[k] = val
|
|
615
|
+
|
|
616
|
+
return m
|
|
617
|
+
|
|
500
618
|
|
|
501
619
|
DeploymentCreateMetricMessagesDeploymentsMetricsRole = Literal["developer",]
|
|
502
620
|
r"""The role of the messages author, in this case `developer`."""
|
|
@@ -535,6 +653,22 @@ class DeploymentCreateMetricMessagesDeveloperMessage(BaseModel):
|
|
|
535
653
|
name: Optional[str] = None
|
|
536
654
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
537
655
|
|
|
656
|
+
@model_serializer(mode="wrap")
|
|
657
|
+
def serialize_model(self, handler):
|
|
658
|
+
optional_fields = set(["name"])
|
|
659
|
+
serialized = handler(self)
|
|
660
|
+
m = {}
|
|
661
|
+
|
|
662
|
+
for n, f in type(self).model_fields.items():
|
|
663
|
+
k = f.alias or n
|
|
664
|
+
val = serialized.get(k)
|
|
665
|
+
|
|
666
|
+
if val != UNSET_SENTINEL:
|
|
667
|
+
if val is not None or k not in optional_fields:
|
|
668
|
+
m[k] = val
|
|
669
|
+
|
|
670
|
+
return m
|
|
671
|
+
|
|
538
672
|
|
|
539
673
|
DeploymentCreateMetricMessagesRole = Literal["system",]
|
|
540
674
|
r"""The role of the messages author, in this case `system`."""
|
|
@@ -576,6 +710,22 @@ class DeploymentCreateMetricMessagesSystemMessage(BaseModel):
|
|
|
576
710
|
name: Optional[str] = None
|
|
577
711
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
578
712
|
|
|
713
|
+
@model_serializer(mode="wrap")
|
|
714
|
+
def serialize_model(self, handler):
|
|
715
|
+
optional_fields = set(["name"])
|
|
716
|
+
serialized = handler(self)
|
|
717
|
+
m = {}
|
|
718
|
+
|
|
719
|
+
for n, f in type(self).model_fields.items():
|
|
720
|
+
k = f.alias or n
|
|
721
|
+
val = serialized.get(k)
|
|
722
|
+
|
|
723
|
+
if val != UNSET_SENTINEL:
|
|
724
|
+
if val is not None or k not in optional_fields:
|
|
725
|
+
m[k] = val
|
|
726
|
+
|
|
727
|
+
return m
|
|
728
|
+
|
|
579
729
|
|
|
580
730
|
DeploymentCreateMetricMessagesTypedDict = TypeAliasType(
|
|
581
731
|
"DeploymentCreateMetricMessagesTypedDict",
|
|
@@ -682,6 +832,22 @@ class ChoicesCacheControl(BaseModel):
|
|
|
682
832
|
Defaults to `5m`. Only supported by `Anthropic` Claude models.
|
|
683
833
|
"""
|
|
684
834
|
|
|
835
|
+
@model_serializer(mode="wrap")
|
|
836
|
+
def serialize_model(self, handler):
|
|
837
|
+
optional_fields = set(["ttl"])
|
|
838
|
+
serialized = handler(self)
|
|
839
|
+
m = {}
|
|
840
|
+
|
|
841
|
+
for n, f in type(self).model_fields.items():
|
|
842
|
+
k = f.alias or n
|
|
843
|
+
val = serialized.get(k)
|
|
844
|
+
|
|
845
|
+
if val != UNSET_SENTINEL:
|
|
846
|
+
if val is not None or k not in optional_fields:
|
|
847
|
+
m[k] = val
|
|
848
|
+
|
|
849
|
+
return m
|
|
850
|
+
|
|
685
851
|
|
|
686
852
|
class ChoicesToolMessageTypedDict(TypedDict):
|
|
687
853
|
role: DeploymentCreateMetricChoicesDeploymentsMetricsRequestRequestBodyRole
|
|
@@ -707,31 +873,26 @@ class ChoicesToolMessage(BaseModel):
|
|
|
707
873
|
|
|
708
874
|
@model_serializer(mode="wrap")
|
|
709
875
|
def serialize_model(self, handler):
|
|
710
|
-
optional_fields = ["cache_control"]
|
|
711
|
-
nullable_fields = ["tool_call_id"]
|
|
712
|
-
null_default_fields = []
|
|
713
|
-
|
|
876
|
+
optional_fields = set(["cache_control"])
|
|
877
|
+
nullable_fields = set(["tool_call_id"])
|
|
714
878
|
serialized = handler(self)
|
|
715
|
-
|
|
716
879
|
m = {}
|
|
717
880
|
|
|
718
881
|
for n, f in type(self).model_fields.items():
|
|
719
882
|
k = f.alias or n
|
|
720
883
|
val = serialized.get(k)
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
):
|
|
734
|
-
m[k] = val
|
|
884
|
+
is_nullable_and_explicitly_set = (
|
|
885
|
+
k in nullable_fields
|
|
886
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
887
|
+
)
|
|
888
|
+
|
|
889
|
+
if val != UNSET_SENTINEL:
|
|
890
|
+
if (
|
|
891
|
+
val is not None
|
|
892
|
+
or k not in optional_fields
|
|
893
|
+
or is_nullable_and_explicitly_set
|
|
894
|
+
):
|
|
895
|
+
m[k] = val
|
|
735
896
|
|
|
736
897
|
return m
|
|
737
898
|
|
|
@@ -816,6 +977,22 @@ class ChoicesFunction(BaseModel):
|
|
|
816
977
|
arguments: Optional[str] = None
|
|
817
978
|
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."""
|
|
818
979
|
|
|
980
|
+
@model_serializer(mode="wrap")
|
|
981
|
+
def serialize_model(self, handler):
|
|
982
|
+
optional_fields = set(["name", "arguments"])
|
|
983
|
+
serialized = handler(self)
|
|
984
|
+
m = {}
|
|
985
|
+
|
|
986
|
+
for n, f in type(self).model_fields.items():
|
|
987
|
+
k = f.alias or n
|
|
988
|
+
val = serialized.get(k)
|
|
989
|
+
|
|
990
|
+
if val != UNSET_SENTINEL:
|
|
991
|
+
if val is not None or k not in optional_fields:
|
|
992
|
+
m[k] = val
|
|
993
|
+
|
|
994
|
+
return m
|
|
995
|
+
|
|
819
996
|
|
|
820
997
|
class ChoicesToolCallsTypedDict(TypedDict):
|
|
821
998
|
id: str
|
|
@@ -839,6 +1016,22 @@ class ChoicesToolCalls(BaseModel):
|
|
|
839
1016
|
thought_signature: Optional[str] = None
|
|
840
1017
|
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."""
|
|
841
1018
|
|
|
1019
|
+
@model_serializer(mode="wrap")
|
|
1020
|
+
def serialize_model(self, handler):
|
|
1021
|
+
optional_fields = set(["thought_signature"])
|
|
1022
|
+
serialized = handler(self)
|
|
1023
|
+
m = {}
|
|
1024
|
+
|
|
1025
|
+
for n, f in type(self).model_fields.items():
|
|
1026
|
+
k = f.alias or n
|
|
1027
|
+
val = serialized.get(k)
|
|
1028
|
+
|
|
1029
|
+
if val != UNSET_SENTINEL:
|
|
1030
|
+
if val is not None or k not in optional_fields:
|
|
1031
|
+
m[k] = val
|
|
1032
|
+
|
|
1033
|
+
return m
|
|
1034
|
+
|
|
842
1035
|
|
|
843
1036
|
class ChoicesAssistantMessageTypedDict(TypedDict):
|
|
844
1037
|
role: DeploymentCreateMetricChoicesDeploymentsMetricsRequestRole
|
|
@@ -880,31 +1073,26 @@ class ChoicesAssistantMessage(BaseModel):
|
|
|
880
1073
|
|
|
881
1074
|
@model_serializer(mode="wrap")
|
|
882
1075
|
def serialize_model(self, handler):
|
|
883
|
-
optional_fields = ["content", "refusal", "name", "audio", "tool_calls"]
|
|
884
|
-
nullable_fields = ["content", "refusal", "audio"]
|
|
885
|
-
null_default_fields = []
|
|
886
|
-
|
|
1076
|
+
optional_fields = set(["content", "refusal", "name", "audio", "tool_calls"])
|
|
1077
|
+
nullable_fields = set(["content", "refusal", "audio"])
|
|
887
1078
|
serialized = handler(self)
|
|
888
|
-
|
|
889
1079
|
m = {}
|
|
890
1080
|
|
|
891
1081
|
for n, f in type(self).model_fields.items():
|
|
892
1082
|
k = f.alias or n
|
|
893
1083
|
val = serialized.get(k)
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
):
|
|
907
|
-
m[k] = val
|
|
1084
|
+
is_nullable_and_explicitly_set = (
|
|
1085
|
+
k in nullable_fields
|
|
1086
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
1087
|
+
)
|
|
1088
|
+
|
|
1089
|
+
if val != UNSET_SENTINEL:
|
|
1090
|
+
if (
|
|
1091
|
+
val is not None
|
|
1092
|
+
or k not in optional_fields
|
|
1093
|
+
or is_nullable_and_explicitly_set
|
|
1094
|
+
):
|
|
1095
|
+
m[k] = val
|
|
908
1096
|
|
|
909
1097
|
return m
|
|
910
1098
|
|
|
@@ -960,6 +1148,22 @@ class DeploymentCreateMetric2DeploymentsMetricsCacheControl(BaseModel):
|
|
|
960
1148
|
Defaults to `5m`. Only supported by `Anthropic` Claude models.
|
|
961
1149
|
"""
|
|
962
1150
|
|
|
1151
|
+
@model_serializer(mode="wrap")
|
|
1152
|
+
def serialize_model(self, handler):
|
|
1153
|
+
optional_fields = set(["ttl"])
|
|
1154
|
+
serialized = handler(self)
|
|
1155
|
+
m = {}
|
|
1156
|
+
|
|
1157
|
+
for n, f in type(self).model_fields.items():
|
|
1158
|
+
k = f.alias or n
|
|
1159
|
+
val = serialized.get(k)
|
|
1160
|
+
|
|
1161
|
+
if val != UNSET_SENTINEL:
|
|
1162
|
+
if val is not None or k not in optional_fields:
|
|
1163
|
+
m[k] = val
|
|
1164
|
+
|
|
1165
|
+
return m
|
|
1166
|
+
|
|
963
1167
|
|
|
964
1168
|
class DeploymentCreateMetric2DeploymentsMetrics4TypedDict(TypedDict):
|
|
965
1169
|
type: DeploymentCreateMetric2DeploymentsMetricsRequestType
|
|
@@ -982,6 +1186,22 @@ class DeploymentCreateMetric2DeploymentsMetrics4(BaseModel):
|
|
|
982
1186
|
None
|
|
983
1187
|
)
|
|
984
1188
|
|
|
1189
|
+
@model_serializer(mode="wrap")
|
|
1190
|
+
def serialize_model(self, handler):
|
|
1191
|
+
optional_fields = set(["cache_control"])
|
|
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
|
+
|
|
985
1205
|
|
|
986
1206
|
DeploymentCreateMetricContentDeploymentsMetricsRequestRequestBody2TypedDict = (
|
|
987
1207
|
TypeAliasType(
|
|
@@ -1047,6 +1267,22 @@ class ChoicesUserMessage(BaseModel):
|
|
|
1047
1267
|
name: Optional[str] = None
|
|
1048
1268
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
1049
1269
|
|
|
1270
|
+
@model_serializer(mode="wrap")
|
|
1271
|
+
def serialize_model(self, handler):
|
|
1272
|
+
optional_fields = set(["name"])
|
|
1273
|
+
serialized = handler(self)
|
|
1274
|
+
m = {}
|
|
1275
|
+
|
|
1276
|
+
for n, f in type(self).model_fields.items():
|
|
1277
|
+
k = f.alias or n
|
|
1278
|
+
val = serialized.get(k)
|
|
1279
|
+
|
|
1280
|
+
if val != UNSET_SENTINEL:
|
|
1281
|
+
if val is not None or k not in optional_fields:
|
|
1282
|
+
m[k] = val
|
|
1283
|
+
|
|
1284
|
+
return m
|
|
1285
|
+
|
|
1050
1286
|
|
|
1051
1287
|
DeploymentCreateMetricChoicesRole = Literal["developer",]
|
|
1052
1288
|
r"""The role of the messages author, in this case `developer`."""
|
|
@@ -1084,6 +1320,22 @@ class ChoicesDeveloperMessage(BaseModel):
|
|
|
1084
1320
|
name: Optional[str] = None
|
|
1085
1321
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
1086
1322
|
|
|
1323
|
+
@model_serializer(mode="wrap")
|
|
1324
|
+
def serialize_model(self, handler):
|
|
1325
|
+
optional_fields = set(["name"])
|
|
1326
|
+
serialized = handler(self)
|
|
1327
|
+
m = {}
|
|
1328
|
+
|
|
1329
|
+
for n, f in type(self).model_fields.items():
|
|
1330
|
+
k = f.alias or n
|
|
1331
|
+
val = serialized.get(k)
|
|
1332
|
+
|
|
1333
|
+
if val != UNSET_SENTINEL:
|
|
1334
|
+
if val is not None or k not in optional_fields:
|
|
1335
|
+
m[k] = val
|
|
1336
|
+
|
|
1337
|
+
return m
|
|
1338
|
+
|
|
1087
1339
|
|
|
1088
1340
|
ChoicesRole = Literal["system",]
|
|
1089
1341
|
r"""The role of the messages author, in this case `system`."""
|
|
@@ -1124,6 +1376,22 @@ class ChoicesSystemMessage(BaseModel):
|
|
|
1124
1376
|
name: Optional[str] = None
|
|
1125
1377
|
r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
|
|
1126
1378
|
|
|
1379
|
+
@model_serializer(mode="wrap")
|
|
1380
|
+
def serialize_model(self, handler):
|
|
1381
|
+
optional_fields = set(["name"])
|
|
1382
|
+
serialized = handler(self)
|
|
1383
|
+
m = {}
|
|
1384
|
+
|
|
1385
|
+
for n, f in type(self).model_fields.items():
|
|
1386
|
+
k = f.alias or n
|
|
1387
|
+
val = serialized.get(k)
|
|
1388
|
+
|
|
1389
|
+
if val != UNSET_SENTINEL:
|
|
1390
|
+
if val is not None or k not in optional_fields:
|
|
1391
|
+
m[k] = val
|
|
1392
|
+
|
|
1393
|
+
return m
|
|
1394
|
+
|
|
1127
1395
|
|
|
1128
1396
|
ChoicesTypedDict = TypeAliasType(
|
|
1129
1397
|
"ChoicesTypedDict",
|
|
@@ -1199,6 +1467,24 @@ class DeploymentCreateMetricRequestBody(BaseModel):
|
|
|
1199
1467
|
feedback: Optional[DeploymentCreateMetricFeedback] = None
|
|
1200
1468
|
r"""Feedback from the user on the completion"""
|
|
1201
1469
|
|
|
1470
|
+
@model_serializer(mode="wrap")
|
|
1471
|
+
def serialize_model(self, handler):
|
|
1472
|
+
optional_fields = set(
|
|
1473
|
+
["metadata", "usage", "performance", "messages", "choices", "feedback"]
|
|
1474
|
+
)
|
|
1475
|
+
serialized = handler(self)
|
|
1476
|
+
m = {}
|
|
1477
|
+
|
|
1478
|
+
for n, f in type(self).model_fields.items():
|
|
1479
|
+
k = f.alias or n
|
|
1480
|
+
val = serialized.get(k)
|
|
1481
|
+
|
|
1482
|
+
if val != UNSET_SENTINEL:
|
|
1483
|
+
if val is not None or k not in optional_fields:
|
|
1484
|
+
m[k] = val
|
|
1485
|
+
|
|
1486
|
+
return m
|
|
1487
|
+
|
|
1202
1488
|
|
|
1203
1489
|
class DeploymentCreateMetricRequestTypedDict(TypedDict):
|
|
1204
1490
|
id: str
|