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
|
@@ -90,6 +90,22 @@ class ResponseFormatJSONSchema(BaseModel):
|
|
|
90
90
|
strict: Optional[bool] = False
|
|
91
91
|
r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
|
|
92
92
|
|
|
93
|
+
@model_serializer(mode="wrap")
|
|
94
|
+
def serialize_model(self, handler):
|
|
95
|
+
optional_fields = set(["description", "schema", "strict"])
|
|
96
|
+
serialized = handler(self)
|
|
97
|
+
m = {}
|
|
98
|
+
|
|
99
|
+
for n, f in type(self).model_fields.items():
|
|
100
|
+
k = f.alias or n
|
|
101
|
+
val = serialized.get(k)
|
|
102
|
+
|
|
103
|
+
if val != UNSET_SENTINEL:
|
|
104
|
+
if val is not None or k not in optional_fields:
|
|
105
|
+
m[k] = val
|
|
106
|
+
|
|
107
|
+
return m
|
|
108
|
+
|
|
93
109
|
|
|
94
110
|
class JSONSchemaTypedDict(TypedDict):
|
|
95
111
|
r"""
|
|
@@ -212,6 +228,22 @@ class StreamOptions(BaseModel):
|
|
|
212
228
|
include_usage: Optional[bool] = None
|
|
213
229
|
r"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value."""
|
|
214
230
|
|
|
231
|
+
@model_serializer(mode="wrap")
|
|
232
|
+
def serialize_model(self, handler):
|
|
233
|
+
optional_fields = set(["include_usage"])
|
|
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
|
+
|
|
215
247
|
|
|
216
248
|
ThinkingTypedDict = TypeAliasType(
|
|
217
249
|
"ThinkingTypedDict",
|
|
@@ -254,6 +286,22 @@ class ToolChoice2(BaseModel):
|
|
|
254
286
|
type: Optional[ToolChoiceType] = None
|
|
255
287
|
r"""The type of the tool. Currently, only function is supported."""
|
|
256
288
|
|
|
289
|
+
@model_serializer(mode="wrap")
|
|
290
|
+
def serialize_model(self, handler):
|
|
291
|
+
optional_fields = set(["type"])
|
|
292
|
+
serialized = handler(self)
|
|
293
|
+
m = {}
|
|
294
|
+
|
|
295
|
+
for n, f in type(self).model_fields.items():
|
|
296
|
+
k = f.alias or n
|
|
297
|
+
val = serialized.get(k)
|
|
298
|
+
|
|
299
|
+
if val != UNSET_SENTINEL:
|
|
300
|
+
if val is not None or k not in optional_fields:
|
|
301
|
+
m[k] = val
|
|
302
|
+
|
|
303
|
+
return m
|
|
304
|
+
|
|
257
305
|
|
|
258
306
|
ToolChoice1 = Literal[
|
|
259
307
|
"none",
|
|
@@ -312,9 +360,159 @@ class CreateAgentRequestModelConfigurationGuardrails(BaseModel):
|
|
|
312
360
|
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
313
361
|
|
|
314
362
|
|
|
363
|
+
class FallbacksTypedDict(TypedDict):
|
|
364
|
+
model: str
|
|
365
|
+
r"""Fallback model identifier"""
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class Fallbacks(BaseModel):
|
|
369
|
+
model: str
|
|
370
|
+
r"""Fallback model identifier"""
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
class RetryTypedDict(TypedDict):
|
|
374
|
+
r"""Retry configuration for the request"""
|
|
375
|
+
|
|
376
|
+
count: NotRequired[float]
|
|
377
|
+
r"""Number of retry attempts (1-5)"""
|
|
378
|
+
on_codes: NotRequired[List[float]]
|
|
379
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
class Retry(BaseModel):
|
|
383
|
+
r"""Retry configuration for the request"""
|
|
384
|
+
|
|
385
|
+
count: Optional[float] = 3
|
|
386
|
+
r"""Number of retry attempts (1-5)"""
|
|
387
|
+
|
|
388
|
+
on_codes: Optional[List[float]] = None
|
|
389
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
390
|
+
|
|
391
|
+
@model_serializer(mode="wrap")
|
|
392
|
+
def serialize_model(self, handler):
|
|
393
|
+
optional_fields = set(["count", "on_codes"])
|
|
394
|
+
serialized = handler(self)
|
|
395
|
+
m = {}
|
|
396
|
+
|
|
397
|
+
for n, f in type(self).model_fields.items():
|
|
398
|
+
k = f.alias or n
|
|
399
|
+
val = serialized.get(k)
|
|
400
|
+
|
|
401
|
+
if val != UNSET_SENTINEL:
|
|
402
|
+
if val is not None or k not in optional_fields:
|
|
403
|
+
m[k] = val
|
|
404
|
+
|
|
405
|
+
return m
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
ModelConfigurationType = Literal["exact_match",]
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
class CacheTypedDict(TypedDict):
|
|
412
|
+
r"""Cache configuration for the request."""
|
|
413
|
+
|
|
414
|
+
type: ModelConfigurationType
|
|
415
|
+
ttl: NotRequired[float]
|
|
416
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
class Cache(BaseModel):
|
|
420
|
+
r"""Cache configuration for the request."""
|
|
421
|
+
|
|
422
|
+
type: ModelConfigurationType
|
|
423
|
+
|
|
424
|
+
ttl: Optional[float] = 1800
|
|
425
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
426
|
+
|
|
427
|
+
@model_serializer(mode="wrap")
|
|
428
|
+
def serialize_model(self, handler):
|
|
429
|
+
optional_fields = set(["ttl"])
|
|
430
|
+
serialized = handler(self)
|
|
431
|
+
m = {}
|
|
432
|
+
|
|
433
|
+
for n, f in type(self).model_fields.items():
|
|
434
|
+
k = f.alias or n
|
|
435
|
+
val = serialized.get(k)
|
|
436
|
+
|
|
437
|
+
if val != UNSET_SENTINEL:
|
|
438
|
+
if val is not None or k not in optional_fields:
|
|
439
|
+
m[k] = val
|
|
440
|
+
|
|
441
|
+
return m
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
LoadBalancerType = Literal["weight_based",]
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
class CreateAgentRequestLoadBalancerModelsTypedDict(TypedDict):
|
|
448
|
+
model: str
|
|
449
|
+
r"""Model identifier for load balancing"""
|
|
450
|
+
weight: NotRequired[float]
|
|
451
|
+
r"""Weight assigned to this model for load balancing"""
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
class CreateAgentRequestLoadBalancerModels(BaseModel):
|
|
455
|
+
model: str
|
|
456
|
+
r"""Model identifier for load balancing"""
|
|
457
|
+
|
|
458
|
+
weight: Optional[float] = 0.5
|
|
459
|
+
r"""Weight assigned to this model for load balancing"""
|
|
460
|
+
|
|
461
|
+
@model_serializer(mode="wrap")
|
|
462
|
+
def serialize_model(self, handler):
|
|
463
|
+
optional_fields = set(["weight"])
|
|
464
|
+
serialized = handler(self)
|
|
465
|
+
m = {}
|
|
466
|
+
|
|
467
|
+
for n, f in type(self).model_fields.items():
|
|
468
|
+
k = f.alias or n
|
|
469
|
+
val = serialized.get(k)
|
|
470
|
+
|
|
471
|
+
if val != UNSET_SENTINEL:
|
|
472
|
+
if val is not None or k not in optional_fields:
|
|
473
|
+
m[k] = val
|
|
474
|
+
|
|
475
|
+
return m
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
class LoadBalancer1TypedDict(TypedDict):
|
|
479
|
+
type: LoadBalancerType
|
|
480
|
+
models: List[CreateAgentRequestLoadBalancerModelsTypedDict]
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
class LoadBalancer1(BaseModel):
|
|
484
|
+
type: LoadBalancerType
|
|
485
|
+
|
|
486
|
+
models: List[CreateAgentRequestLoadBalancerModels]
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
LoadBalancerTypedDict = LoadBalancer1TypedDict
|
|
490
|
+
r"""Load balancer configuration for the request."""
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
LoadBalancer = LoadBalancer1
|
|
494
|
+
r"""Load balancer configuration for the request."""
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
class TimeoutTypedDict(TypedDict):
|
|
498
|
+
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."""
|
|
499
|
+
|
|
500
|
+
call_timeout: float
|
|
501
|
+
r"""Timeout value in milliseconds"""
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
class Timeout(BaseModel):
|
|
505
|
+
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."""
|
|
506
|
+
|
|
507
|
+
call_timeout: float
|
|
508
|
+
r"""Timeout value in milliseconds"""
|
|
509
|
+
|
|
510
|
+
|
|
315
511
|
class ParametersTypedDict(TypedDict):
|
|
316
512
|
r"""Model behavior parameters that control how the model generates responses. Common parameters: `temperature` (0-1, randomness), `max_completion_tokens` (max output length), `top_p` (sampling diversity). Advanced: `frequency_penalty`, `presence_penalty`, `response_format` (JSON/structured), `reasoning_effort`, `seed` (reproducibility). Support varies by model - consult AI Gateway documentation."""
|
|
317
513
|
|
|
514
|
+
name: NotRequired[str]
|
|
515
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
318
516
|
audio: NotRequired[Nullable[ModelConfigurationAudioTypedDict]]
|
|
319
517
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
320
518
|
frequency_penalty: NotRequired[Nullable[float]]
|
|
@@ -371,11 +569,24 @@ class ParametersTypedDict(TypedDict):
|
|
|
371
569
|
List[CreateAgentRequestModelConfigurationGuardrailsTypedDict]
|
|
372
570
|
]
|
|
373
571
|
r"""A list of guardrails to apply to the request."""
|
|
572
|
+
fallbacks: NotRequired[List[FallbacksTypedDict]]
|
|
573
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
574
|
+
retry: NotRequired[RetryTypedDict]
|
|
575
|
+
r"""Retry configuration for the request"""
|
|
576
|
+
cache: NotRequired[CacheTypedDict]
|
|
577
|
+
r"""Cache configuration for the request."""
|
|
578
|
+
load_balancer: NotRequired[LoadBalancerTypedDict]
|
|
579
|
+
r"""Load balancer configuration for the request."""
|
|
580
|
+
timeout: NotRequired[TimeoutTypedDict]
|
|
581
|
+
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."""
|
|
374
582
|
|
|
375
583
|
|
|
376
584
|
class Parameters(BaseModel):
|
|
377
585
|
r"""Model behavior parameters that control how the model generates responses. Common parameters: `temperature` (0-1, randomness), `max_completion_tokens` (max output length), `top_p` (sampling diversity). Advanced: `frequency_penalty`, `presence_penalty`, `response_format` (JSON/structured), `reasoning_effort`, `seed` (reproducibility). Support varies by model - consult AI Gateway documentation."""
|
|
378
586
|
|
|
587
|
+
name: Optional[str] = None
|
|
588
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
589
|
+
|
|
379
590
|
audio: OptionalNullable[ModelConfigurationAudio] = UNSET
|
|
380
591
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
381
592
|
|
|
@@ -452,77 +663,97 @@ class Parameters(BaseModel):
|
|
|
452
663
|
guardrails: Optional[List[CreateAgentRequestModelConfigurationGuardrails]] = None
|
|
453
664
|
r"""A list of guardrails to apply to the request."""
|
|
454
665
|
|
|
666
|
+
fallbacks: Optional[List[Fallbacks]] = None
|
|
667
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
668
|
+
|
|
669
|
+
retry: Optional[Retry] = None
|
|
670
|
+
r"""Retry configuration for the request"""
|
|
671
|
+
|
|
672
|
+
cache: Optional[Cache] = None
|
|
673
|
+
r"""Cache configuration for the request."""
|
|
674
|
+
|
|
675
|
+
load_balancer: Optional[LoadBalancer] = None
|
|
676
|
+
r"""Load balancer configuration for the request."""
|
|
677
|
+
|
|
678
|
+
timeout: Optional[Timeout] = None
|
|
679
|
+
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."""
|
|
680
|
+
|
|
455
681
|
@model_serializer(mode="wrap")
|
|
456
682
|
def serialize_model(self, handler):
|
|
457
|
-
optional_fields =
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
683
|
+
optional_fields = set(
|
|
684
|
+
[
|
|
685
|
+
"name",
|
|
686
|
+
"audio",
|
|
687
|
+
"frequency_penalty",
|
|
688
|
+
"max_tokens",
|
|
689
|
+
"max_completion_tokens",
|
|
690
|
+
"logprobs",
|
|
691
|
+
"top_logprobs",
|
|
692
|
+
"n",
|
|
693
|
+
"presence_penalty",
|
|
694
|
+
"response_format",
|
|
695
|
+
"reasoning_effort",
|
|
696
|
+
"verbosity",
|
|
697
|
+
"seed",
|
|
698
|
+
"stop",
|
|
699
|
+
"stream_options",
|
|
700
|
+
"thinking",
|
|
701
|
+
"temperature",
|
|
702
|
+
"top_p",
|
|
703
|
+
"top_k",
|
|
704
|
+
"tool_choice",
|
|
705
|
+
"parallel_tool_calls",
|
|
706
|
+
"modalities",
|
|
707
|
+
"guardrails",
|
|
708
|
+
"fallbacks",
|
|
709
|
+
"retry",
|
|
710
|
+
"cache",
|
|
711
|
+
"load_balancer",
|
|
712
|
+
"timeout",
|
|
713
|
+
]
|
|
714
|
+
)
|
|
715
|
+
nullable_fields = set(
|
|
716
|
+
[
|
|
717
|
+
"audio",
|
|
718
|
+
"frequency_penalty",
|
|
719
|
+
"max_tokens",
|
|
720
|
+
"max_completion_tokens",
|
|
721
|
+
"logprobs",
|
|
722
|
+
"top_logprobs",
|
|
723
|
+
"n",
|
|
724
|
+
"presence_penalty",
|
|
725
|
+
"seed",
|
|
726
|
+
"stop",
|
|
727
|
+
"stream_options",
|
|
728
|
+
"temperature",
|
|
729
|
+
"top_p",
|
|
730
|
+
"top_k",
|
|
731
|
+
"modalities",
|
|
732
|
+
]
|
|
733
|
+
)
|
|
500
734
|
serialized = handler(self)
|
|
501
|
-
|
|
502
735
|
m = {}
|
|
503
736
|
|
|
504
737
|
for n, f in type(self).model_fields.items():
|
|
505
738
|
k = f.alias or n
|
|
506
739
|
val = serialized.get(k)
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
):
|
|
520
|
-
m[k] = val
|
|
740
|
+
is_nullable_and_explicitly_set = (
|
|
741
|
+
k in nullable_fields
|
|
742
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
743
|
+
)
|
|
744
|
+
|
|
745
|
+
if val != UNSET_SENTINEL:
|
|
746
|
+
if (
|
|
747
|
+
val is not None
|
|
748
|
+
or k not in optional_fields
|
|
749
|
+
or is_nullable_and_explicitly_set
|
|
750
|
+
):
|
|
751
|
+
m[k] = val
|
|
521
752
|
|
|
522
753
|
return m
|
|
523
754
|
|
|
524
755
|
|
|
525
|
-
class
|
|
756
|
+
class ModelConfigurationRetryTypedDict(TypedDict):
|
|
526
757
|
r"""Retry configuration for model requests. Retries are triggered for specific HTTP status codes (e.g., 500, 429, 502, 503, 504). Supports configurable retry count (1-5) and custom status codes."""
|
|
527
758
|
|
|
528
759
|
count: NotRequired[float]
|
|
@@ -531,7 +762,7 @@ class RetryTypedDict(TypedDict):
|
|
|
531
762
|
r"""HTTP status codes that trigger retry logic"""
|
|
532
763
|
|
|
533
764
|
|
|
534
|
-
class
|
|
765
|
+
class ModelConfigurationRetry(BaseModel):
|
|
535
766
|
r"""Retry configuration for model requests. Retries are triggered for specific HTTP status codes (e.g., 500, 429, 502, 503, 504). Supports configurable retry count (1-5) and custom status codes."""
|
|
536
767
|
|
|
537
768
|
count: Optional[float] = 3
|
|
@@ -540,6 +771,22 @@ class Retry(BaseModel):
|
|
|
540
771
|
on_codes: Optional[List[float]] = None
|
|
541
772
|
r"""HTTP status codes that trigger retry logic"""
|
|
542
773
|
|
|
774
|
+
@model_serializer(mode="wrap")
|
|
775
|
+
def serialize_model(self, handler):
|
|
776
|
+
optional_fields = set(["count", "on_codes"])
|
|
777
|
+
serialized = handler(self)
|
|
778
|
+
m = {}
|
|
779
|
+
|
|
780
|
+
for n, f in type(self).model_fields.items():
|
|
781
|
+
k = f.alias or n
|
|
782
|
+
val = serialized.get(k)
|
|
783
|
+
|
|
784
|
+
if val != UNSET_SENTINEL:
|
|
785
|
+
if val is not None or k not in optional_fields:
|
|
786
|
+
m[k] = val
|
|
787
|
+
|
|
788
|
+
return m
|
|
789
|
+
|
|
543
790
|
|
|
544
791
|
class ModelConfiguration2TypedDict(TypedDict):
|
|
545
792
|
r"""
|
|
@@ -551,7 +798,7 @@ class ModelConfiguration2TypedDict(TypedDict):
|
|
|
551
798
|
r"""A model ID string (e.g., `openai/gpt-4o` or `anthropic/claude-haiku-4-5-20251001`). Only models that support tool calling can be used with agents."""
|
|
552
799
|
parameters: NotRequired[ParametersTypedDict]
|
|
553
800
|
r"""Model behavior parameters that control how the model generates responses. Common parameters: `temperature` (0-1, randomness), `max_completion_tokens` (max output length), `top_p` (sampling diversity). Advanced: `frequency_penalty`, `presence_penalty`, `response_format` (JSON/structured), `reasoning_effort`, `seed` (reproducibility). Support varies by model - consult AI Gateway documentation."""
|
|
554
|
-
retry: NotRequired[
|
|
801
|
+
retry: NotRequired[ModelConfigurationRetryTypedDict]
|
|
555
802
|
r"""Retry configuration for model requests. Retries are triggered for specific HTTP status codes (e.g., 500, 429, 502, 503, 504). Supports configurable retry count (1-5) and custom status codes."""
|
|
556
803
|
|
|
557
804
|
|
|
@@ -567,9 +814,25 @@ class ModelConfiguration2(BaseModel):
|
|
|
567
814
|
parameters: Optional[Parameters] = None
|
|
568
815
|
r"""Model behavior parameters that control how the model generates responses. Common parameters: `temperature` (0-1, randomness), `max_completion_tokens` (max output length), `top_p` (sampling diversity). Advanced: `frequency_penalty`, `presence_penalty`, `response_format` (JSON/structured), `reasoning_effort`, `seed` (reproducibility). Support varies by model - consult AI Gateway documentation."""
|
|
569
816
|
|
|
570
|
-
retry: Optional[
|
|
817
|
+
retry: Optional[ModelConfigurationRetry] = None
|
|
571
818
|
r"""Retry configuration for model requests. Retries are triggered for specific HTTP status codes (e.g., 500, 429, 502, 503, 504). Supports configurable retry count (1-5) and custom status codes."""
|
|
572
819
|
|
|
820
|
+
@model_serializer(mode="wrap")
|
|
821
|
+
def serialize_model(self, handler):
|
|
822
|
+
optional_fields = set(["parameters", "retry"])
|
|
823
|
+
serialized = handler(self)
|
|
824
|
+
m = {}
|
|
825
|
+
|
|
826
|
+
for n, f in type(self).model_fields.items():
|
|
827
|
+
k = f.alias or n
|
|
828
|
+
val = serialized.get(k)
|
|
829
|
+
|
|
830
|
+
if val != UNSET_SENTINEL:
|
|
831
|
+
if val is not None or k not in optional_fields:
|
|
832
|
+
m[k] = val
|
|
833
|
+
|
|
834
|
+
return m
|
|
835
|
+
|
|
573
836
|
|
|
574
837
|
ModelConfigurationTypedDict = TypeAliasType(
|
|
575
838
|
"ModelConfigurationTypedDict", Union[ModelConfiguration2TypedDict, str]
|
|
@@ -652,6 +915,22 @@ class CreateAgentRequestResponseFormatAgentsJSONSchema(BaseModel):
|
|
|
652
915
|
strict: Optional[bool] = False
|
|
653
916
|
r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
|
|
654
917
|
|
|
918
|
+
@model_serializer(mode="wrap")
|
|
919
|
+
def serialize_model(self, handler):
|
|
920
|
+
optional_fields = set(["description", "schema", "strict"])
|
|
921
|
+
serialized = handler(self)
|
|
922
|
+
m = {}
|
|
923
|
+
|
|
924
|
+
for n, f in type(self).model_fields.items():
|
|
925
|
+
k = f.alias or n
|
|
926
|
+
val = serialized.get(k)
|
|
927
|
+
|
|
928
|
+
if val != UNSET_SENTINEL:
|
|
929
|
+
if val is not None or k not in optional_fields:
|
|
930
|
+
m[k] = val
|
|
931
|
+
|
|
932
|
+
return m
|
|
933
|
+
|
|
655
934
|
|
|
656
935
|
class CreateAgentRequestResponseFormatJSONSchemaTypedDict(TypedDict):
|
|
657
936
|
r"""
|
|
@@ -782,6 +1061,22 @@ class FallbackModelConfigurationStreamOptions(BaseModel):
|
|
|
782
1061
|
include_usage: Optional[bool] = None
|
|
783
1062
|
r"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value."""
|
|
784
1063
|
|
|
1064
|
+
@model_serializer(mode="wrap")
|
|
1065
|
+
def serialize_model(self, handler):
|
|
1066
|
+
optional_fields = set(["include_usage"])
|
|
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
|
+
|
|
785
1080
|
|
|
786
1081
|
FallbackModelConfigurationThinkingTypedDict = TypeAliasType(
|
|
787
1082
|
"FallbackModelConfigurationThinkingTypedDict",
|
|
@@ -824,6 +1119,22 @@ class CreateAgentRequestToolChoice2(BaseModel):
|
|
|
824
1119
|
type: Optional[CreateAgentRequestToolChoiceType] = None
|
|
825
1120
|
r"""The type of the tool. Currently, only function is supported."""
|
|
826
1121
|
|
|
1122
|
+
@model_serializer(mode="wrap")
|
|
1123
|
+
def serialize_model(self, handler):
|
|
1124
|
+
optional_fields = set(["type"])
|
|
1125
|
+
serialized = handler(self)
|
|
1126
|
+
m = {}
|
|
1127
|
+
|
|
1128
|
+
for n, f in type(self).model_fields.items():
|
|
1129
|
+
k = f.alias or n
|
|
1130
|
+
val = serialized.get(k)
|
|
1131
|
+
|
|
1132
|
+
if val != UNSET_SENTINEL:
|
|
1133
|
+
if val is not None or k not in optional_fields:
|
|
1134
|
+
m[k] = val
|
|
1135
|
+
|
|
1136
|
+
return m
|
|
1137
|
+
|
|
827
1138
|
|
|
828
1139
|
CreateAgentRequestToolChoice1 = Literal[
|
|
829
1140
|
"none",
|
|
@@ -890,70 +1201,235 @@ class FallbackModelConfigurationGuardrails(BaseModel):
|
|
|
890
1201
|
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
891
1202
|
|
|
892
1203
|
|
|
893
|
-
class
|
|
894
|
-
|
|
1204
|
+
class FallbackModelConfigurationFallbacksTypedDict(TypedDict):
|
|
1205
|
+
model: str
|
|
1206
|
+
r"""Fallback model identifier"""
|
|
895
1207
|
|
|
896
|
-
audio: NotRequired[Nullable[FallbackModelConfigurationAudioTypedDict]]
|
|
897
|
-
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
898
|
-
frequency_penalty: NotRequired[Nullable[float]]
|
|
899
|
-
r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim."""
|
|
900
|
-
max_tokens: NotRequired[Nullable[int]]
|
|
901
|
-
r"""`[Deprecated]`. The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
|
|
902
1208
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
r"""An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens"""
|
|
907
|
-
logprobs: NotRequired[Nullable[bool]]
|
|
908
|
-
r"""Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message."""
|
|
909
|
-
top_logprobs: NotRequired[Nullable[int]]
|
|
910
|
-
r"""An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used."""
|
|
911
|
-
n: NotRequired[Nullable[int]]
|
|
912
|
-
r"""How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs."""
|
|
913
|
-
presence_penalty: NotRequired[Nullable[float]]
|
|
914
|
-
r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."""
|
|
915
|
-
response_format: NotRequired[FallbackModelConfigurationResponseFormatTypedDict]
|
|
916
|
-
r"""An object specifying the format that the model must output"""
|
|
917
|
-
reasoning_effort: NotRequired[FallbackModelConfigurationReasoningEffort]
|
|
918
|
-
r"""Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
|
|
1209
|
+
class FallbackModelConfigurationFallbacks(BaseModel):
|
|
1210
|
+
model: str
|
|
1211
|
+
r"""Fallback model identifier"""
|
|
919
1212
|
|
|
920
|
-
- `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
|
|
921
|
-
- All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
|
|
922
|
-
- The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
|
|
923
|
-
- `xhigh` is currently only supported for `gpt-5.1-codex-max`.
|
|
924
1213
|
|
|
925
|
-
|
|
926
|
-
"""
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
r"""
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1214
|
+
class FallbackModelConfigurationRetryTypedDict(TypedDict):
|
|
1215
|
+
r"""Retry configuration for the request"""
|
|
1216
|
+
|
|
1217
|
+
count: NotRequired[float]
|
|
1218
|
+
r"""Number of retry attempts (1-5)"""
|
|
1219
|
+
on_codes: NotRequired[List[float]]
|
|
1220
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
class FallbackModelConfigurationRetry(BaseModel):
|
|
1224
|
+
r"""Retry configuration for the request"""
|
|
1225
|
+
|
|
1226
|
+
count: Optional[float] = 3
|
|
1227
|
+
r"""Number of retry attempts (1-5)"""
|
|
1228
|
+
|
|
1229
|
+
on_codes: Optional[List[float]] = None
|
|
1230
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
1231
|
+
|
|
1232
|
+
@model_serializer(mode="wrap")
|
|
1233
|
+
def serialize_model(self, handler):
|
|
1234
|
+
optional_fields = set(["count", "on_codes"])
|
|
1235
|
+
serialized = handler(self)
|
|
1236
|
+
m = {}
|
|
1237
|
+
|
|
1238
|
+
for n, f in type(self).model_fields.items():
|
|
1239
|
+
k = f.alias or n
|
|
1240
|
+
val = serialized.get(k)
|
|
1241
|
+
|
|
1242
|
+
if val != UNSET_SENTINEL:
|
|
1243
|
+
if val is not None or k not in optional_fields:
|
|
1244
|
+
m[k] = val
|
|
1245
|
+
|
|
1246
|
+
return m
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
FallbackModelConfigurationType = Literal["exact_match",]
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
class FallbackModelConfigurationCacheTypedDict(TypedDict):
|
|
1253
|
+
r"""Cache configuration for the request."""
|
|
1254
|
+
|
|
1255
|
+
type: FallbackModelConfigurationType
|
|
1256
|
+
ttl: NotRequired[float]
|
|
1257
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
class FallbackModelConfigurationCache(BaseModel):
|
|
1261
|
+
r"""Cache configuration for the request."""
|
|
1262
|
+
|
|
1263
|
+
type: FallbackModelConfigurationType
|
|
1264
|
+
|
|
1265
|
+
ttl: Optional[float] = 1800
|
|
1266
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
1267
|
+
|
|
1268
|
+
@model_serializer(mode="wrap")
|
|
1269
|
+
def serialize_model(self, handler):
|
|
1270
|
+
optional_fields = set(["ttl"])
|
|
1271
|
+
serialized = handler(self)
|
|
1272
|
+
m = {}
|
|
1273
|
+
|
|
1274
|
+
for n, f in type(self).model_fields.items():
|
|
1275
|
+
k = f.alias or n
|
|
1276
|
+
val = serialized.get(k)
|
|
1277
|
+
|
|
1278
|
+
if val != UNSET_SENTINEL:
|
|
1279
|
+
if val is not None or k not in optional_fields:
|
|
1280
|
+
m[k] = val
|
|
1281
|
+
|
|
1282
|
+
return m
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
CreateAgentRequestLoadBalancerType = Literal["weight_based",]
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
class LoadBalancerModelsTypedDict(TypedDict):
|
|
1289
|
+
model: str
|
|
1290
|
+
r"""Model identifier for load balancing"""
|
|
1291
|
+
weight: NotRequired[float]
|
|
1292
|
+
r"""Weight assigned to this model for load balancing"""
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
class LoadBalancerModels(BaseModel):
|
|
1296
|
+
model: str
|
|
1297
|
+
r"""Model identifier for load balancing"""
|
|
1298
|
+
|
|
1299
|
+
weight: Optional[float] = 0.5
|
|
1300
|
+
r"""Weight assigned to this model for load balancing"""
|
|
1301
|
+
|
|
1302
|
+
@model_serializer(mode="wrap")
|
|
1303
|
+
def serialize_model(self, handler):
|
|
1304
|
+
optional_fields = set(["weight"])
|
|
1305
|
+
serialized = handler(self)
|
|
1306
|
+
m = {}
|
|
1307
|
+
|
|
1308
|
+
for n, f in type(self).model_fields.items():
|
|
1309
|
+
k = f.alias or n
|
|
1310
|
+
val = serialized.get(k)
|
|
1311
|
+
|
|
1312
|
+
if val != UNSET_SENTINEL:
|
|
1313
|
+
if val is not None or k not in optional_fields:
|
|
1314
|
+
m[k] = val
|
|
1315
|
+
|
|
1316
|
+
return m
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
class CreateAgentRequestLoadBalancer1TypedDict(TypedDict):
|
|
1320
|
+
type: CreateAgentRequestLoadBalancerType
|
|
1321
|
+
models: List[LoadBalancerModelsTypedDict]
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
class CreateAgentRequestLoadBalancer1(BaseModel):
|
|
1325
|
+
type: CreateAgentRequestLoadBalancerType
|
|
1326
|
+
|
|
1327
|
+
models: List[LoadBalancerModels]
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
FallbackModelConfigurationLoadBalancerTypedDict = (
|
|
1331
|
+
CreateAgentRequestLoadBalancer1TypedDict
|
|
1332
|
+
)
|
|
1333
|
+
r"""Load balancer configuration for the request."""
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
FallbackModelConfigurationLoadBalancer = CreateAgentRequestLoadBalancer1
|
|
1337
|
+
r"""Load balancer configuration for the request."""
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
class FallbackModelConfigurationTimeoutTypedDict(TypedDict):
|
|
1341
|
+
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."""
|
|
1342
|
+
|
|
1343
|
+
call_timeout: float
|
|
1344
|
+
r"""Timeout value in milliseconds"""
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
class FallbackModelConfigurationTimeout(BaseModel):
|
|
1348
|
+
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."""
|
|
1349
|
+
|
|
1350
|
+
call_timeout: float
|
|
1351
|
+
r"""Timeout value in milliseconds"""
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
class FallbackModelConfigurationParametersTypedDict(TypedDict):
|
|
1355
|
+
r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
|
|
1356
|
+
|
|
1357
|
+
name: NotRequired[str]
|
|
1358
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
1359
|
+
audio: NotRequired[Nullable[FallbackModelConfigurationAudioTypedDict]]
|
|
1360
|
+
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
1361
|
+
frequency_penalty: NotRequired[Nullable[float]]
|
|
1362
|
+
r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim."""
|
|
1363
|
+
max_tokens: NotRequired[Nullable[int]]
|
|
1364
|
+
r"""`[Deprecated]`. The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
|
|
1365
|
+
|
|
1366
|
+
This value is now `deprecated` in favor of `max_completion_tokens`, and is not compatible with o1 series models.
|
|
1367
|
+
"""
|
|
1368
|
+
max_completion_tokens: NotRequired[Nullable[int]]
|
|
1369
|
+
r"""An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens"""
|
|
1370
|
+
logprobs: NotRequired[Nullable[bool]]
|
|
1371
|
+
r"""Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message."""
|
|
1372
|
+
top_logprobs: NotRequired[Nullable[int]]
|
|
1373
|
+
r"""An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used."""
|
|
1374
|
+
n: NotRequired[Nullable[int]]
|
|
1375
|
+
r"""How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs."""
|
|
1376
|
+
presence_penalty: NotRequired[Nullable[float]]
|
|
1377
|
+
r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."""
|
|
1378
|
+
response_format: NotRequired[FallbackModelConfigurationResponseFormatTypedDict]
|
|
1379
|
+
r"""An object specifying the format that the model must output"""
|
|
1380
|
+
reasoning_effort: NotRequired[FallbackModelConfigurationReasoningEffort]
|
|
1381
|
+
r"""Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
|
|
1382
|
+
|
|
1383
|
+
- `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
|
|
1384
|
+
- All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
|
|
1385
|
+
- The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
|
|
1386
|
+
- `xhigh` is currently only supported for `gpt-5.1-codex-max`.
|
|
1387
|
+
|
|
1388
|
+
Any of \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\".
|
|
1389
|
+
"""
|
|
1390
|
+
verbosity: NotRequired[str]
|
|
1391
|
+
r"""Adjusts response verbosity. Lower levels yield shorter answers."""
|
|
1392
|
+
seed: NotRequired[Nullable[float]]
|
|
1393
|
+
r"""If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result."""
|
|
1394
|
+
stop: NotRequired[Nullable[FallbackModelConfigurationStopTypedDict]]
|
|
1395
|
+
r"""Up to 4 sequences where the API will stop generating further tokens."""
|
|
1396
|
+
stream_options: NotRequired[
|
|
1397
|
+
Nullable[FallbackModelConfigurationStreamOptionsTypedDict]
|
|
1398
|
+
]
|
|
1399
|
+
r"""Options for streaming response. Only set this when you set stream: true."""
|
|
1400
|
+
thinking: NotRequired[FallbackModelConfigurationThinkingTypedDict]
|
|
1401
|
+
temperature: NotRequired[Nullable[float]]
|
|
1402
|
+
r"""What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."""
|
|
1403
|
+
top_p: NotRequired[Nullable[float]]
|
|
1404
|
+
r"""An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass."""
|
|
1405
|
+
top_k: NotRequired[Nullable[float]]
|
|
1406
|
+
r"""Limits the model to consider only the top k most likely tokens at each step."""
|
|
1407
|
+
tool_choice: NotRequired[FallbackModelConfigurationToolChoiceTypedDict]
|
|
1408
|
+
r"""Controls which (if any) tool is called by the model."""
|
|
1409
|
+
parallel_tool_calls: NotRequired[bool]
|
|
1410
|
+
r"""Whether to enable parallel function calling during tool use."""
|
|
1411
|
+
modalities: NotRequired[Nullable[List[FallbackModelConfigurationModalities]]]
|
|
1412
|
+
r"""Output types that you would like the model to generate. Most models are capable of generating text, which is the default: [\"text\"]. The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: [\"text\", \"audio\"]."""
|
|
1413
|
+
guardrails: NotRequired[List[FallbackModelConfigurationGuardrailsTypedDict]]
|
|
1414
|
+
r"""A list of guardrails to apply to the request."""
|
|
1415
|
+
fallbacks: NotRequired[List[FallbackModelConfigurationFallbacksTypedDict]]
|
|
1416
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
1417
|
+
retry: NotRequired[FallbackModelConfigurationRetryTypedDict]
|
|
1418
|
+
r"""Retry configuration for the request"""
|
|
1419
|
+
cache: NotRequired[FallbackModelConfigurationCacheTypedDict]
|
|
1420
|
+
r"""Cache configuration for the request."""
|
|
1421
|
+
load_balancer: NotRequired[FallbackModelConfigurationLoadBalancerTypedDict]
|
|
1422
|
+
r"""Load balancer configuration for the request."""
|
|
1423
|
+
timeout: NotRequired[FallbackModelConfigurationTimeoutTypedDict]
|
|
1424
|
+
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."""
|
|
952
1425
|
|
|
953
1426
|
|
|
954
1427
|
class FallbackModelConfigurationParameters(BaseModel):
|
|
955
1428
|
r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
|
|
956
1429
|
|
|
1430
|
+
name: Optional[str] = None
|
|
1431
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
1432
|
+
|
|
957
1433
|
audio: OptionalNullable[FallbackModelConfigurationAudio] = UNSET
|
|
958
1434
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
959
1435
|
|
|
@@ -1030,77 +1506,97 @@ class FallbackModelConfigurationParameters(BaseModel):
|
|
|
1030
1506
|
guardrails: Optional[List[FallbackModelConfigurationGuardrails]] = None
|
|
1031
1507
|
r"""A list of guardrails to apply to the request."""
|
|
1032
1508
|
|
|
1509
|
+
fallbacks: Optional[List[FallbackModelConfigurationFallbacks]] = None
|
|
1510
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
1511
|
+
|
|
1512
|
+
retry: Optional[FallbackModelConfigurationRetry] = None
|
|
1513
|
+
r"""Retry configuration for the request"""
|
|
1514
|
+
|
|
1515
|
+
cache: Optional[FallbackModelConfigurationCache] = None
|
|
1516
|
+
r"""Cache configuration for the request."""
|
|
1517
|
+
|
|
1518
|
+
load_balancer: Optional[FallbackModelConfigurationLoadBalancer] = None
|
|
1519
|
+
r"""Load balancer configuration for the request."""
|
|
1520
|
+
|
|
1521
|
+
timeout: Optional[FallbackModelConfigurationTimeout] = None
|
|
1522
|
+
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."""
|
|
1523
|
+
|
|
1033
1524
|
@model_serializer(mode="wrap")
|
|
1034
1525
|
def serialize_model(self, handler):
|
|
1035
|
-
optional_fields =
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1526
|
+
optional_fields = set(
|
|
1527
|
+
[
|
|
1528
|
+
"name",
|
|
1529
|
+
"audio",
|
|
1530
|
+
"frequency_penalty",
|
|
1531
|
+
"max_tokens",
|
|
1532
|
+
"max_completion_tokens",
|
|
1533
|
+
"logprobs",
|
|
1534
|
+
"top_logprobs",
|
|
1535
|
+
"n",
|
|
1536
|
+
"presence_penalty",
|
|
1537
|
+
"response_format",
|
|
1538
|
+
"reasoning_effort",
|
|
1539
|
+
"verbosity",
|
|
1540
|
+
"seed",
|
|
1541
|
+
"stop",
|
|
1542
|
+
"stream_options",
|
|
1543
|
+
"thinking",
|
|
1544
|
+
"temperature",
|
|
1545
|
+
"top_p",
|
|
1546
|
+
"top_k",
|
|
1547
|
+
"tool_choice",
|
|
1548
|
+
"parallel_tool_calls",
|
|
1549
|
+
"modalities",
|
|
1550
|
+
"guardrails",
|
|
1551
|
+
"fallbacks",
|
|
1552
|
+
"retry",
|
|
1553
|
+
"cache",
|
|
1554
|
+
"load_balancer",
|
|
1555
|
+
"timeout",
|
|
1556
|
+
]
|
|
1557
|
+
)
|
|
1558
|
+
nullable_fields = set(
|
|
1559
|
+
[
|
|
1560
|
+
"audio",
|
|
1561
|
+
"frequency_penalty",
|
|
1562
|
+
"max_tokens",
|
|
1563
|
+
"max_completion_tokens",
|
|
1564
|
+
"logprobs",
|
|
1565
|
+
"top_logprobs",
|
|
1566
|
+
"n",
|
|
1567
|
+
"presence_penalty",
|
|
1568
|
+
"seed",
|
|
1569
|
+
"stop",
|
|
1570
|
+
"stream_options",
|
|
1571
|
+
"temperature",
|
|
1572
|
+
"top_p",
|
|
1573
|
+
"top_k",
|
|
1574
|
+
"modalities",
|
|
1575
|
+
]
|
|
1576
|
+
)
|
|
1078
1577
|
serialized = handler(self)
|
|
1079
|
-
|
|
1080
1578
|
m = {}
|
|
1081
1579
|
|
|
1082
1580
|
for n, f in type(self).model_fields.items():
|
|
1083
1581
|
k = f.alias or n
|
|
1084
1582
|
val = serialized.get(k)
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
):
|
|
1098
|
-
m[k] = val
|
|
1583
|
+
is_nullable_and_explicitly_set = (
|
|
1584
|
+
k in nullable_fields
|
|
1585
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
1586
|
+
)
|
|
1587
|
+
|
|
1588
|
+
if val != UNSET_SENTINEL:
|
|
1589
|
+
if (
|
|
1590
|
+
val is not None
|
|
1591
|
+
or k not in optional_fields
|
|
1592
|
+
or is_nullable_and_explicitly_set
|
|
1593
|
+
):
|
|
1594
|
+
m[k] = val
|
|
1099
1595
|
|
|
1100
1596
|
return m
|
|
1101
1597
|
|
|
1102
1598
|
|
|
1103
|
-
class
|
|
1599
|
+
class CreateAgentRequestFallbackModelConfigurationRetryTypedDict(TypedDict):
|
|
1104
1600
|
r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
|
|
1105
1601
|
|
|
1106
1602
|
count: NotRequired[float]
|
|
@@ -1109,7 +1605,7 @@ class FallbackModelConfigurationRetryTypedDict(TypedDict):
|
|
|
1109
1605
|
r"""HTTP status codes that trigger retry logic"""
|
|
1110
1606
|
|
|
1111
1607
|
|
|
1112
|
-
class
|
|
1608
|
+
class CreateAgentRequestFallbackModelConfigurationRetry(BaseModel):
|
|
1113
1609
|
r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
|
|
1114
1610
|
|
|
1115
1611
|
count: Optional[float] = 3
|
|
@@ -1118,6 +1614,22 @@ class FallbackModelConfigurationRetry(BaseModel):
|
|
|
1118
1614
|
on_codes: Optional[List[float]] = None
|
|
1119
1615
|
r"""HTTP status codes that trigger retry logic"""
|
|
1120
1616
|
|
|
1617
|
+
@model_serializer(mode="wrap")
|
|
1618
|
+
def serialize_model(self, handler):
|
|
1619
|
+
optional_fields = set(["count", "on_codes"])
|
|
1620
|
+
serialized = handler(self)
|
|
1621
|
+
m = {}
|
|
1622
|
+
|
|
1623
|
+
for n, f in type(self).model_fields.items():
|
|
1624
|
+
k = f.alias or n
|
|
1625
|
+
val = serialized.get(k)
|
|
1626
|
+
|
|
1627
|
+
if val != UNSET_SENTINEL:
|
|
1628
|
+
if val is not None or k not in optional_fields:
|
|
1629
|
+
m[k] = val
|
|
1630
|
+
|
|
1631
|
+
return m
|
|
1632
|
+
|
|
1121
1633
|
|
|
1122
1634
|
class FallbackModelConfiguration2TypedDict(TypedDict):
|
|
1123
1635
|
r"""Fallback model configuration with optional parameters and retry settings."""
|
|
@@ -1126,7 +1638,7 @@ class FallbackModelConfiguration2TypedDict(TypedDict):
|
|
|
1126
1638
|
r"""A fallback model ID string. Must support tool calling."""
|
|
1127
1639
|
parameters: NotRequired[FallbackModelConfigurationParametersTypedDict]
|
|
1128
1640
|
r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
|
|
1129
|
-
retry: NotRequired[
|
|
1641
|
+
retry: NotRequired[CreateAgentRequestFallbackModelConfigurationRetryTypedDict]
|
|
1130
1642
|
r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
|
|
1131
1643
|
|
|
1132
1644
|
|
|
@@ -1139,9 +1651,25 @@ class FallbackModelConfiguration2(BaseModel):
|
|
|
1139
1651
|
parameters: Optional[FallbackModelConfigurationParameters] = None
|
|
1140
1652
|
r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
|
|
1141
1653
|
|
|
1142
|
-
retry: Optional[
|
|
1654
|
+
retry: Optional[CreateAgentRequestFallbackModelConfigurationRetry] = None
|
|
1143
1655
|
r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
|
|
1144
1656
|
|
|
1657
|
+
@model_serializer(mode="wrap")
|
|
1658
|
+
def serialize_model(self, handler):
|
|
1659
|
+
optional_fields = set(["parameters", "retry"])
|
|
1660
|
+
serialized = handler(self)
|
|
1661
|
+
m = {}
|
|
1662
|
+
|
|
1663
|
+
for n, f in type(self).model_fields.items():
|
|
1664
|
+
k = f.alias or n
|
|
1665
|
+
val = serialized.get(k)
|
|
1666
|
+
|
|
1667
|
+
if val != UNSET_SENTINEL:
|
|
1668
|
+
if val is not None or k not in optional_fields:
|
|
1669
|
+
m[k] = val
|
|
1670
|
+
|
|
1671
|
+
return m
|
|
1672
|
+
|
|
1145
1673
|
|
|
1146
1674
|
FallbackModelConfigurationTypedDict = TypeAliasType(
|
|
1147
1675
|
"FallbackModelConfigurationTypedDict",
|
|
@@ -1164,7 +1692,7 @@ CreateAgentRequestToolApprovalRequired = Literal[
|
|
|
1164
1692
|
r"""If all, the agent will require approval for all tools. If respect_tool, the agent will require approval for tools that have the requires_approval flag set to true. If none, the agent will not require approval for any tools."""
|
|
1165
1693
|
|
|
1166
1694
|
|
|
1167
|
-
|
|
1695
|
+
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools16Type = (
|
|
1168
1696
|
Literal["mcp",]
|
|
1169
1697
|
)
|
|
1170
1698
|
r"""MCP tool type"""
|
|
@@ -1176,7 +1704,7 @@ class MCPToolTypedDict(TypedDict):
|
|
|
1176
1704
|
tool_id: str
|
|
1177
1705
|
r"""The ID of the specific nested tool within the MCP server"""
|
|
1178
1706
|
type: NotRequired[
|
|
1179
|
-
|
|
1707
|
+
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools16Type
|
|
1180
1708
|
]
|
|
1181
1709
|
r"""MCP tool type"""
|
|
1182
1710
|
key: NotRequired[str]
|
|
@@ -1194,7 +1722,7 @@ class MCPTool(BaseModel):
|
|
|
1194
1722
|
r"""The ID of the specific nested tool within the MCP server"""
|
|
1195
1723
|
|
|
1196
1724
|
type: Optional[
|
|
1197
|
-
|
|
1725
|
+
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools16Type
|
|
1198
1726
|
] = "mcp"
|
|
1199
1727
|
r"""MCP tool type"""
|
|
1200
1728
|
|
|
@@ -1207,6 +1735,77 @@ class MCPTool(BaseModel):
|
|
|
1207
1735
|
requires_approval: Optional[bool] = False
|
|
1208
1736
|
r"""Whether this tool requires approval before execution"""
|
|
1209
1737
|
|
|
1738
|
+
@model_serializer(mode="wrap")
|
|
1739
|
+
def serialize_model(self, handler):
|
|
1740
|
+
optional_fields = set(["type", "key", "id", "requires_approval"])
|
|
1741
|
+
serialized = handler(self)
|
|
1742
|
+
m = {}
|
|
1743
|
+
|
|
1744
|
+
for n, f in type(self).model_fields.items():
|
|
1745
|
+
k = f.alias or n
|
|
1746
|
+
val = serialized.get(k)
|
|
1747
|
+
|
|
1748
|
+
if val != UNSET_SENTINEL:
|
|
1749
|
+
if val is not None or k not in optional_fields:
|
|
1750
|
+
m[k] = val
|
|
1751
|
+
|
|
1752
|
+
return m
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools15Type = (
|
|
1756
|
+
Literal["json_schema",]
|
|
1757
|
+
)
|
|
1758
|
+
r"""JSON Schema tool type"""
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
class JSONSchemaToolTypedDict(TypedDict):
|
|
1762
|
+
r"""Enforces structured output format using JSON Schema. Must reference a pre-created JSON Schema tool by key or id."""
|
|
1763
|
+
|
|
1764
|
+
type: NotRequired[
|
|
1765
|
+
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools15Type
|
|
1766
|
+
]
|
|
1767
|
+
r"""JSON Schema tool type"""
|
|
1768
|
+
key: NotRequired[str]
|
|
1769
|
+
r"""The key of the pre-created JSON Schema tool"""
|
|
1770
|
+
id: NotRequired[str]
|
|
1771
|
+
r"""The ID of the pre-created JSON Schema tool"""
|
|
1772
|
+
requires_approval: NotRequired[bool]
|
|
1773
|
+
r"""Whether this tool requires approval before execution"""
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
class JSONSchemaTool(BaseModel):
|
|
1777
|
+
r"""Enforces structured output format using JSON Schema. Must reference a pre-created JSON Schema tool by key or id."""
|
|
1778
|
+
|
|
1779
|
+
type: Optional[
|
|
1780
|
+
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools15Type
|
|
1781
|
+
] = "json_schema"
|
|
1782
|
+
r"""JSON Schema tool type"""
|
|
1783
|
+
|
|
1784
|
+
key: Optional[str] = None
|
|
1785
|
+
r"""The key of the pre-created JSON Schema tool"""
|
|
1786
|
+
|
|
1787
|
+
id: Optional[str] = None
|
|
1788
|
+
r"""The ID of the pre-created JSON Schema tool"""
|
|
1789
|
+
|
|
1790
|
+
requires_approval: Optional[bool] = False
|
|
1791
|
+
r"""Whether this tool requires approval before execution"""
|
|
1792
|
+
|
|
1793
|
+
@model_serializer(mode="wrap")
|
|
1794
|
+
def serialize_model(self, handler):
|
|
1795
|
+
optional_fields = set(["type", "key", "id", "requires_approval"])
|
|
1796
|
+
serialized = handler(self)
|
|
1797
|
+
m = {}
|
|
1798
|
+
|
|
1799
|
+
for n, f in type(self).model_fields.items():
|
|
1800
|
+
k = f.alias or n
|
|
1801
|
+
val = serialized.get(k)
|
|
1802
|
+
|
|
1803
|
+
if val != UNSET_SENTINEL:
|
|
1804
|
+
if val is not None or k not in optional_fields:
|
|
1805
|
+
m[k] = val
|
|
1806
|
+
|
|
1807
|
+
return m
|
|
1808
|
+
|
|
1210
1809
|
|
|
1211
1810
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools14Type = (
|
|
1212
1811
|
Literal["function",]
|
|
@@ -1246,6 +1845,22 @@ class FunctionTool(BaseModel):
|
|
|
1246
1845
|
requires_approval: Optional[bool] = False
|
|
1247
1846
|
r"""Whether this tool requires approval before execution"""
|
|
1248
1847
|
|
|
1848
|
+
@model_serializer(mode="wrap")
|
|
1849
|
+
def serialize_model(self, handler):
|
|
1850
|
+
optional_fields = set(["type", "key", "id", "requires_approval"])
|
|
1851
|
+
serialized = handler(self)
|
|
1852
|
+
m = {}
|
|
1853
|
+
|
|
1854
|
+
for n, f in type(self).model_fields.items():
|
|
1855
|
+
k = f.alias or n
|
|
1856
|
+
val = serialized.get(k)
|
|
1857
|
+
|
|
1858
|
+
if val != UNSET_SENTINEL:
|
|
1859
|
+
if val is not None or k not in optional_fields:
|
|
1860
|
+
m[k] = val
|
|
1861
|
+
|
|
1862
|
+
return m
|
|
1863
|
+
|
|
1249
1864
|
|
|
1250
1865
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools13Type = (
|
|
1251
1866
|
Literal["code",]
|
|
@@ -1285,6 +1900,22 @@ class CodeExecutionTool(BaseModel):
|
|
|
1285
1900
|
requires_approval: Optional[bool] = False
|
|
1286
1901
|
r"""Whether this tool requires approval before execution"""
|
|
1287
1902
|
|
|
1903
|
+
@model_serializer(mode="wrap")
|
|
1904
|
+
def serialize_model(self, handler):
|
|
1905
|
+
optional_fields = set(["type", "key", "id", "requires_approval"])
|
|
1906
|
+
serialized = handler(self)
|
|
1907
|
+
m = {}
|
|
1908
|
+
|
|
1909
|
+
for n, f in type(self).model_fields.items():
|
|
1910
|
+
k = f.alias or n
|
|
1911
|
+
val = serialized.get(k)
|
|
1912
|
+
|
|
1913
|
+
if val != UNSET_SENTINEL:
|
|
1914
|
+
if val is not None or k not in optional_fields:
|
|
1915
|
+
m[k] = val
|
|
1916
|
+
|
|
1917
|
+
return m
|
|
1918
|
+
|
|
1288
1919
|
|
|
1289
1920
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools12Type = (
|
|
1290
1921
|
Literal["http",]
|
|
@@ -1324,6 +1955,22 @@ class HTTPTool(BaseModel):
|
|
|
1324
1955
|
requires_approval: Optional[bool] = False
|
|
1325
1956
|
r"""Whether this tool requires approval before execution"""
|
|
1326
1957
|
|
|
1958
|
+
@model_serializer(mode="wrap")
|
|
1959
|
+
def serialize_model(self, handler):
|
|
1960
|
+
optional_fields = set(["type", "key", "id", "requires_approval"])
|
|
1961
|
+
serialized = handler(self)
|
|
1962
|
+
m = {}
|
|
1963
|
+
|
|
1964
|
+
for n, f in type(self).model_fields.items():
|
|
1965
|
+
k = f.alias or n
|
|
1966
|
+
val = serialized.get(k)
|
|
1967
|
+
|
|
1968
|
+
if val != UNSET_SENTINEL:
|
|
1969
|
+
if val is not None or k not in optional_fields:
|
|
1970
|
+
m[k] = val
|
|
1971
|
+
|
|
1972
|
+
return m
|
|
1973
|
+
|
|
1327
1974
|
|
|
1328
1975
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools11Type = (
|
|
1329
1976
|
Literal["current_date",]
|
|
@@ -1350,6 +1997,22 @@ class CurrentDateTool(BaseModel):
|
|
|
1350
1997
|
requires_approval: Optional[bool] = None
|
|
1351
1998
|
r"""Whether this tool requires approval before execution"""
|
|
1352
1999
|
|
|
2000
|
+
@model_serializer(mode="wrap")
|
|
2001
|
+
def serialize_model(self, handler):
|
|
2002
|
+
optional_fields = set(["requires_approval"])
|
|
2003
|
+
serialized = handler(self)
|
|
2004
|
+
m = {}
|
|
2005
|
+
|
|
2006
|
+
for n, f in type(self).model_fields.items():
|
|
2007
|
+
k = f.alias or n
|
|
2008
|
+
val = serialized.get(k)
|
|
2009
|
+
|
|
2010
|
+
if val != UNSET_SENTINEL:
|
|
2011
|
+
if val is not None or k not in optional_fields:
|
|
2012
|
+
m[k] = val
|
|
2013
|
+
|
|
2014
|
+
return m
|
|
2015
|
+
|
|
1353
2016
|
|
|
1354
2017
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools10Type = (
|
|
1355
2018
|
Literal["query_knowledge_base",]
|
|
@@ -1376,6 +2039,22 @@ class QueryKnowledgeBaseTool(BaseModel):
|
|
|
1376
2039
|
requires_approval: Optional[bool] = None
|
|
1377
2040
|
r"""Whether this tool requires approval before execution"""
|
|
1378
2041
|
|
|
2042
|
+
@model_serializer(mode="wrap")
|
|
2043
|
+
def serialize_model(self, handler):
|
|
2044
|
+
optional_fields = set(["requires_approval"])
|
|
2045
|
+
serialized = handler(self)
|
|
2046
|
+
m = {}
|
|
2047
|
+
|
|
2048
|
+
for n, f in type(self).model_fields.items():
|
|
2049
|
+
k = f.alias or n
|
|
2050
|
+
val = serialized.get(k)
|
|
2051
|
+
|
|
2052
|
+
if val != UNSET_SENTINEL:
|
|
2053
|
+
if val is not None or k not in optional_fields:
|
|
2054
|
+
m[k] = val
|
|
2055
|
+
|
|
2056
|
+
return m
|
|
2057
|
+
|
|
1379
2058
|
|
|
1380
2059
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools9Type = (
|
|
1381
2060
|
Literal["retrieve_knowledge_bases",]
|
|
@@ -1398,6 +2077,22 @@ class RetrieveKnowledgeBasesTool(BaseModel):
|
|
|
1398
2077
|
requires_approval: Optional[bool] = None
|
|
1399
2078
|
r"""Whether this tool requires approval before execution"""
|
|
1400
2079
|
|
|
2080
|
+
@model_serializer(mode="wrap")
|
|
2081
|
+
def serialize_model(self, handler):
|
|
2082
|
+
optional_fields = set(["requires_approval"])
|
|
2083
|
+
serialized = handler(self)
|
|
2084
|
+
m = {}
|
|
2085
|
+
|
|
2086
|
+
for n, f in type(self).model_fields.items():
|
|
2087
|
+
k = f.alias or n
|
|
2088
|
+
val = serialized.get(k)
|
|
2089
|
+
|
|
2090
|
+
if val != UNSET_SENTINEL:
|
|
2091
|
+
if val is not None or k not in optional_fields:
|
|
2092
|
+
m[k] = val
|
|
2093
|
+
|
|
2094
|
+
return m
|
|
2095
|
+
|
|
1401
2096
|
|
|
1402
2097
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsTools8Type = (
|
|
1403
2098
|
Literal["delete_memory_document",]
|
|
@@ -1420,6 +2115,22 @@ class DeleteMemoryDocumentTool(BaseModel):
|
|
|
1420
2115
|
requires_approval: Optional[bool] = None
|
|
1421
2116
|
r"""Whether this tool requires approval before execution"""
|
|
1422
2117
|
|
|
2118
|
+
@model_serializer(mode="wrap")
|
|
2119
|
+
def serialize_model(self, handler):
|
|
2120
|
+
optional_fields = set(["requires_approval"])
|
|
2121
|
+
serialized = handler(self)
|
|
2122
|
+
m = {}
|
|
2123
|
+
|
|
2124
|
+
for n, f in type(self).model_fields.items():
|
|
2125
|
+
k = f.alias or n
|
|
2126
|
+
val = serialized.get(k)
|
|
2127
|
+
|
|
2128
|
+
if val != UNSET_SENTINEL:
|
|
2129
|
+
if val is not None or k not in optional_fields:
|
|
2130
|
+
m[k] = val
|
|
2131
|
+
|
|
2132
|
+
return m
|
|
2133
|
+
|
|
1423
2134
|
|
|
1424
2135
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsToolsType = Literal[
|
|
1425
2136
|
"retrieve_memory_stores",
|
|
@@ -1442,6 +2153,22 @@ class RetrieveMemoryStoresTool(BaseModel):
|
|
|
1442
2153
|
requires_approval: Optional[bool] = None
|
|
1443
2154
|
r"""Whether this tool requires approval before execution"""
|
|
1444
2155
|
|
|
2156
|
+
@model_serializer(mode="wrap")
|
|
2157
|
+
def serialize_model(self, handler):
|
|
2158
|
+
optional_fields = set(["requires_approval"])
|
|
2159
|
+
serialized = handler(self)
|
|
2160
|
+
m = {}
|
|
2161
|
+
|
|
2162
|
+
for n, f in type(self).model_fields.items():
|
|
2163
|
+
k = f.alias or n
|
|
2164
|
+
val = serialized.get(k)
|
|
2165
|
+
|
|
2166
|
+
if val != UNSET_SENTINEL:
|
|
2167
|
+
if val is not None or k not in optional_fields:
|
|
2168
|
+
m[k] = val
|
|
2169
|
+
|
|
2170
|
+
return m
|
|
2171
|
+
|
|
1445
2172
|
|
|
1446
2173
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodySettingsType = Literal[
|
|
1447
2174
|
"write_memory_store",
|
|
@@ -1464,6 +2191,22 @@ class WriteMemoryStoreTool(BaseModel):
|
|
|
1464
2191
|
requires_approval: Optional[bool] = None
|
|
1465
2192
|
r"""Whether this tool requires approval before execution"""
|
|
1466
2193
|
|
|
2194
|
+
@model_serializer(mode="wrap")
|
|
2195
|
+
def serialize_model(self, handler):
|
|
2196
|
+
optional_fields = set(["requires_approval"])
|
|
2197
|
+
serialized = handler(self)
|
|
2198
|
+
m = {}
|
|
2199
|
+
|
|
2200
|
+
for n, f in type(self).model_fields.items():
|
|
2201
|
+
k = f.alias or n
|
|
2202
|
+
val = serialized.get(k)
|
|
2203
|
+
|
|
2204
|
+
if val != UNSET_SENTINEL:
|
|
2205
|
+
if val is not None or k not in optional_fields:
|
|
2206
|
+
m[k] = val
|
|
2207
|
+
|
|
2208
|
+
return m
|
|
2209
|
+
|
|
1467
2210
|
|
|
1468
2211
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestRequestBodyType = Literal[
|
|
1469
2212
|
"query_memory_store",
|
|
@@ -1486,6 +2229,22 @@ class QueryMemoryStoreTool(BaseModel):
|
|
|
1486
2229
|
requires_approval: Optional[bool] = None
|
|
1487
2230
|
r"""Whether this tool requires approval before execution"""
|
|
1488
2231
|
|
|
2232
|
+
@model_serializer(mode="wrap")
|
|
2233
|
+
def serialize_model(self, handler):
|
|
2234
|
+
optional_fields = set(["requires_approval"])
|
|
2235
|
+
serialized = handler(self)
|
|
2236
|
+
m = {}
|
|
2237
|
+
|
|
2238
|
+
for n, f in type(self).model_fields.items():
|
|
2239
|
+
k = f.alias or n
|
|
2240
|
+
val = serialized.get(k)
|
|
2241
|
+
|
|
2242
|
+
if val != UNSET_SENTINEL:
|
|
2243
|
+
if val is not None or k not in optional_fields:
|
|
2244
|
+
m[k] = val
|
|
2245
|
+
|
|
2246
|
+
return m
|
|
2247
|
+
|
|
1489
2248
|
|
|
1490
2249
|
CreateAgentRequestAgentToolInputCRUDAgentsRequestType = Literal["retrieve_agents",]
|
|
1491
2250
|
|
|
@@ -1506,6 +2265,22 @@ class RetrieveAgentsTool(BaseModel):
|
|
|
1506
2265
|
requires_approval: Optional[bool] = None
|
|
1507
2266
|
r"""Whether this tool requires approval before execution"""
|
|
1508
2267
|
|
|
2268
|
+
@model_serializer(mode="wrap")
|
|
2269
|
+
def serialize_model(self, handler):
|
|
2270
|
+
optional_fields = set(["requires_approval"])
|
|
2271
|
+
serialized = handler(self)
|
|
2272
|
+
m = {}
|
|
2273
|
+
|
|
2274
|
+
for n, f in type(self).model_fields.items():
|
|
2275
|
+
k = f.alias or n
|
|
2276
|
+
val = serialized.get(k)
|
|
2277
|
+
|
|
2278
|
+
if val != UNSET_SENTINEL:
|
|
2279
|
+
if val is not None or k not in optional_fields:
|
|
2280
|
+
m[k] = val
|
|
2281
|
+
|
|
2282
|
+
return m
|
|
2283
|
+
|
|
1509
2284
|
|
|
1510
2285
|
CreateAgentRequestAgentToolInputCRUDAgentsType = Literal["call_sub_agent",]
|
|
1511
2286
|
|
|
@@ -1526,6 +2301,22 @@ class CallSubAgentTool(BaseModel):
|
|
|
1526
2301
|
requires_approval: Optional[bool] = None
|
|
1527
2302
|
r"""Whether this tool requires approval before execution"""
|
|
1528
2303
|
|
|
2304
|
+
@model_serializer(mode="wrap")
|
|
2305
|
+
def serialize_model(self, handler):
|
|
2306
|
+
optional_fields = set(["requires_approval"])
|
|
2307
|
+
serialized = handler(self)
|
|
2308
|
+
m = {}
|
|
2309
|
+
|
|
2310
|
+
for n, f in type(self).model_fields.items():
|
|
2311
|
+
k = f.alias or n
|
|
2312
|
+
val = serialized.get(k)
|
|
2313
|
+
|
|
2314
|
+
if val != UNSET_SENTINEL:
|
|
2315
|
+
if val is not None or k not in optional_fields:
|
|
2316
|
+
m[k] = val
|
|
2317
|
+
|
|
2318
|
+
return m
|
|
2319
|
+
|
|
1529
2320
|
|
|
1530
2321
|
CreateAgentRequestAgentToolInputCRUDType = Literal["web_scraper",]
|
|
1531
2322
|
|
|
@@ -1546,6 +2337,22 @@ class WebScraperTool(BaseModel):
|
|
|
1546
2337
|
requires_approval: Optional[bool] = None
|
|
1547
2338
|
r"""Whether this tool requires approval before execution"""
|
|
1548
2339
|
|
|
2340
|
+
@model_serializer(mode="wrap")
|
|
2341
|
+
def serialize_model(self, handler):
|
|
2342
|
+
optional_fields = set(["requires_approval"])
|
|
2343
|
+
serialized = handler(self)
|
|
2344
|
+
m = {}
|
|
2345
|
+
|
|
2346
|
+
for n, f in type(self).model_fields.items():
|
|
2347
|
+
k = f.alias or n
|
|
2348
|
+
val = serialized.get(k)
|
|
2349
|
+
|
|
2350
|
+
if val != UNSET_SENTINEL:
|
|
2351
|
+
if val is not None or k not in optional_fields:
|
|
2352
|
+
m[k] = val
|
|
2353
|
+
|
|
2354
|
+
return m
|
|
2355
|
+
|
|
1549
2356
|
|
|
1550
2357
|
AgentToolInputCRUDType = Literal["google_search",]
|
|
1551
2358
|
|
|
@@ -1566,6 +2373,22 @@ class GoogleSearchTool(BaseModel):
|
|
|
1566
2373
|
requires_approval: Optional[bool] = None
|
|
1567
2374
|
r"""Whether this tool requires approval before execution"""
|
|
1568
2375
|
|
|
2376
|
+
@model_serializer(mode="wrap")
|
|
2377
|
+
def serialize_model(self, handler):
|
|
2378
|
+
optional_fields = set(["requires_approval"])
|
|
2379
|
+
serialized = handler(self)
|
|
2380
|
+
m = {}
|
|
2381
|
+
|
|
2382
|
+
for n, f in type(self).model_fields.items():
|
|
2383
|
+
k = f.alias or n
|
|
2384
|
+
val = serialized.get(k)
|
|
2385
|
+
|
|
2386
|
+
if val != UNSET_SENTINEL:
|
|
2387
|
+
if val is not None or k not in optional_fields:
|
|
2388
|
+
m[k] = val
|
|
2389
|
+
|
|
2390
|
+
return m
|
|
2391
|
+
|
|
1569
2392
|
|
|
1570
2393
|
AgentToolInputCRUDTypedDict = TypeAliasType(
|
|
1571
2394
|
"AgentToolInputCRUDTypedDict",
|
|
@@ -1584,10 +2407,11 @@ AgentToolInputCRUDTypedDict = TypeAliasType(
|
|
|
1584
2407
|
HTTPToolTypedDict,
|
|
1585
2408
|
CodeExecutionToolTypedDict,
|
|
1586
2409
|
FunctionToolTypedDict,
|
|
2410
|
+
JSONSchemaToolTypedDict,
|
|
1587
2411
|
MCPToolTypedDict,
|
|
1588
2412
|
],
|
|
1589
2413
|
)
|
|
1590
|
-
r"""Tool configuration for agent create/update operations. Built-in tools only require a type, while custom tools (HTTP, Code, Function, MCP) must reference pre-created tools by key or id."""
|
|
2414
|
+
r"""Tool configuration for agent create/update operations. Built-in tools only require a type, while custom tools (HTTP, Code, Function, JSON Schema, MCP) must reference pre-created tools by key or id."""
|
|
1591
2415
|
|
|
1592
2416
|
|
|
1593
2417
|
AgentToolInputCRUD = TypeAliasType(
|
|
@@ -1607,10 +2431,11 @@ AgentToolInputCRUD = TypeAliasType(
|
|
|
1607
2431
|
HTTPTool,
|
|
1608
2432
|
CodeExecutionTool,
|
|
1609
2433
|
FunctionTool,
|
|
2434
|
+
JSONSchemaTool,
|
|
1610
2435
|
MCPTool,
|
|
1611
2436
|
],
|
|
1612
2437
|
)
|
|
1613
|
-
r"""Tool configuration for agent create/update operations. Built-in tools only require a type, while custom tools (HTTP, Code, Function, MCP) must reference pre-created tools by key or id."""
|
|
2438
|
+
r"""Tool configuration for agent create/update operations. Built-in tools only require a type, while custom tools (HTTP, Code, Function, JSON Schema, MCP) must reference pre-created tools by key or id."""
|
|
1614
2439
|
|
|
1615
2440
|
|
|
1616
2441
|
CreateAgentRequestExecuteOn = Literal[
|
|
@@ -1639,6 +2464,22 @@ class CreateAgentRequestEvaluators(BaseModel):
|
|
|
1639
2464
|
sample_rate: Optional[float] = 50
|
|
1640
2465
|
r"""The percentage of executions to evaluate with this evaluator (1-100). For example, a value of 50 means the evaluator will run on approximately half of the executions."""
|
|
1641
2466
|
|
|
2467
|
+
@model_serializer(mode="wrap")
|
|
2468
|
+
def serialize_model(self, handler):
|
|
2469
|
+
optional_fields = set(["sample_rate"])
|
|
2470
|
+
serialized = handler(self)
|
|
2471
|
+
m = {}
|
|
2472
|
+
|
|
2473
|
+
for n, f in type(self).model_fields.items():
|
|
2474
|
+
k = f.alias or n
|
|
2475
|
+
val = serialized.get(k)
|
|
2476
|
+
|
|
2477
|
+
if val != UNSET_SENTINEL:
|
|
2478
|
+
if val is not None or k not in optional_fields:
|
|
2479
|
+
m[k] = val
|
|
2480
|
+
|
|
2481
|
+
return m
|
|
2482
|
+
|
|
1642
2483
|
|
|
1643
2484
|
CreateAgentRequestAgentsExecuteOn = Literal[
|
|
1644
2485
|
"input",
|
|
@@ -1666,6 +2507,22 @@ class CreateAgentRequestGuardrails(BaseModel):
|
|
|
1666
2507
|
sample_rate: Optional[float] = 50
|
|
1667
2508
|
r"""The percentage of executions to evaluate with this evaluator (1-100). For example, a value of 50 means the evaluator will run on approximately half of the executions."""
|
|
1668
2509
|
|
|
2510
|
+
@model_serializer(mode="wrap")
|
|
2511
|
+
def serialize_model(self, handler):
|
|
2512
|
+
optional_fields = set(["sample_rate"])
|
|
2513
|
+
serialized = handler(self)
|
|
2514
|
+
m = {}
|
|
2515
|
+
|
|
2516
|
+
for n, f in type(self).model_fields.items():
|
|
2517
|
+
k = f.alias or n
|
|
2518
|
+
val = serialized.get(k)
|
|
2519
|
+
|
|
2520
|
+
if val != UNSET_SENTINEL:
|
|
2521
|
+
if val is not None or k not in optional_fields:
|
|
2522
|
+
m[k] = val
|
|
2523
|
+
|
|
2524
|
+
return m
|
|
2525
|
+
|
|
1669
2526
|
|
|
1670
2527
|
class CreateAgentRequestSettingsTypedDict(TypedDict):
|
|
1671
2528
|
r"""Configuration settings for the agent's behavior"""
|
|
@@ -1707,6 +2564,31 @@ class CreateAgentRequestSettings(BaseModel):
|
|
|
1707
2564
|
guardrails: Optional[List[CreateAgentRequestGuardrails]] = None
|
|
1708
2565
|
r"""Configuration for a guardrail applied to the agent"""
|
|
1709
2566
|
|
|
2567
|
+
@model_serializer(mode="wrap")
|
|
2568
|
+
def serialize_model(self, handler):
|
|
2569
|
+
optional_fields = set(
|
|
2570
|
+
[
|
|
2571
|
+
"max_iterations",
|
|
2572
|
+
"max_execution_time",
|
|
2573
|
+
"tool_approval_required",
|
|
2574
|
+
"tools",
|
|
2575
|
+
"evaluators",
|
|
2576
|
+
"guardrails",
|
|
2577
|
+
]
|
|
2578
|
+
)
|
|
2579
|
+
serialized = handler(self)
|
|
2580
|
+
m = {}
|
|
2581
|
+
|
|
2582
|
+
for n, f in type(self).model_fields.items():
|
|
2583
|
+
k = f.alias or n
|
|
2584
|
+
val = serialized.get(k)
|
|
2585
|
+
|
|
2586
|
+
if val != UNSET_SENTINEL:
|
|
2587
|
+
if val is not None or k not in optional_fields:
|
|
2588
|
+
m[k] = val
|
|
2589
|
+
|
|
2590
|
+
return m
|
|
2591
|
+
|
|
1710
2592
|
|
|
1711
2593
|
class KnowledgeBasesTypedDict(TypedDict):
|
|
1712
2594
|
knowledge_id: str
|
|
@@ -1732,6 +2614,22 @@ class TeamOfAgents(BaseModel):
|
|
|
1732
2614
|
role: Optional[str] = None
|
|
1733
2615
|
r"""The role of the agent in this context. This is used to give extra information to the leader to help it decide which agent to hand off to."""
|
|
1734
2616
|
|
|
2617
|
+
@model_serializer(mode="wrap")
|
|
2618
|
+
def serialize_model(self, handler):
|
|
2619
|
+
optional_fields = set(["role"])
|
|
2620
|
+
serialized = handler(self)
|
|
2621
|
+
m = {}
|
|
2622
|
+
|
|
2623
|
+
for n, f in type(self).model_fields.items():
|
|
2624
|
+
k = f.alias or n
|
|
2625
|
+
val = serialized.get(k)
|
|
2626
|
+
|
|
2627
|
+
if val != UNSET_SENTINEL:
|
|
2628
|
+
if val is not None or k not in optional_fields:
|
|
2629
|
+
m[k] = val
|
|
2630
|
+
|
|
2631
|
+
return m
|
|
2632
|
+
|
|
1735
2633
|
|
|
1736
2634
|
Source = Literal[
|
|
1737
2635
|
"internal",
|
|
@@ -1821,6 +2719,33 @@ class CreateAgentRequestRequestBody(BaseModel):
|
|
|
1821
2719
|
|
|
1822
2720
|
source: Optional[Source] = None
|
|
1823
2721
|
|
|
2722
|
+
@model_serializer(mode="wrap")
|
|
2723
|
+
def serialize_model(self, handler):
|
|
2724
|
+
optional_fields = set(
|
|
2725
|
+
[
|
|
2726
|
+
"display_name",
|
|
2727
|
+
"system_prompt",
|
|
2728
|
+
"fallback_models",
|
|
2729
|
+
"memory_stores",
|
|
2730
|
+
"knowledge_bases",
|
|
2731
|
+
"team_of_agents",
|
|
2732
|
+
"variables",
|
|
2733
|
+
"source",
|
|
2734
|
+
]
|
|
2735
|
+
)
|
|
2736
|
+
serialized = handler(self)
|
|
2737
|
+
m = {}
|
|
2738
|
+
|
|
2739
|
+
for n, f in type(self).model_fields.items():
|
|
2740
|
+
k = f.alias or n
|
|
2741
|
+
val = serialized.get(k)
|
|
2742
|
+
|
|
2743
|
+
if val != UNSET_SENTINEL:
|
|
2744
|
+
if val is not None or k not in optional_fields:
|
|
2745
|
+
m[k] = val
|
|
2746
|
+
|
|
2747
|
+
return m
|
|
2748
|
+
|
|
1824
2749
|
|
|
1825
2750
|
CreateAgentRequestStatus = Literal[
|
|
1826
2751
|
"live",
|
|
@@ -1900,6 +2825,32 @@ class CreateAgentRequestTools(BaseModel):
|
|
|
1900
2825
|
timeout: Optional[float] = 120
|
|
1901
2826
|
r"""Tool execution timeout in seconds (default: 2 minutes, max: 10 minutes)"""
|
|
1902
2827
|
|
|
2828
|
+
@model_serializer(mode="wrap")
|
|
2829
|
+
def serialize_model(self, handler):
|
|
2830
|
+
optional_fields = set(
|
|
2831
|
+
[
|
|
2832
|
+
"key",
|
|
2833
|
+
"display_name",
|
|
2834
|
+
"description",
|
|
2835
|
+
"requires_approval",
|
|
2836
|
+
"tool_id",
|
|
2837
|
+
"conditions",
|
|
2838
|
+
"timeout",
|
|
2839
|
+
]
|
|
2840
|
+
)
|
|
2841
|
+
serialized = handler(self)
|
|
2842
|
+
m = {}
|
|
2843
|
+
|
|
2844
|
+
for n, f in type(self).model_fields.items():
|
|
2845
|
+
k = f.alias or n
|
|
2846
|
+
val = serialized.get(k)
|
|
2847
|
+
|
|
2848
|
+
if val != UNSET_SENTINEL:
|
|
2849
|
+
if val is not None or k not in optional_fields:
|
|
2850
|
+
m[k] = val
|
|
2851
|
+
|
|
2852
|
+
return m
|
|
2853
|
+
|
|
1903
2854
|
|
|
1904
2855
|
CreateAgentRequestAgentsResponseExecuteOn = Literal[
|
|
1905
2856
|
"input",
|
|
@@ -1927,6 +2878,22 @@ class CreateAgentRequestAgentsEvaluators(BaseModel):
|
|
|
1927
2878
|
sample_rate: Optional[float] = 50
|
|
1928
2879
|
r"""The percentage of executions to evaluate with this evaluator (1-100). For example, a value of 50 means the evaluator will run on approximately half of the executions."""
|
|
1929
2880
|
|
|
2881
|
+
@model_serializer(mode="wrap")
|
|
2882
|
+
def serialize_model(self, handler):
|
|
2883
|
+
optional_fields = set(["sample_rate"])
|
|
2884
|
+
serialized = handler(self)
|
|
2885
|
+
m = {}
|
|
2886
|
+
|
|
2887
|
+
for n, f in type(self).model_fields.items():
|
|
2888
|
+
k = f.alias or n
|
|
2889
|
+
val = serialized.get(k)
|
|
2890
|
+
|
|
2891
|
+
if val != UNSET_SENTINEL:
|
|
2892
|
+
if val is not None or k not in optional_fields:
|
|
2893
|
+
m[k] = val
|
|
2894
|
+
|
|
2895
|
+
return m
|
|
2896
|
+
|
|
1930
2897
|
|
|
1931
2898
|
CreateAgentRequestAgentsResponse201ExecuteOn = Literal[
|
|
1932
2899
|
"input",
|
|
@@ -1954,6 +2921,22 @@ class CreateAgentRequestAgentsGuardrails(BaseModel):
|
|
|
1954
2921
|
sample_rate: Optional[float] = 50
|
|
1955
2922
|
r"""The percentage of executions to evaluate with this evaluator (1-100). For example, a value of 50 means the evaluator will run on approximately half of the executions."""
|
|
1956
2923
|
|
|
2924
|
+
@model_serializer(mode="wrap")
|
|
2925
|
+
def serialize_model(self, handler):
|
|
2926
|
+
optional_fields = set(["sample_rate"])
|
|
2927
|
+
serialized = handler(self)
|
|
2928
|
+
m = {}
|
|
2929
|
+
|
|
2930
|
+
for n, f in type(self).model_fields.items():
|
|
2931
|
+
k = f.alias or n
|
|
2932
|
+
val = serialized.get(k)
|
|
2933
|
+
|
|
2934
|
+
if val != UNSET_SENTINEL:
|
|
2935
|
+
if val is not None or k not in optional_fields:
|
|
2936
|
+
m[k] = val
|
|
2937
|
+
|
|
2938
|
+
return m
|
|
2939
|
+
|
|
1957
2940
|
|
|
1958
2941
|
class CreateAgentRequestAgentsSettingsTypedDict(TypedDict):
|
|
1959
2942
|
max_iterations: NotRequired[int]
|
|
@@ -1989,6 +2972,31 @@ class CreateAgentRequestAgentsSettings(BaseModel):
|
|
|
1989
2972
|
guardrails: Optional[List[CreateAgentRequestAgentsGuardrails]] = None
|
|
1990
2973
|
r"""Configuration for a guardrail applied to the agent"""
|
|
1991
2974
|
|
|
2975
|
+
@model_serializer(mode="wrap")
|
|
2976
|
+
def serialize_model(self, handler):
|
|
2977
|
+
optional_fields = set(
|
|
2978
|
+
[
|
|
2979
|
+
"max_iterations",
|
|
2980
|
+
"max_execution_time",
|
|
2981
|
+
"tool_approval_required",
|
|
2982
|
+
"tools",
|
|
2983
|
+
"evaluators",
|
|
2984
|
+
"guardrails",
|
|
2985
|
+
]
|
|
2986
|
+
)
|
|
2987
|
+
serialized = handler(self)
|
|
2988
|
+
m = {}
|
|
2989
|
+
|
|
2990
|
+
for n, f in type(self).model_fields.items():
|
|
2991
|
+
k = f.alias or n
|
|
2992
|
+
val = serialized.get(k)
|
|
2993
|
+
|
|
2994
|
+
if val != UNSET_SENTINEL:
|
|
2995
|
+
if val is not None or k not in optional_fields:
|
|
2996
|
+
m[k] = val
|
|
2997
|
+
|
|
2998
|
+
return m
|
|
2999
|
+
|
|
1992
3000
|
|
|
1993
3001
|
CreateAgentRequestVoice = Literal[
|
|
1994
3002
|
"alloy",
|
|
@@ -2059,6 +3067,22 @@ class CreateAgentRequestResponseFormatAgentsResponseJSONSchema(BaseModel):
|
|
|
2059
3067
|
strict: Optional[bool] = False
|
|
2060
3068
|
r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
|
|
2061
3069
|
|
|
3070
|
+
@model_serializer(mode="wrap")
|
|
3071
|
+
def serialize_model(self, handler):
|
|
3072
|
+
optional_fields = set(["description", "schema", "strict"])
|
|
3073
|
+
serialized = handler(self)
|
|
3074
|
+
m = {}
|
|
3075
|
+
|
|
3076
|
+
for n, f in type(self).model_fields.items():
|
|
3077
|
+
k = f.alias or n
|
|
3078
|
+
val = serialized.get(k)
|
|
3079
|
+
|
|
3080
|
+
if val != UNSET_SENTINEL:
|
|
3081
|
+
if val is not None or k not in optional_fields:
|
|
3082
|
+
m[k] = val
|
|
3083
|
+
|
|
3084
|
+
return m
|
|
3085
|
+
|
|
2062
3086
|
|
|
2063
3087
|
class CreateAgentRequestResponseFormatAgentsResponse201JSONSchemaTypedDict(TypedDict):
|
|
2064
3088
|
r"""
|
|
@@ -2190,6 +3214,22 @@ class CreateAgentRequestStreamOptions(BaseModel):
|
|
|
2190
3214
|
include_usage: Optional[bool] = None
|
|
2191
3215
|
r"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value."""
|
|
2192
3216
|
|
|
3217
|
+
@model_serializer(mode="wrap")
|
|
3218
|
+
def serialize_model(self, handler):
|
|
3219
|
+
optional_fields = set(["include_usage"])
|
|
3220
|
+
serialized = handler(self)
|
|
3221
|
+
m = {}
|
|
3222
|
+
|
|
3223
|
+
for n, f in type(self).model_fields.items():
|
|
3224
|
+
k = f.alias or n
|
|
3225
|
+
val = serialized.get(k)
|
|
3226
|
+
|
|
3227
|
+
if val != UNSET_SENTINEL:
|
|
3228
|
+
if val is not None or k not in optional_fields:
|
|
3229
|
+
m[k] = val
|
|
3230
|
+
|
|
3231
|
+
return m
|
|
3232
|
+
|
|
2193
3233
|
|
|
2194
3234
|
CreateAgentRequestThinkingTypedDict = TypeAliasType(
|
|
2195
3235
|
"CreateAgentRequestThinkingTypedDict",
|
|
@@ -2232,6 +3272,22 @@ class CreateAgentRequestToolChoiceAgents2(BaseModel):
|
|
|
2232
3272
|
type: Optional[CreateAgentRequestToolChoiceAgentsType] = None
|
|
2233
3273
|
r"""The type of the tool. Currently, only function is supported."""
|
|
2234
3274
|
|
|
3275
|
+
@model_serializer(mode="wrap")
|
|
3276
|
+
def serialize_model(self, handler):
|
|
3277
|
+
optional_fields = set(["type"])
|
|
3278
|
+
serialized = handler(self)
|
|
3279
|
+
m = {}
|
|
3280
|
+
|
|
3281
|
+
for n, f in type(self).model_fields.items():
|
|
3282
|
+
k = f.alias or n
|
|
3283
|
+
val = serialized.get(k)
|
|
3284
|
+
|
|
3285
|
+
if val != UNSET_SENTINEL:
|
|
3286
|
+
if val is not None or k not in optional_fields:
|
|
3287
|
+
m[k] = val
|
|
3288
|
+
|
|
3289
|
+
return m
|
|
3290
|
+
|
|
2235
3291
|
|
|
2236
3292
|
CreateAgentRequestToolChoiceAgents1 = Literal[
|
|
2237
3293
|
"none",
|
|
@@ -2257,53 +3313,203 @@ CreateAgentRequestToolChoice = TypeAliasType(
|
|
|
2257
3313
|
r"""Controls which (if any) tool is called by the model."""
|
|
2258
3314
|
|
|
2259
3315
|
|
|
2260
|
-
CreateAgentRequestModalities = Literal[
|
|
2261
|
-
"text",
|
|
2262
|
-
"audio",
|
|
2263
|
-
]
|
|
3316
|
+
CreateAgentRequestModalities = Literal[
|
|
3317
|
+
"text",
|
|
3318
|
+
"audio",
|
|
3319
|
+
]
|
|
3320
|
+
|
|
3321
|
+
|
|
3322
|
+
CreateAgentRequestIDAgents1 = Literal[
|
|
3323
|
+
"orq_pii_detection",
|
|
3324
|
+
"orq_sexual_moderation",
|
|
3325
|
+
"orq_harmful_moderation",
|
|
3326
|
+
]
|
|
3327
|
+
r"""The key of the guardrail."""
|
|
3328
|
+
|
|
3329
|
+
|
|
3330
|
+
CreateAgentRequestIDTypedDict = TypeAliasType(
|
|
3331
|
+
"CreateAgentRequestIDTypedDict", Union[CreateAgentRequestIDAgents1, str]
|
|
3332
|
+
)
|
|
3333
|
+
|
|
3334
|
+
|
|
3335
|
+
CreateAgentRequestID = TypeAliasType(
|
|
3336
|
+
"CreateAgentRequestID", Union[CreateAgentRequestIDAgents1, str]
|
|
3337
|
+
)
|
|
3338
|
+
|
|
3339
|
+
|
|
3340
|
+
CreateAgentRequestAgentsResponse201ApplicationJSONExecuteOn = Literal[
|
|
3341
|
+
"input",
|
|
3342
|
+
"output",
|
|
3343
|
+
]
|
|
3344
|
+
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
3345
|
+
|
|
3346
|
+
|
|
3347
|
+
class CreateAgentRequestAgentsResponseGuardrailsTypedDict(TypedDict):
|
|
3348
|
+
id: CreateAgentRequestIDTypedDict
|
|
3349
|
+
execute_on: CreateAgentRequestAgentsResponse201ApplicationJSONExecuteOn
|
|
3350
|
+
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
3351
|
+
|
|
3352
|
+
|
|
3353
|
+
class CreateAgentRequestAgentsResponseGuardrails(BaseModel):
|
|
3354
|
+
id: CreateAgentRequestID
|
|
3355
|
+
|
|
3356
|
+
execute_on: CreateAgentRequestAgentsResponse201ApplicationJSONExecuteOn
|
|
3357
|
+
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
class CreateAgentRequestFallbacksTypedDict(TypedDict):
|
|
3361
|
+
model: str
|
|
3362
|
+
r"""Fallback model identifier"""
|
|
3363
|
+
|
|
3364
|
+
|
|
3365
|
+
class CreateAgentRequestFallbacks(BaseModel):
|
|
3366
|
+
model: str
|
|
3367
|
+
r"""Fallback model identifier"""
|
|
3368
|
+
|
|
3369
|
+
|
|
3370
|
+
class CreateAgentRequestAgentsRetryTypedDict(TypedDict):
|
|
3371
|
+
r"""Retry configuration for the request"""
|
|
3372
|
+
|
|
3373
|
+
count: NotRequired[float]
|
|
3374
|
+
r"""Number of retry attempts (1-5)"""
|
|
3375
|
+
on_codes: NotRequired[List[float]]
|
|
3376
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
3377
|
+
|
|
3378
|
+
|
|
3379
|
+
class CreateAgentRequestAgentsRetry(BaseModel):
|
|
3380
|
+
r"""Retry configuration for the request"""
|
|
3381
|
+
|
|
3382
|
+
count: Optional[float] = 3
|
|
3383
|
+
r"""Number of retry attempts (1-5)"""
|
|
3384
|
+
|
|
3385
|
+
on_codes: Optional[List[float]] = None
|
|
3386
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
3387
|
+
|
|
3388
|
+
@model_serializer(mode="wrap")
|
|
3389
|
+
def serialize_model(self, handler):
|
|
3390
|
+
optional_fields = set(["count", "on_codes"])
|
|
3391
|
+
serialized = handler(self)
|
|
3392
|
+
m = {}
|
|
3393
|
+
|
|
3394
|
+
for n, f in type(self).model_fields.items():
|
|
3395
|
+
k = f.alias or n
|
|
3396
|
+
val = serialized.get(k)
|
|
3397
|
+
|
|
3398
|
+
if val != UNSET_SENTINEL:
|
|
3399
|
+
if val is not None or k not in optional_fields:
|
|
3400
|
+
m[k] = val
|
|
3401
|
+
|
|
3402
|
+
return m
|
|
3403
|
+
|
|
3404
|
+
|
|
3405
|
+
CreateAgentRequestType = Literal["exact_match",]
|
|
3406
|
+
|
|
3407
|
+
|
|
3408
|
+
class CreateAgentRequestCacheTypedDict(TypedDict):
|
|
3409
|
+
r"""Cache configuration for the request."""
|
|
3410
|
+
|
|
3411
|
+
type: CreateAgentRequestType
|
|
3412
|
+
ttl: NotRequired[float]
|
|
3413
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
3414
|
+
|
|
3415
|
+
|
|
3416
|
+
class CreateAgentRequestCache(BaseModel):
|
|
3417
|
+
r"""Cache configuration for the request."""
|
|
3418
|
+
|
|
3419
|
+
type: CreateAgentRequestType
|
|
3420
|
+
|
|
3421
|
+
ttl: Optional[float] = 1800
|
|
3422
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
3423
|
+
|
|
3424
|
+
@model_serializer(mode="wrap")
|
|
3425
|
+
def serialize_model(self, handler):
|
|
3426
|
+
optional_fields = set(["ttl"])
|
|
3427
|
+
serialized = handler(self)
|
|
3428
|
+
m = {}
|
|
3429
|
+
|
|
3430
|
+
for n, f in type(self).model_fields.items():
|
|
3431
|
+
k = f.alias or n
|
|
3432
|
+
val = serialized.get(k)
|
|
3433
|
+
|
|
3434
|
+
if val != UNSET_SENTINEL:
|
|
3435
|
+
if val is not None or k not in optional_fields:
|
|
3436
|
+
m[k] = val
|
|
3437
|
+
|
|
3438
|
+
return m
|
|
3439
|
+
|
|
3440
|
+
|
|
3441
|
+
CreateAgentRequestLoadBalancerAgentsType = Literal["weight_based",]
|
|
3442
|
+
|
|
3443
|
+
|
|
3444
|
+
class CreateAgentRequestLoadBalancerAgentsModelsTypedDict(TypedDict):
|
|
3445
|
+
model: str
|
|
3446
|
+
r"""Model identifier for load balancing"""
|
|
3447
|
+
weight: NotRequired[float]
|
|
3448
|
+
r"""Weight assigned to this model for load balancing"""
|
|
3449
|
+
|
|
3450
|
+
|
|
3451
|
+
class CreateAgentRequestLoadBalancerAgentsModels(BaseModel):
|
|
3452
|
+
model: str
|
|
3453
|
+
r"""Model identifier for load balancing"""
|
|
3454
|
+
|
|
3455
|
+
weight: Optional[float] = 0.5
|
|
3456
|
+
r"""Weight assigned to this model for load balancing"""
|
|
3457
|
+
|
|
3458
|
+
@model_serializer(mode="wrap")
|
|
3459
|
+
def serialize_model(self, handler):
|
|
3460
|
+
optional_fields = set(["weight"])
|
|
3461
|
+
serialized = handler(self)
|
|
3462
|
+
m = {}
|
|
3463
|
+
|
|
3464
|
+
for n, f in type(self).model_fields.items():
|
|
3465
|
+
k = f.alias or n
|
|
3466
|
+
val = serialized.get(k)
|
|
3467
|
+
|
|
3468
|
+
if val != UNSET_SENTINEL:
|
|
3469
|
+
if val is not None or k not in optional_fields:
|
|
3470
|
+
m[k] = val
|
|
3471
|
+
|
|
3472
|
+
return m
|
|
2264
3473
|
|
|
2265
3474
|
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
"orq_harmful_moderation",
|
|
2270
|
-
]
|
|
2271
|
-
r"""The key of the guardrail."""
|
|
3475
|
+
class CreateAgentRequestLoadBalancerAgents1TypedDict(TypedDict):
|
|
3476
|
+
type: CreateAgentRequestLoadBalancerAgentsType
|
|
3477
|
+
models: List[CreateAgentRequestLoadBalancerAgentsModelsTypedDict]
|
|
2272
3478
|
|
|
2273
3479
|
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
)
|
|
3480
|
+
class CreateAgentRequestLoadBalancerAgents1(BaseModel):
|
|
3481
|
+
type: CreateAgentRequestLoadBalancerAgentsType
|
|
2277
3482
|
|
|
3483
|
+
models: List[CreateAgentRequestLoadBalancerAgentsModels]
|
|
2278
3484
|
|
|
2279
|
-
CreateAgentRequestID = TypeAliasType(
|
|
2280
|
-
"CreateAgentRequestID", Union[CreateAgentRequestIDAgents1, str]
|
|
2281
|
-
)
|
|
2282
3485
|
|
|
3486
|
+
CreateAgentRequestLoadBalancerTypedDict = CreateAgentRequestLoadBalancerAgents1TypedDict
|
|
3487
|
+
r"""Load balancer configuration for the request."""
|
|
2283
3488
|
|
|
2284
|
-
CreateAgentRequestAgentsResponse201ApplicationJSONExecuteOn = Literal[
|
|
2285
|
-
"input",
|
|
2286
|
-
"output",
|
|
2287
|
-
]
|
|
2288
|
-
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
2289
3489
|
|
|
3490
|
+
CreateAgentRequestLoadBalancer = CreateAgentRequestLoadBalancerAgents1
|
|
3491
|
+
r"""Load balancer configuration for the request."""
|
|
2290
3492
|
|
|
2291
|
-
class CreateAgentRequestAgentsResponseGuardrailsTypedDict(TypedDict):
|
|
2292
|
-
id: CreateAgentRequestIDTypedDict
|
|
2293
|
-
execute_on: CreateAgentRequestAgentsResponse201ApplicationJSONExecuteOn
|
|
2294
|
-
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
2295
3493
|
|
|
3494
|
+
class CreateAgentRequestTimeoutTypedDict(TypedDict):
|
|
3495
|
+
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."""
|
|
2296
3496
|
|
|
2297
|
-
|
|
2298
|
-
|
|
3497
|
+
call_timeout: float
|
|
3498
|
+
r"""Timeout value in milliseconds"""
|
|
2299
3499
|
|
|
2300
|
-
|
|
2301
|
-
|
|
3500
|
+
|
|
3501
|
+
class CreateAgentRequestTimeout(BaseModel):
|
|
3502
|
+
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."""
|
|
3503
|
+
|
|
3504
|
+
call_timeout: float
|
|
3505
|
+
r"""Timeout value in milliseconds"""
|
|
2302
3506
|
|
|
2303
3507
|
|
|
2304
3508
|
class CreateAgentRequestParametersTypedDict(TypedDict):
|
|
2305
3509
|
r"""Model behavior parameters (snake_case) stored as part of the agent configuration. These become the default parameters used when the agent is executed. Commonly used: temperature (0-1, controls randomness), max_completion_tokens (response length), top_p (nucleus sampling). Advanced: frequency_penalty, presence_penalty, response_format (JSON/structured output), reasoning_effort (for o1/thinking models), seed (reproducibility), stop sequences. Model-specific support varies. Runtime parameters in agent execution requests can override these defaults."""
|
|
2306
3510
|
|
|
3511
|
+
name: NotRequired[str]
|
|
3512
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
2307
3513
|
audio: NotRequired[Nullable[CreateAgentRequestAudioTypedDict]]
|
|
2308
3514
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
2309
3515
|
frequency_penalty: NotRequired[Nullable[float]]
|
|
@@ -2358,11 +3564,24 @@ class CreateAgentRequestParametersTypedDict(TypedDict):
|
|
|
2358
3564
|
r"""Output types that you would like the model to generate. Most models are capable of generating text, which is the default: [\"text\"]. The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: [\"text\", \"audio\"]."""
|
|
2359
3565
|
guardrails: NotRequired[List[CreateAgentRequestAgentsResponseGuardrailsTypedDict]]
|
|
2360
3566
|
r"""A list of guardrails to apply to the request."""
|
|
3567
|
+
fallbacks: NotRequired[List[CreateAgentRequestFallbacksTypedDict]]
|
|
3568
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
3569
|
+
retry: NotRequired[CreateAgentRequestAgentsRetryTypedDict]
|
|
3570
|
+
r"""Retry configuration for the request"""
|
|
3571
|
+
cache: NotRequired[CreateAgentRequestCacheTypedDict]
|
|
3572
|
+
r"""Cache configuration for the request."""
|
|
3573
|
+
load_balancer: NotRequired[CreateAgentRequestLoadBalancerTypedDict]
|
|
3574
|
+
r"""Load balancer configuration for the request."""
|
|
3575
|
+
timeout: NotRequired[CreateAgentRequestTimeoutTypedDict]
|
|
3576
|
+
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."""
|
|
2361
3577
|
|
|
2362
3578
|
|
|
2363
3579
|
class CreateAgentRequestParameters(BaseModel):
|
|
2364
3580
|
r"""Model behavior parameters (snake_case) stored as part of the agent configuration. These become the default parameters used when the agent is executed. Commonly used: temperature (0-1, controls randomness), max_completion_tokens (response length), top_p (nucleus sampling). Advanced: frequency_penalty, presence_penalty, response_format (JSON/structured output), reasoning_effort (for o1/thinking models), seed (reproducibility), stop sequences. Model-specific support varies. Runtime parameters in agent execution requests can override these defaults."""
|
|
2365
3581
|
|
|
3582
|
+
name: Optional[str] = None
|
|
3583
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
3584
|
+
|
|
2366
3585
|
audio: OptionalNullable[CreateAgentRequestAudio] = UNSET
|
|
2367
3586
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
2368
3587
|
|
|
@@ -2439,72 +3658,92 @@ class CreateAgentRequestParameters(BaseModel):
|
|
|
2439
3658
|
guardrails: Optional[List[CreateAgentRequestAgentsResponseGuardrails]] = None
|
|
2440
3659
|
r"""A list of guardrails to apply to the request."""
|
|
2441
3660
|
|
|
3661
|
+
fallbacks: Optional[List[CreateAgentRequestFallbacks]] = None
|
|
3662
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
3663
|
+
|
|
3664
|
+
retry: Optional[CreateAgentRequestAgentsRetry] = None
|
|
3665
|
+
r"""Retry configuration for the request"""
|
|
3666
|
+
|
|
3667
|
+
cache: Optional[CreateAgentRequestCache] = None
|
|
3668
|
+
r"""Cache configuration for the request."""
|
|
3669
|
+
|
|
3670
|
+
load_balancer: Optional[CreateAgentRequestLoadBalancer] = None
|
|
3671
|
+
r"""Load balancer configuration for the request."""
|
|
3672
|
+
|
|
3673
|
+
timeout: Optional[CreateAgentRequestTimeout] = None
|
|
3674
|
+
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."""
|
|
3675
|
+
|
|
2442
3676
|
@model_serializer(mode="wrap")
|
|
2443
3677
|
def serialize_model(self, handler):
|
|
2444
|
-
optional_fields =
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
3678
|
+
optional_fields = set(
|
|
3679
|
+
[
|
|
3680
|
+
"name",
|
|
3681
|
+
"audio",
|
|
3682
|
+
"frequency_penalty",
|
|
3683
|
+
"max_tokens",
|
|
3684
|
+
"max_completion_tokens",
|
|
3685
|
+
"logprobs",
|
|
3686
|
+
"top_logprobs",
|
|
3687
|
+
"n",
|
|
3688
|
+
"presence_penalty",
|
|
3689
|
+
"response_format",
|
|
3690
|
+
"reasoning_effort",
|
|
3691
|
+
"verbosity",
|
|
3692
|
+
"seed",
|
|
3693
|
+
"stop",
|
|
3694
|
+
"stream_options",
|
|
3695
|
+
"thinking",
|
|
3696
|
+
"temperature",
|
|
3697
|
+
"top_p",
|
|
3698
|
+
"top_k",
|
|
3699
|
+
"tool_choice",
|
|
3700
|
+
"parallel_tool_calls",
|
|
3701
|
+
"modalities",
|
|
3702
|
+
"guardrails",
|
|
3703
|
+
"fallbacks",
|
|
3704
|
+
"retry",
|
|
3705
|
+
"cache",
|
|
3706
|
+
"load_balancer",
|
|
3707
|
+
"timeout",
|
|
3708
|
+
]
|
|
3709
|
+
)
|
|
3710
|
+
nullable_fields = set(
|
|
3711
|
+
[
|
|
3712
|
+
"audio",
|
|
3713
|
+
"frequency_penalty",
|
|
3714
|
+
"max_tokens",
|
|
3715
|
+
"max_completion_tokens",
|
|
3716
|
+
"logprobs",
|
|
3717
|
+
"top_logprobs",
|
|
3718
|
+
"n",
|
|
3719
|
+
"presence_penalty",
|
|
3720
|
+
"seed",
|
|
3721
|
+
"stop",
|
|
3722
|
+
"stream_options",
|
|
3723
|
+
"temperature",
|
|
3724
|
+
"top_p",
|
|
3725
|
+
"top_k",
|
|
3726
|
+
"modalities",
|
|
3727
|
+
]
|
|
3728
|
+
)
|
|
2487
3729
|
serialized = handler(self)
|
|
2488
|
-
|
|
2489
3730
|
m = {}
|
|
2490
3731
|
|
|
2491
3732
|
for n, f in type(self).model_fields.items():
|
|
2492
3733
|
k = f.alias or n
|
|
2493
3734
|
val = serialized.get(k)
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
):
|
|
2507
|
-
m[k] = val
|
|
3735
|
+
is_nullable_and_explicitly_set = (
|
|
3736
|
+
k in nullable_fields
|
|
3737
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
3738
|
+
)
|
|
3739
|
+
|
|
3740
|
+
if val != UNSET_SENTINEL:
|
|
3741
|
+
if (
|
|
3742
|
+
val is not None
|
|
3743
|
+
or k not in optional_fields
|
|
3744
|
+
or is_nullable_and_explicitly_set
|
|
3745
|
+
):
|
|
3746
|
+
m[k] = val
|
|
2508
3747
|
|
|
2509
3748
|
return m
|
|
2510
3749
|
|
|
@@ -2527,6 +3766,22 @@ class CreateAgentRequestRetry(BaseModel):
|
|
|
2527
3766
|
on_codes: Optional[List[float]] = None
|
|
2528
3767
|
r"""HTTP status codes that trigger retry logic"""
|
|
2529
3768
|
|
|
3769
|
+
@model_serializer(mode="wrap")
|
|
3770
|
+
def serialize_model(self, handler):
|
|
3771
|
+
optional_fields = set(["count", "on_codes"])
|
|
3772
|
+
serialized = handler(self)
|
|
3773
|
+
m = {}
|
|
3774
|
+
|
|
3775
|
+
for n, f in type(self).model_fields.items():
|
|
3776
|
+
k = f.alias or n
|
|
3777
|
+
val = serialized.get(k)
|
|
3778
|
+
|
|
3779
|
+
if val != UNSET_SENTINEL:
|
|
3780
|
+
if val is not None or k not in optional_fields:
|
|
3781
|
+
m[k] = val
|
|
3782
|
+
|
|
3783
|
+
return m
|
|
3784
|
+
|
|
2530
3785
|
|
|
2531
3786
|
CreateAgentRequestFallbackModelConfigurationVoice = Literal[
|
|
2532
3787
|
"alloy",
|
|
@@ -2604,6 +3859,22 @@ class CreateAgentRequestResponseFormatAgentsResponse201ApplicationJSONJSONSchema
|
|
|
2604
3859
|
strict: Optional[bool] = False
|
|
2605
3860
|
r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
|
|
2606
3861
|
|
|
3862
|
+
@model_serializer(mode="wrap")
|
|
3863
|
+
def serialize_model(self, handler):
|
|
3864
|
+
optional_fields = set(["description", "schema", "strict"])
|
|
3865
|
+
serialized = handler(self)
|
|
3866
|
+
m = {}
|
|
3867
|
+
|
|
3868
|
+
for n, f in type(self).model_fields.items():
|
|
3869
|
+
k = f.alias or n
|
|
3870
|
+
val = serialized.get(k)
|
|
3871
|
+
|
|
3872
|
+
if val != UNSET_SENTINEL:
|
|
3873
|
+
if val is not None or k not in optional_fields:
|
|
3874
|
+
m[k] = val
|
|
3875
|
+
|
|
3876
|
+
return m
|
|
3877
|
+
|
|
2607
3878
|
|
|
2608
3879
|
class CreateAgentRequestResponseFormatAgentsResponse201ApplicationJSONResponseBodyJSONSchemaTypedDict(
|
|
2609
3880
|
TypedDict
|
|
@@ -2751,6 +4022,22 @@ class CreateAgentRequestFallbackModelConfigurationStreamOptions(BaseModel):
|
|
|
2751
4022
|
include_usage: Optional[bool] = None
|
|
2752
4023
|
r"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value."""
|
|
2753
4024
|
|
|
4025
|
+
@model_serializer(mode="wrap")
|
|
4026
|
+
def serialize_model(self, handler):
|
|
4027
|
+
optional_fields = set(["include_usage"])
|
|
4028
|
+
serialized = handler(self)
|
|
4029
|
+
m = {}
|
|
4030
|
+
|
|
4031
|
+
for n, f in type(self).model_fields.items():
|
|
4032
|
+
k = f.alias or n
|
|
4033
|
+
val = serialized.get(k)
|
|
4034
|
+
|
|
4035
|
+
if val != UNSET_SENTINEL:
|
|
4036
|
+
if val is not None or k not in optional_fields:
|
|
4037
|
+
m[k] = val
|
|
4038
|
+
|
|
4039
|
+
return m
|
|
4040
|
+
|
|
2754
4041
|
|
|
2755
4042
|
CreateAgentRequestFallbackModelConfigurationThinkingTypedDict = TypeAliasType(
|
|
2756
4043
|
"CreateAgentRequestFallbackModelConfigurationThinkingTypedDict",
|
|
@@ -2793,6 +4080,22 @@ class CreateAgentRequestToolChoiceAgentsResponse2(BaseModel):
|
|
|
2793
4080
|
type: Optional[CreateAgentRequestToolChoiceAgentsResponseType] = None
|
|
2794
4081
|
r"""The type of the tool. Currently, only function is supported."""
|
|
2795
4082
|
|
|
4083
|
+
@model_serializer(mode="wrap")
|
|
4084
|
+
def serialize_model(self, handler):
|
|
4085
|
+
optional_fields = set(["type"])
|
|
4086
|
+
serialized = handler(self)
|
|
4087
|
+
m = {}
|
|
4088
|
+
|
|
4089
|
+
for n, f in type(self).model_fields.items():
|
|
4090
|
+
k = f.alias or n
|
|
4091
|
+
val = serialized.get(k)
|
|
4092
|
+
|
|
4093
|
+
if val != UNSET_SENTINEL:
|
|
4094
|
+
if val is not None or k not in optional_fields:
|
|
4095
|
+
m[k] = val
|
|
4096
|
+
|
|
4097
|
+
return m
|
|
4098
|
+
|
|
2796
4099
|
|
|
2797
4100
|
CreateAgentRequestToolChoiceAgentsResponse1 = Literal[
|
|
2798
4101
|
"none",
|
|
@@ -2867,9 +4170,165 @@ class CreateAgentRequestFallbackModelConfigurationGuardrails(BaseModel):
|
|
|
2867
4170
|
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
2868
4171
|
|
|
2869
4172
|
|
|
4173
|
+
class CreateAgentRequestFallbackModelConfigurationFallbacksTypedDict(TypedDict):
|
|
4174
|
+
model: str
|
|
4175
|
+
r"""Fallback model identifier"""
|
|
4176
|
+
|
|
4177
|
+
|
|
4178
|
+
class CreateAgentRequestFallbackModelConfigurationFallbacks(BaseModel):
|
|
4179
|
+
model: str
|
|
4180
|
+
r"""Fallback model identifier"""
|
|
4181
|
+
|
|
4182
|
+
|
|
4183
|
+
class CreateAgentRequestFallbackModelConfigurationAgentsResponseRetryTypedDict(
|
|
4184
|
+
TypedDict
|
|
4185
|
+
):
|
|
4186
|
+
r"""Retry configuration for the request"""
|
|
4187
|
+
|
|
4188
|
+
count: NotRequired[float]
|
|
4189
|
+
r"""Number of retry attempts (1-5)"""
|
|
4190
|
+
on_codes: NotRequired[List[float]]
|
|
4191
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
4192
|
+
|
|
4193
|
+
|
|
4194
|
+
class CreateAgentRequestFallbackModelConfigurationAgentsResponseRetry(BaseModel):
|
|
4195
|
+
r"""Retry configuration for the request"""
|
|
4196
|
+
|
|
4197
|
+
count: Optional[float] = 3
|
|
4198
|
+
r"""Number of retry attempts (1-5)"""
|
|
4199
|
+
|
|
4200
|
+
on_codes: Optional[List[float]] = None
|
|
4201
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
4202
|
+
|
|
4203
|
+
@model_serializer(mode="wrap")
|
|
4204
|
+
def serialize_model(self, handler):
|
|
4205
|
+
optional_fields = set(["count", "on_codes"])
|
|
4206
|
+
serialized = handler(self)
|
|
4207
|
+
m = {}
|
|
4208
|
+
|
|
4209
|
+
for n, f in type(self).model_fields.items():
|
|
4210
|
+
k = f.alias or n
|
|
4211
|
+
val = serialized.get(k)
|
|
4212
|
+
|
|
4213
|
+
if val != UNSET_SENTINEL:
|
|
4214
|
+
if val is not None or k not in optional_fields:
|
|
4215
|
+
m[k] = val
|
|
4216
|
+
|
|
4217
|
+
return m
|
|
4218
|
+
|
|
4219
|
+
|
|
4220
|
+
CreateAgentRequestFallbackModelConfigurationType = Literal["exact_match",]
|
|
4221
|
+
|
|
4222
|
+
|
|
4223
|
+
class CreateAgentRequestFallbackModelConfigurationCacheTypedDict(TypedDict):
|
|
4224
|
+
r"""Cache configuration for the request."""
|
|
4225
|
+
|
|
4226
|
+
type: CreateAgentRequestFallbackModelConfigurationType
|
|
4227
|
+
ttl: NotRequired[float]
|
|
4228
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
4229
|
+
|
|
4230
|
+
|
|
4231
|
+
class CreateAgentRequestFallbackModelConfigurationCache(BaseModel):
|
|
4232
|
+
r"""Cache configuration for the request."""
|
|
4233
|
+
|
|
4234
|
+
type: CreateAgentRequestFallbackModelConfigurationType
|
|
4235
|
+
|
|
4236
|
+
ttl: Optional[float] = 1800
|
|
4237
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
4238
|
+
|
|
4239
|
+
@model_serializer(mode="wrap")
|
|
4240
|
+
def serialize_model(self, handler):
|
|
4241
|
+
optional_fields = set(["ttl"])
|
|
4242
|
+
serialized = handler(self)
|
|
4243
|
+
m = {}
|
|
4244
|
+
|
|
4245
|
+
for n, f in type(self).model_fields.items():
|
|
4246
|
+
k = f.alias or n
|
|
4247
|
+
val = serialized.get(k)
|
|
4248
|
+
|
|
4249
|
+
if val != UNSET_SENTINEL:
|
|
4250
|
+
if val is not None or k not in optional_fields:
|
|
4251
|
+
m[k] = val
|
|
4252
|
+
|
|
4253
|
+
return m
|
|
4254
|
+
|
|
4255
|
+
|
|
4256
|
+
CreateAgentRequestLoadBalancerAgentsResponseType = Literal["weight_based",]
|
|
4257
|
+
|
|
4258
|
+
|
|
4259
|
+
class CreateAgentRequestLoadBalancerAgentsResponseModelsTypedDict(TypedDict):
|
|
4260
|
+
model: str
|
|
4261
|
+
r"""Model identifier for load balancing"""
|
|
4262
|
+
weight: NotRequired[float]
|
|
4263
|
+
r"""Weight assigned to this model for load balancing"""
|
|
4264
|
+
|
|
4265
|
+
|
|
4266
|
+
class CreateAgentRequestLoadBalancerAgentsResponseModels(BaseModel):
|
|
4267
|
+
model: str
|
|
4268
|
+
r"""Model identifier for load balancing"""
|
|
4269
|
+
|
|
4270
|
+
weight: Optional[float] = 0.5
|
|
4271
|
+
r"""Weight assigned to this model for load balancing"""
|
|
4272
|
+
|
|
4273
|
+
@model_serializer(mode="wrap")
|
|
4274
|
+
def serialize_model(self, handler):
|
|
4275
|
+
optional_fields = set(["weight"])
|
|
4276
|
+
serialized = handler(self)
|
|
4277
|
+
m = {}
|
|
4278
|
+
|
|
4279
|
+
for n, f in type(self).model_fields.items():
|
|
4280
|
+
k = f.alias or n
|
|
4281
|
+
val = serialized.get(k)
|
|
4282
|
+
|
|
4283
|
+
if val != UNSET_SENTINEL:
|
|
4284
|
+
if val is not None or k not in optional_fields:
|
|
4285
|
+
m[k] = val
|
|
4286
|
+
|
|
4287
|
+
return m
|
|
4288
|
+
|
|
4289
|
+
|
|
4290
|
+
class CreateAgentRequestLoadBalancerAgentsResponse1TypedDict(TypedDict):
|
|
4291
|
+
type: CreateAgentRequestLoadBalancerAgentsResponseType
|
|
4292
|
+
models: List[CreateAgentRequestLoadBalancerAgentsResponseModelsTypedDict]
|
|
4293
|
+
|
|
4294
|
+
|
|
4295
|
+
class CreateAgentRequestLoadBalancerAgentsResponse1(BaseModel):
|
|
4296
|
+
type: CreateAgentRequestLoadBalancerAgentsResponseType
|
|
4297
|
+
|
|
4298
|
+
models: List[CreateAgentRequestLoadBalancerAgentsResponseModels]
|
|
4299
|
+
|
|
4300
|
+
|
|
4301
|
+
CreateAgentRequestFallbackModelConfigurationLoadBalancerTypedDict = (
|
|
4302
|
+
CreateAgentRequestLoadBalancerAgentsResponse1TypedDict
|
|
4303
|
+
)
|
|
4304
|
+
r"""Load balancer configuration for the request."""
|
|
4305
|
+
|
|
4306
|
+
|
|
4307
|
+
CreateAgentRequestFallbackModelConfigurationLoadBalancer = (
|
|
4308
|
+
CreateAgentRequestLoadBalancerAgentsResponse1
|
|
4309
|
+
)
|
|
4310
|
+
r"""Load balancer configuration for the request."""
|
|
4311
|
+
|
|
4312
|
+
|
|
4313
|
+
class CreateAgentRequestFallbackModelConfigurationTimeoutTypedDict(TypedDict):
|
|
4314
|
+
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."""
|
|
4315
|
+
|
|
4316
|
+
call_timeout: float
|
|
4317
|
+
r"""Timeout value in milliseconds"""
|
|
4318
|
+
|
|
4319
|
+
|
|
4320
|
+
class CreateAgentRequestFallbackModelConfigurationTimeout(BaseModel):
|
|
4321
|
+
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."""
|
|
4322
|
+
|
|
4323
|
+
call_timeout: float
|
|
4324
|
+
r"""Timeout value in milliseconds"""
|
|
4325
|
+
|
|
4326
|
+
|
|
2870
4327
|
class CreateAgentRequestFallbackModelConfigurationParametersTypedDict(TypedDict):
|
|
2871
4328
|
r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
|
|
2872
4329
|
|
|
4330
|
+
name: NotRequired[str]
|
|
4331
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
2873
4332
|
audio: NotRequired[
|
|
2874
4333
|
Nullable[CreateAgentRequestFallbackModelConfigurationAudioTypedDict]
|
|
2875
4334
|
]
|
|
@@ -2940,11 +4399,30 @@ class CreateAgentRequestFallbackModelConfigurationParametersTypedDict(TypedDict)
|
|
|
2940
4399
|
List[CreateAgentRequestFallbackModelConfigurationGuardrailsTypedDict]
|
|
2941
4400
|
]
|
|
2942
4401
|
r"""A list of guardrails to apply to the request."""
|
|
4402
|
+
fallbacks: NotRequired[
|
|
4403
|
+
List[CreateAgentRequestFallbackModelConfigurationFallbacksTypedDict]
|
|
4404
|
+
]
|
|
4405
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
4406
|
+
retry: NotRequired[
|
|
4407
|
+
CreateAgentRequestFallbackModelConfigurationAgentsResponseRetryTypedDict
|
|
4408
|
+
]
|
|
4409
|
+
r"""Retry configuration for the request"""
|
|
4410
|
+
cache: NotRequired[CreateAgentRequestFallbackModelConfigurationCacheTypedDict]
|
|
4411
|
+
r"""Cache configuration for the request."""
|
|
4412
|
+
load_balancer: NotRequired[
|
|
4413
|
+
CreateAgentRequestFallbackModelConfigurationLoadBalancerTypedDict
|
|
4414
|
+
]
|
|
4415
|
+
r"""Load balancer configuration for the request."""
|
|
4416
|
+
timeout: NotRequired[CreateAgentRequestFallbackModelConfigurationTimeoutTypedDict]
|
|
4417
|
+
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."""
|
|
2943
4418
|
|
|
2944
4419
|
|
|
2945
4420
|
class CreateAgentRequestFallbackModelConfigurationParameters(BaseModel):
|
|
2946
4421
|
r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
|
|
2947
4422
|
|
|
4423
|
+
name: Optional[str] = None
|
|
4424
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
4425
|
+
|
|
2948
4426
|
audio: OptionalNullable[CreateAgentRequestFallbackModelConfigurationAudio] = UNSET
|
|
2949
4427
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
2950
4428
|
|
|
@@ -3031,77 +4509,103 @@ class CreateAgentRequestFallbackModelConfigurationParameters(BaseModel):
|
|
|
3031
4509
|
] = None
|
|
3032
4510
|
r"""A list of guardrails to apply to the request."""
|
|
3033
4511
|
|
|
4512
|
+
fallbacks: Optional[List[CreateAgentRequestFallbackModelConfigurationFallbacks]] = (
|
|
4513
|
+
None
|
|
4514
|
+
)
|
|
4515
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
4516
|
+
|
|
4517
|
+
retry: Optional[CreateAgentRequestFallbackModelConfigurationAgentsResponseRetry] = (
|
|
4518
|
+
None
|
|
4519
|
+
)
|
|
4520
|
+
r"""Retry configuration for the request"""
|
|
4521
|
+
|
|
4522
|
+
cache: Optional[CreateAgentRequestFallbackModelConfigurationCache] = None
|
|
4523
|
+
r"""Cache configuration for the request."""
|
|
4524
|
+
|
|
4525
|
+
load_balancer: Optional[
|
|
4526
|
+
CreateAgentRequestFallbackModelConfigurationLoadBalancer
|
|
4527
|
+
] = None
|
|
4528
|
+
r"""Load balancer configuration for the request."""
|
|
4529
|
+
|
|
4530
|
+
timeout: Optional[CreateAgentRequestFallbackModelConfigurationTimeout] = None
|
|
4531
|
+
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."""
|
|
4532
|
+
|
|
3034
4533
|
@model_serializer(mode="wrap")
|
|
3035
4534
|
def serialize_model(self, handler):
|
|
3036
|
-
optional_fields =
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
4535
|
+
optional_fields = set(
|
|
4536
|
+
[
|
|
4537
|
+
"name",
|
|
4538
|
+
"audio",
|
|
4539
|
+
"frequency_penalty",
|
|
4540
|
+
"max_tokens",
|
|
4541
|
+
"max_completion_tokens",
|
|
4542
|
+
"logprobs",
|
|
4543
|
+
"top_logprobs",
|
|
4544
|
+
"n",
|
|
4545
|
+
"presence_penalty",
|
|
4546
|
+
"response_format",
|
|
4547
|
+
"reasoning_effort",
|
|
4548
|
+
"verbosity",
|
|
4549
|
+
"seed",
|
|
4550
|
+
"stop",
|
|
4551
|
+
"stream_options",
|
|
4552
|
+
"thinking",
|
|
4553
|
+
"temperature",
|
|
4554
|
+
"top_p",
|
|
4555
|
+
"top_k",
|
|
4556
|
+
"tool_choice",
|
|
4557
|
+
"parallel_tool_calls",
|
|
4558
|
+
"modalities",
|
|
4559
|
+
"guardrails",
|
|
4560
|
+
"fallbacks",
|
|
4561
|
+
"retry",
|
|
4562
|
+
"cache",
|
|
4563
|
+
"load_balancer",
|
|
4564
|
+
"timeout",
|
|
4565
|
+
]
|
|
4566
|
+
)
|
|
4567
|
+
nullable_fields = set(
|
|
4568
|
+
[
|
|
4569
|
+
"audio",
|
|
4570
|
+
"frequency_penalty",
|
|
4571
|
+
"max_tokens",
|
|
4572
|
+
"max_completion_tokens",
|
|
4573
|
+
"logprobs",
|
|
4574
|
+
"top_logprobs",
|
|
4575
|
+
"n",
|
|
4576
|
+
"presence_penalty",
|
|
4577
|
+
"seed",
|
|
4578
|
+
"stop",
|
|
4579
|
+
"stream_options",
|
|
4580
|
+
"temperature",
|
|
4581
|
+
"top_p",
|
|
4582
|
+
"top_k",
|
|
4583
|
+
"modalities",
|
|
4584
|
+
]
|
|
4585
|
+
)
|
|
3079
4586
|
serialized = handler(self)
|
|
3080
|
-
|
|
3081
4587
|
m = {}
|
|
3082
4588
|
|
|
3083
4589
|
for n, f in type(self).model_fields.items():
|
|
3084
4590
|
k = f.alias or n
|
|
3085
4591
|
val = serialized.get(k)
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
):
|
|
3099
|
-
m[k] = val
|
|
4592
|
+
is_nullable_and_explicitly_set = (
|
|
4593
|
+
k in nullable_fields
|
|
4594
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
4595
|
+
)
|
|
4596
|
+
|
|
4597
|
+
if val != UNSET_SENTINEL:
|
|
4598
|
+
if (
|
|
4599
|
+
val is not None
|
|
4600
|
+
or k not in optional_fields
|
|
4601
|
+
or is_nullable_and_explicitly_set
|
|
4602
|
+
):
|
|
4603
|
+
m[k] = val
|
|
3100
4604
|
|
|
3101
4605
|
return m
|
|
3102
4606
|
|
|
3103
4607
|
|
|
3104
|
-
class
|
|
4608
|
+
class CreateAgentRequestFallbackModelConfigurationAgentsRetryTypedDict(TypedDict):
|
|
3105
4609
|
r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
|
|
3106
4610
|
|
|
3107
4611
|
count: NotRequired[float]
|
|
@@ -3110,7 +4614,7 @@ class CreateAgentRequestFallbackModelConfigurationRetryTypedDict(TypedDict):
|
|
|
3110
4614
|
r"""HTTP status codes that trigger retry logic"""
|
|
3111
4615
|
|
|
3112
4616
|
|
|
3113
|
-
class
|
|
4617
|
+
class CreateAgentRequestFallbackModelConfigurationAgentsRetry(BaseModel):
|
|
3114
4618
|
r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
|
|
3115
4619
|
|
|
3116
4620
|
count: Optional[float] = 3
|
|
@@ -3119,6 +4623,22 @@ class CreateAgentRequestFallbackModelConfigurationRetry(BaseModel):
|
|
|
3119
4623
|
on_codes: Optional[List[float]] = None
|
|
3120
4624
|
r"""HTTP status codes that trigger retry logic"""
|
|
3121
4625
|
|
|
4626
|
+
@model_serializer(mode="wrap")
|
|
4627
|
+
def serialize_model(self, handler):
|
|
4628
|
+
optional_fields = set(["count", "on_codes"])
|
|
4629
|
+
serialized = handler(self)
|
|
4630
|
+
m = {}
|
|
4631
|
+
|
|
4632
|
+
for n, f in type(self).model_fields.items():
|
|
4633
|
+
k = f.alias or n
|
|
4634
|
+
val = serialized.get(k)
|
|
4635
|
+
|
|
4636
|
+
if val != UNSET_SENTINEL:
|
|
4637
|
+
if val is not None or k not in optional_fields:
|
|
4638
|
+
m[k] = val
|
|
4639
|
+
|
|
4640
|
+
return m
|
|
4641
|
+
|
|
3122
4642
|
|
|
3123
4643
|
class CreateAgentRequestFallbackModelConfiguration2TypedDict(TypedDict):
|
|
3124
4644
|
r"""Fallback model configuration with optional parameters and retry settings."""
|
|
@@ -3129,7 +4649,7 @@ class CreateAgentRequestFallbackModelConfiguration2TypedDict(TypedDict):
|
|
|
3129
4649
|
CreateAgentRequestFallbackModelConfigurationParametersTypedDict
|
|
3130
4650
|
]
|
|
3131
4651
|
r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
|
|
3132
|
-
retry: NotRequired[
|
|
4652
|
+
retry: NotRequired[CreateAgentRequestFallbackModelConfigurationAgentsRetryTypedDict]
|
|
3133
4653
|
r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
|
|
3134
4654
|
|
|
3135
4655
|
|
|
@@ -3142,9 +4662,25 @@ class CreateAgentRequestFallbackModelConfiguration2(BaseModel):
|
|
|
3142
4662
|
parameters: Optional[CreateAgentRequestFallbackModelConfigurationParameters] = None
|
|
3143
4663
|
r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
|
|
3144
4664
|
|
|
3145
|
-
retry: Optional[
|
|
4665
|
+
retry: Optional[CreateAgentRequestFallbackModelConfigurationAgentsRetry] = None
|
|
3146
4666
|
r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
|
|
3147
4667
|
|
|
4668
|
+
@model_serializer(mode="wrap")
|
|
4669
|
+
def serialize_model(self, handler):
|
|
4670
|
+
optional_fields = set(["parameters", "retry"])
|
|
4671
|
+
serialized = handler(self)
|
|
4672
|
+
m = {}
|
|
4673
|
+
|
|
4674
|
+
for n, f in type(self).model_fields.items():
|
|
4675
|
+
k = f.alias or n
|
|
4676
|
+
val = serialized.get(k)
|
|
4677
|
+
|
|
4678
|
+
if val != UNSET_SENTINEL:
|
|
4679
|
+
if val is not None or k not in optional_fields:
|
|
4680
|
+
m[k] = val
|
|
4681
|
+
|
|
4682
|
+
return m
|
|
4683
|
+
|
|
3148
4684
|
|
|
3149
4685
|
CreateAgentRequestFallbackModelConfigurationTypedDict = TypeAliasType(
|
|
3150
4686
|
"CreateAgentRequestFallbackModelConfigurationTypedDict",
|
|
@@ -3195,31 +4731,28 @@ class Model(BaseModel):
|
|
|
3195
4731
|
|
|
3196
4732
|
@model_serializer(mode="wrap")
|
|
3197
4733
|
def serialize_model(self, handler):
|
|
3198
|
-
optional_fields =
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
4734
|
+
optional_fields = set(
|
|
4735
|
+
["integration_id", "parameters", "retry", "fallback_models"]
|
|
4736
|
+
)
|
|
4737
|
+
nullable_fields = set(["integration_id", "fallback_models"])
|
|
3202
4738
|
serialized = handler(self)
|
|
3203
|
-
|
|
3204
4739
|
m = {}
|
|
3205
4740
|
|
|
3206
4741
|
for n, f in type(self).model_fields.items():
|
|
3207
4742
|
k = f.alias or n
|
|
3208
4743
|
val = serialized.get(k)
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
):
|
|
3222
|
-
m[k] = val
|
|
4744
|
+
is_nullable_and_explicitly_set = (
|
|
4745
|
+
k in nullable_fields
|
|
4746
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
4747
|
+
)
|
|
4748
|
+
|
|
4749
|
+
if val != UNSET_SENTINEL:
|
|
4750
|
+
if (
|
|
4751
|
+
val is not None
|
|
4752
|
+
or k not in optional_fields
|
|
4753
|
+
or is_nullable_and_explicitly_set
|
|
4754
|
+
):
|
|
4755
|
+
m[k] = val
|
|
3223
4756
|
|
|
3224
4757
|
return m
|
|
3225
4758
|
|
|
@@ -3238,6 +4771,22 @@ class CreateAgentRequestTeamOfAgents(BaseModel):
|
|
|
3238
4771
|
role: Optional[str] = None
|
|
3239
4772
|
r"""The role of the agent in this context. This is used to give extra information to the leader to help it decide which agent to hand off to."""
|
|
3240
4773
|
|
|
4774
|
+
@model_serializer(mode="wrap")
|
|
4775
|
+
def serialize_model(self, handler):
|
|
4776
|
+
optional_fields = set(["role"])
|
|
4777
|
+
serialized = handler(self)
|
|
4778
|
+
m = {}
|
|
4779
|
+
|
|
4780
|
+
for n, f in type(self).model_fields.items():
|
|
4781
|
+
k = f.alias or n
|
|
4782
|
+
val = serialized.get(k)
|
|
4783
|
+
|
|
4784
|
+
if val != UNSET_SENTINEL:
|
|
4785
|
+
if val is not None or k not in optional_fields:
|
|
4786
|
+
m[k] = val
|
|
4787
|
+
|
|
4788
|
+
return m
|
|
4789
|
+
|
|
3241
4790
|
|
|
3242
4791
|
class CreateAgentRequestMetricsTypedDict(TypedDict):
|
|
3243
4792
|
total_cost: NotRequired[float]
|
|
@@ -3246,6 +4795,22 @@ class CreateAgentRequestMetricsTypedDict(TypedDict):
|
|
|
3246
4795
|
class CreateAgentRequestMetrics(BaseModel):
|
|
3247
4796
|
total_cost: Optional[float] = 0
|
|
3248
4797
|
|
|
4798
|
+
@model_serializer(mode="wrap")
|
|
4799
|
+
def serialize_model(self, handler):
|
|
4800
|
+
optional_fields = set(["total_cost"])
|
|
4801
|
+
serialized = handler(self)
|
|
4802
|
+
m = {}
|
|
4803
|
+
|
|
4804
|
+
for n, f in type(self).model_fields.items():
|
|
4805
|
+
k = f.alias or n
|
|
4806
|
+
val = serialized.get(k)
|
|
4807
|
+
|
|
4808
|
+
if val != UNSET_SENTINEL:
|
|
4809
|
+
if val is not None or k not in optional_fields:
|
|
4810
|
+
m[k] = val
|
|
4811
|
+
|
|
4812
|
+
return m
|
|
4813
|
+
|
|
3249
4814
|
|
|
3250
4815
|
class CreateAgentRequestKnowledgeBasesTypedDict(TypedDict):
|
|
3251
4816
|
knowledge_id: str
|
|
@@ -3367,42 +4932,39 @@ class CreateAgentRequestResponseBody(BaseModel):
|
|
|
3367
4932
|
|
|
3368
4933
|
@model_serializer(mode="wrap")
|
|
3369
4934
|
def serialize_model(self, handler):
|
|
3370
|
-
optional_fields =
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
4935
|
+
optional_fields = set(
|
|
4936
|
+
[
|
|
4937
|
+
"created_by_id",
|
|
4938
|
+
"updated_by_id",
|
|
4939
|
+
"created",
|
|
4940
|
+
"updated",
|
|
4941
|
+
"system_prompt",
|
|
4942
|
+
"settings",
|
|
4943
|
+
"version_hash",
|
|
4944
|
+
"metrics",
|
|
4945
|
+
"variables",
|
|
4946
|
+
"knowledge_bases",
|
|
4947
|
+
"source",
|
|
4948
|
+
]
|
|
4949
|
+
)
|
|
4950
|
+
nullable_fields = set(["created_by_id", "updated_by_id"])
|
|
3386
4951
|
serialized = handler(self)
|
|
3387
|
-
|
|
3388
4952
|
m = {}
|
|
3389
4953
|
|
|
3390
4954
|
for n, f in type(self).model_fields.items():
|
|
3391
4955
|
k = f.alias or n
|
|
3392
4956
|
val = serialized.get(k)
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
):
|
|
3406
|
-
m[k] = val
|
|
4957
|
+
is_nullable_and_explicitly_set = (
|
|
4958
|
+
k in nullable_fields
|
|
4959
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
4960
|
+
)
|
|
4961
|
+
|
|
4962
|
+
if val != UNSET_SENTINEL:
|
|
4963
|
+
if (
|
|
4964
|
+
val is not None
|
|
4965
|
+
or k not in optional_fields
|
|
4966
|
+
or is_nullable_and_explicitly_set
|
|
4967
|
+
):
|
|
4968
|
+
m[k] = val
|
|
3407
4969
|
|
|
3408
4970
|
return m
|