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.
Files changed (166) hide show
  1. orq_ai_sdk/_version.py +3 -3
  2. orq_ai_sdk/agents.py +186 -186
  3. orq_ai_sdk/audio.py +30 -0
  4. orq_ai_sdk/basesdk.py +20 -6
  5. orq_ai_sdk/chat.py +22 -0
  6. orq_ai_sdk/completions.py +438 -0
  7. orq_ai_sdk/contacts.py +43 -855
  8. orq_ai_sdk/deployments.py +61 -0
  9. orq_ai_sdk/edits.py +364 -0
  10. orq_ai_sdk/embeddings.py +344 -0
  11. orq_ai_sdk/generations.py +370 -0
  12. orq_ai_sdk/identities.py +1037 -0
  13. orq_ai_sdk/images.py +28 -0
  14. orq_ai_sdk/models/__init__.py +5746 -737
  15. orq_ai_sdk/models/actionreviewedstreamingevent.py +18 -1
  16. orq_ai_sdk/models/actionreviewrequestedstreamingevent.py +44 -1
  17. orq_ai_sdk/models/agenterroredstreamingevent.py +18 -1
  18. orq_ai_sdk/models/agentinactivestreamingevent.py +168 -70
  19. orq_ai_sdk/models/agentmessagecreatedstreamingevent.py +18 -2
  20. orq_ai_sdk/models/agentresponsemessage.py +18 -2
  21. orq_ai_sdk/models/agentstartedstreamingevent.py +127 -2
  22. orq_ai_sdk/models/agentthoughtstreamingevent.py +178 -211
  23. orq_ai_sdk/models/conversationresponse.py +31 -20
  24. orq_ai_sdk/models/conversationwithmessagesresponse.py +31 -20
  25. orq_ai_sdk/models/createagentrequestop.py +1945 -383
  26. orq_ai_sdk/models/createagentresponse.py +147 -91
  27. orq_ai_sdk/models/createagentresponserequestop.py +111 -2
  28. orq_ai_sdk/models/createchatcompletionop.py +1381 -861
  29. orq_ai_sdk/models/createchunkop.py +46 -19
  30. orq_ai_sdk/models/createcompletionop.py +2078 -0
  31. orq_ai_sdk/models/createcontactop.py +45 -56
  32. orq_ai_sdk/models/createconversationop.py +61 -39
  33. orq_ai_sdk/models/createconversationresponseop.py +68 -4
  34. orq_ai_sdk/models/createdatasetitemop.py +424 -80
  35. orq_ai_sdk/models/createdatasetop.py +19 -2
  36. orq_ai_sdk/models/createdatasourceop.py +92 -26
  37. orq_ai_sdk/models/createembeddingop.py +579 -0
  38. orq_ai_sdk/models/createevalop.py +552 -24
  39. orq_ai_sdk/models/createidentityop.py +176 -0
  40. orq_ai_sdk/models/createimageeditop.py +715 -0
  41. orq_ai_sdk/models/createimageop.py +407 -128
  42. orq_ai_sdk/models/createimagevariationop.py +706 -0
  43. orq_ai_sdk/models/createknowledgeop.py +186 -121
  44. orq_ai_sdk/models/creatememorydocumentop.py +50 -1
  45. orq_ai_sdk/models/creatememoryop.py +34 -21
  46. orq_ai_sdk/models/creatememorystoreop.py +34 -1
  47. orq_ai_sdk/models/createmoderationop.py +521 -0
  48. orq_ai_sdk/models/createpromptop.py +2759 -1251
  49. orq_ai_sdk/models/creatererankop.py +608 -0
  50. orq_ai_sdk/models/createresponseop.py +2567 -0
  51. orq_ai_sdk/models/createspeechop.py +466 -0
  52. orq_ai_sdk/models/createtoolop.py +537 -12
  53. orq_ai_sdk/models/createtranscriptionop.py +732 -0
  54. orq_ai_sdk/models/createtranslationop.py +702 -0
  55. orq_ai_sdk/models/datapart.py +18 -1
  56. orq_ai_sdk/models/deletechunksop.py +34 -1
  57. orq_ai_sdk/models/{deletecontactop.py → deleteidentityop.py} +9 -9
  58. orq_ai_sdk/models/deletepromptop.py +26 -0
  59. orq_ai_sdk/models/deploymentcreatemetricop.py +362 -76
  60. orq_ai_sdk/models/deploymentgetconfigop.py +635 -194
  61. orq_ai_sdk/models/deploymentinvokeop.py +168 -173
  62. orq_ai_sdk/models/deploymentsop.py +195 -58
  63. orq_ai_sdk/models/deploymentstreamop.py +652 -304
  64. orq_ai_sdk/models/errorpart.py +18 -1
  65. orq_ai_sdk/models/filecontentpartschema.py +18 -1
  66. orq_ai_sdk/models/filegetop.py +19 -2
  67. orq_ai_sdk/models/filelistop.py +35 -2
  68. orq_ai_sdk/models/filepart.py +50 -1
  69. orq_ai_sdk/models/fileuploadop.py +51 -2
  70. orq_ai_sdk/models/generateconversationnameop.py +31 -20
  71. orq_ai_sdk/models/get_v2_evaluators_id_versionsop.py +34 -1
  72. orq_ai_sdk/models/get_v2_tools_tool_id_versions_version_id_op.py +18 -1
  73. orq_ai_sdk/models/get_v2_tools_tool_id_versionsop.py +34 -1
  74. orq_ai_sdk/models/getallmemoriesop.py +34 -21
  75. orq_ai_sdk/models/getallmemorydocumentsop.py +42 -1
  76. orq_ai_sdk/models/getallmemorystoresop.py +34 -1
  77. orq_ai_sdk/models/getallpromptsop.py +1696 -230
  78. orq_ai_sdk/models/getalltoolsop.py +325 -8
  79. orq_ai_sdk/models/getchunkscountop.py +34 -1
  80. orq_ai_sdk/models/getevalsop.py +395 -43
  81. orq_ai_sdk/models/getonechunkop.py +14 -19
  82. orq_ai_sdk/models/getoneknowledgeop.py +116 -96
  83. orq_ai_sdk/models/getonepromptop.py +1679 -230
  84. orq_ai_sdk/models/getpromptversionop.py +1676 -216
  85. orq_ai_sdk/models/imagecontentpartschema.py +50 -1
  86. orq_ai_sdk/models/internal/globals.py +18 -1
  87. orq_ai_sdk/models/invokeagentop.py +140 -2
  88. orq_ai_sdk/models/invokedeploymentrequest.py +418 -80
  89. orq_ai_sdk/models/invokeevalop.py +160 -131
  90. orq_ai_sdk/models/listagentsop.py +805 -166
  91. orq_ai_sdk/models/listchunksop.py +32 -19
  92. orq_ai_sdk/models/listchunkspaginatedop.py +46 -19
  93. orq_ai_sdk/models/listconversationsop.py +18 -1
  94. orq_ai_sdk/models/listdatasetdatapointsop.py +252 -42
  95. orq_ai_sdk/models/listdatasetsop.py +35 -2
  96. orq_ai_sdk/models/listdatasourcesop.py +35 -26
  97. orq_ai_sdk/models/{listcontactsop.py → listidentitiesop.py} +89 -79
  98. orq_ai_sdk/models/listknowledgebasesop.py +132 -96
  99. orq_ai_sdk/models/listmodelsop.py +1 -0
  100. orq_ai_sdk/models/listpromptversionsop.py +1690 -216
  101. orq_ai_sdk/models/parseop.py +161 -17
  102. orq_ai_sdk/models/partdoneevent.py +19 -2
  103. orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
  104. orq_ai_sdk/models/publiccontact.py +27 -4
  105. orq_ai_sdk/models/publicidentity.py +62 -0
  106. orq_ai_sdk/models/reasoningpart.py +19 -2
  107. orq_ai_sdk/models/refusalpartschema.py +18 -1
  108. orq_ai_sdk/models/remoteconfigsgetconfigop.py +34 -1
  109. orq_ai_sdk/models/responsedoneevent.py +114 -84
  110. orq_ai_sdk/models/responsestartedevent.py +18 -1
  111. orq_ai_sdk/models/retrieveagentrequestop.py +799 -166
  112. orq_ai_sdk/models/retrievedatapointop.py +236 -42
  113. orq_ai_sdk/models/retrievedatasetop.py +19 -2
  114. orq_ai_sdk/models/retrievedatasourceop.py +17 -26
  115. orq_ai_sdk/models/{retrievecontactop.py → retrieveidentityop.py} +38 -41
  116. orq_ai_sdk/models/retrievememorydocumentop.py +18 -1
  117. orq_ai_sdk/models/retrievememoryop.py +18 -21
  118. orq_ai_sdk/models/retrievememorystoreop.py +18 -1
  119. orq_ai_sdk/models/retrievetoolop.py +309 -8
  120. orq_ai_sdk/models/runagentop.py +1462 -196
  121. orq_ai_sdk/models/searchknowledgeop.py +108 -1
  122. orq_ai_sdk/models/security.py +18 -1
  123. orq_ai_sdk/models/streamagentop.py +93 -2
  124. orq_ai_sdk/models/streamrunagentop.py +1439 -194
  125. orq_ai_sdk/models/textcontentpartschema.py +34 -1
  126. orq_ai_sdk/models/thinkingconfigenabledschema.py +18 -1
  127. orq_ai_sdk/models/toolcallpart.py +18 -1
  128. orq_ai_sdk/models/tooldoneevent.py +18 -1
  129. orq_ai_sdk/models/toolexecutionfailedstreamingevent.py +50 -1
  130. orq_ai_sdk/models/toolexecutionfinishedstreamingevent.py +34 -1
  131. orq_ai_sdk/models/toolexecutionstartedstreamingevent.py +34 -1
  132. orq_ai_sdk/models/toolresultpart.py +18 -1
  133. orq_ai_sdk/models/toolreviewrequestedevent.py +18 -1
  134. orq_ai_sdk/models/toolstartedevent.py +18 -1
  135. orq_ai_sdk/models/updateagentop.py +1968 -397
  136. orq_ai_sdk/models/updatechunkop.py +46 -19
  137. orq_ai_sdk/models/updateconversationop.py +61 -39
  138. orq_ai_sdk/models/updatedatapointop.py +424 -80
  139. orq_ai_sdk/models/updatedatasetop.py +51 -2
  140. orq_ai_sdk/models/updatedatasourceop.py +17 -26
  141. orq_ai_sdk/models/updateevalop.py +577 -16
  142. orq_ai_sdk/models/{updatecontactop.py → updateidentityop.py} +78 -68
  143. orq_ai_sdk/models/updateknowledgeop.py +234 -190
  144. orq_ai_sdk/models/updatememorydocumentop.py +50 -1
  145. orq_ai_sdk/models/updatememoryop.py +50 -21
  146. orq_ai_sdk/models/updatememorystoreop.py +66 -1
  147. orq_ai_sdk/models/updatepromptop.py +2854 -1448
  148. orq_ai_sdk/models/updatetoolop.py +592 -9
  149. orq_ai_sdk/models/usermessagerequest.py +18 -2
  150. orq_ai_sdk/moderations.py +218 -0
  151. orq_ai_sdk/orq_completions.py +666 -0
  152. orq_ai_sdk/orq_responses.py +398 -0
  153. orq_ai_sdk/prompts.py +28 -36
  154. orq_ai_sdk/rerank.py +330 -0
  155. orq_ai_sdk/router.py +89 -641
  156. orq_ai_sdk/sdk.py +3 -0
  157. orq_ai_sdk/speech.py +333 -0
  158. orq_ai_sdk/transcriptions.py +416 -0
  159. orq_ai_sdk/translations.py +384 -0
  160. orq_ai_sdk/utils/__init__.py +13 -1
  161. orq_ai_sdk/variations.py +364 -0
  162. {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/METADATA +169 -148
  163. orq_ai_sdk-4.3.0rc7.dist-info/RECORD +263 -0
  164. {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/WHEEL +2 -1
  165. orq_ai_sdk-4.3.0rc7.dist-info/top_level.txt +1 -0
  166. orq_ai_sdk-4.2.0rc28.dist-info/RECORD +0 -233
@@ -100,6 +100,22 @@ class UpdateAgentResponseFormatAgentsJSONSchema(BaseModel):
100
100
  strict: Optional[bool] = False
101
101
  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."""
102
102
 
103
+ @model_serializer(mode="wrap")
104
+ def serialize_model(self, handler):
105
+ optional_fields = set(["description", "schema", "strict"])
106
+ serialized = handler(self)
107
+ m = {}
108
+
109
+ for n, f in type(self).model_fields.items():
110
+ k = f.alias or n
111
+ val = serialized.get(k)
112
+
113
+ if val != UNSET_SENTINEL:
114
+ if val is not None or k not in optional_fields:
115
+ m[k] = val
116
+
117
+ return m
118
+
103
119
 
104
120
  class UpdateAgentResponseFormatJSONSchemaTypedDict(TypedDict):
105
121
  r"""
@@ -228,6 +244,22 @@ class ModelConfigurationStreamOptions(BaseModel):
228
244
  include_usage: Optional[bool] = None
229
245
  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."""
230
246
 
247
+ @model_serializer(mode="wrap")
248
+ def serialize_model(self, handler):
249
+ optional_fields = set(["include_usage"])
250
+ serialized = handler(self)
251
+ m = {}
252
+
253
+ for n, f in type(self).model_fields.items():
254
+ k = f.alias or n
255
+ val = serialized.get(k)
256
+
257
+ if val != UNSET_SENTINEL:
258
+ if val is not None or k not in optional_fields:
259
+ m[k] = val
260
+
261
+ return m
262
+
231
263
 
232
264
  ModelConfigurationThinkingTypedDict = TypeAliasType(
233
265
  "ModelConfigurationThinkingTypedDict",
@@ -270,6 +302,22 @@ class UpdateAgentToolChoice2(BaseModel):
270
302
  type: Optional[UpdateAgentToolChoiceType] = None
271
303
  r"""The type of the tool. Currently, only function is supported."""
272
304
 
305
+ @model_serializer(mode="wrap")
306
+ def serialize_model(self, handler):
307
+ optional_fields = set(["type"])
308
+ serialized = handler(self)
309
+ m = {}
310
+
311
+ for n, f in type(self).model_fields.items():
312
+ k = f.alias or n
313
+ val = serialized.get(k)
314
+
315
+ if val != UNSET_SENTINEL:
316
+ if val is not None or k not in optional_fields:
317
+ m[k] = val
318
+
319
+ return m
320
+
273
321
 
274
322
  UpdateAgentToolChoice1 = Literal[
275
323
  "none",
@@ -334,9 +382,159 @@ class ModelConfigurationGuardrails(BaseModel):
334
382
  r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
335
383
 
336
384
 
385
+ class ModelConfigurationFallbacksTypedDict(TypedDict):
386
+ model: str
387
+ r"""Fallback model identifier"""
388
+
389
+
390
+ class ModelConfigurationFallbacks(BaseModel):
391
+ model: str
392
+ r"""Fallback model identifier"""
393
+
394
+
395
+ class UpdateAgentModelConfigurationRetryTypedDict(TypedDict):
396
+ r"""Retry configuration for the request"""
397
+
398
+ count: NotRequired[float]
399
+ r"""Number of retry attempts (1-5)"""
400
+ on_codes: NotRequired[List[float]]
401
+ r"""HTTP status codes that trigger retry logic"""
402
+
403
+
404
+ class UpdateAgentModelConfigurationRetry(BaseModel):
405
+ r"""Retry configuration for the request"""
406
+
407
+ count: Optional[float] = 3
408
+ r"""Number of retry attempts (1-5)"""
409
+
410
+ on_codes: Optional[List[float]] = None
411
+ r"""HTTP status codes that trigger retry logic"""
412
+
413
+ @model_serializer(mode="wrap")
414
+ def serialize_model(self, handler):
415
+ optional_fields = set(["count", "on_codes"])
416
+ serialized = handler(self)
417
+ m = {}
418
+
419
+ for n, f in type(self).model_fields.items():
420
+ k = f.alias or n
421
+ val = serialized.get(k)
422
+
423
+ if val != UNSET_SENTINEL:
424
+ if val is not None or k not in optional_fields:
425
+ m[k] = val
426
+
427
+ return m
428
+
429
+
430
+ UpdateAgentModelConfigurationType = Literal["exact_match",]
431
+
432
+
433
+ class ModelConfigurationCacheTypedDict(TypedDict):
434
+ r"""Cache configuration for the request."""
435
+
436
+ type: UpdateAgentModelConfigurationType
437
+ ttl: NotRequired[float]
438
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
439
+
440
+
441
+ class ModelConfigurationCache(BaseModel):
442
+ r"""Cache configuration for the request."""
443
+
444
+ type: UpdateAgentModelConfigurationType
445
+
446
+ ttl: Optional[float] = 1800
447
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
448
+
449
+ @model_serializer(mode="wrap")
450
+ def serialize_model(self, handler):
451
+ optional_fields = set(["ttl"])
452
+ serialized = handler(self)
453
+ m = {}
454
+
455
+ for n, f in type(self).model_fields.items():
456
+ k = f.alias or n
457
+ val = serialized.get(k)
458
+
459
+ if val != UNSET_SENTINEL:
460
+ if val is not None or k not in optional_fields:
461
+ m[k] = val
462
+
463
+ return m
464
+
465
+
466
+ UpdateAgentLoadBalancerType = Literal["weight_based",]
467
+
468
+
469
+ class UpdateAgentLoadBalancerModelsTypedDict(TypedDict):
470
+ model: str
471
+ r"""Model identifier for load balancing"""
472
+ weight: NotRequired[float]
473
+ r"""Weight assigned to this model for load balancing"""
474
+
475
+
476
+ class UpdateAgentLoadBalancerModels(BaseModel):
477
+ model: str
478
+ r"""Model identifier for load balancing"""
479
+
480
+ weight: Optional[float] = 0.5
481
+ r"""Weight assigned to this model for load balancing"""
482
+
483
+ @model_serializer(mode="wrap")
484
+ def serialize_model(self, handler):
485
+ optional_fields = set(["weight"])
486
+ serialized = handler(self)
487
+ m = {}
488
+
489
+ for n, f in type(self).model_fields.items():
490
+ k = f.alias or n
491
+ val = serialized.get(k)
492
+
493
+ if val != UNSET_SENTINEL:
494
+ if val is not None or k not in optional_fields:
495
+ m[k] = val
496
+
497
+ return m
498
+
499
+
500
+ class UpdateAgentLoadBalancer1TypedDict(TypedDict):
501
+ type: UpdateAgentLoadBalancerType
502
+ models: List[UpdateAgentLoadBalancerModelsTypedDict]
503
+
504
+
505
+ class UpdateAgentLoadBalancer1(BaseModel):
506
+ type: UpdateAgentLoadBalancerType
507
+
508
+ models: List[UpdateAgentLoadBalancerModels]
509
+
510
+
511
+ ModelConfigurationLoadBalancerTypedDict = UpdateAgentLoadBalancer1TypedDict
512
+ r"""Load balancer configuration for the request."""
513
+
514
+
515
+ ModelConfigurationLoadBalancer = UpdateAgentLoadBalancer1
516
+ r"""Load balancer configuration for the request."""
517
+
518
+
519
+ class ModelConfigurationTimeoutTypedDict(TypedDict):
520
+ 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."""
521
+
522
+ call_timeout: float
523
+ r"""Timeout value in milliseconds"""
524
+
525
+
526
+ class ModelConfigurationTimeout(BaseModel):
527
+ 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."""
528
+
529
+ call_timeout: float
530
+ r"""Timeout value in milliseconds"""
531
+
532
+
337
533
  class ModelConfigurationParametersTypedDict(TypedDict):
338
534
  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."""
339
535
 
536
+ name: NotRequired[str]
537
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
340
538
  audio: NotRequired[Nullable[UpdateAgentModelConfigurationAudioTypedDict]]
341
539
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
342
540
  frequency_penalty: NotRequired[Nullable[float]]
@@ -391,11 +589,24 @@ class ModelConfigurationParametersTypedDict(TypedDict):
391
589
  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\"]."""
392
590
  guardrails: NotRequired[List[ModelConfigurationGuardrailsTypedDict]]
393
591
  r"""A list of guardrails to apply to the request."""
592
+ fallbacks: NotRequired[List[ModelConfigurationFallbacksTypedDict]]
593
+ r"""Array of fallback models to use if primary model fails"""
594
+ retry: NotRequired[UpdateAgentModelConfigurationRetryTypedDict]
595
+ r"""Retry configuration for the request"""
596
+ cache: NotRequired[ModelConfigurationCacheTypedDict]
597
+ r"""Cache configuration for the request."""
598
+ load_balancer: NotRequired[ModelConfigurationLoadBalancerTypedDict]
599
+ r"""Load balancer configuration for the request."""
600
+ timeout: NotRequired[ModelConfigurationTimeoutTypedDict]
601
+ 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."""
394
602
 
395
603
 
396
604
  class ModelConfigurationParameters(BaseModel):
397
605
  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."""
398
606
 
607
+ name: Optional[str] = None
608
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
609
+
399
610
  audio: OptionalNullable[UpdateAgentModelConfigurationAudio] = UNSET
400
611
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
401
612
 
@@ -472,77 +683,97 @@ class ModelConfigurationParameters(BaseModel):
472
683
  guardrails: Optional[List[ModelConfigurationGuardrails]] = None
473
684
  r"""A list of guardrails to apply to the request."""
474
685
 
686
+ fallbacks: Optional[List[ModelConfigurationFallbacks]] = None
687
+ r"""Array of fallback models to use if primary model fails"""
688
+
689
+ retry: Optional[UpdateAgentModelConfigurationRetry] = None
690
+ r"""Retry configuration for the request"""
691
+
692
+ cache: Optional[ModelConfigurationCache] = None
693
+ r"""Cache configuration for the request."""
694
+
695
+ load_balancer: Optional[ModelConfigurationLoadBalancer] = None
696
+ r"""Load balancer configuration for the request."""
697
+
698
+ timeout: Optional[ModelConfigurationTimeout] = None
699
+ 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."""
700
+
475
701
  @model_serializer(mode="wrap")
476
702
  def serialize_model(self, handler):
477
- optional_fields = [
478
- "audio",
479
- "frequency_penalty",
480
- "max_tokens",
481
- "max_completion_tokens",
482
- "logprobs",
483
- "top_logprobs",
484
- "n",
485
- "presence_penalty",
486
- "response_format",
487
- "reasoning_effort",
488
- "verbosity",
489
- "seed",
490
- "stop",
491
- "stream_options",
492
- "thinking",
493
- "temperature",
494
- "top_p",
495
- "top_k",
496
- "tool_choice",
497
- "parallel_tool_calls",
498
- "modalities",
499
- "guardrails",
500
- ]
501
- nullable_fields = [
502
- "audio",
503
- "frequency_penalty",
504
- "max_tokens",
505
- "max_completion_tokens",
506
- "logprobs",
507
- "top_logprobs",
508
- "n",
509
- "presence_penalty",
510
- "seed",
511
- "stop",
512
- "stream_options",
513
- "temperature",
514
- "top_p",
515
- "top_k",
516
- "modalities",
517
- ]
518
- null_default_fields = []
519
-
520
- serialized = handler(self)
521
-
522
- m = {}
523
-
524
- for n, f in type(self).model_fields.items():
525
- k = f.alias or n
526
- val = serialized.get(k)
527
- serialized.pop(k, None)
528
-
529
- optional_nullable = k in optional_fields and k in nullable_fields
530
- is_set = (
531
- self.__pydantic_fields_set__.intersection({n})
532
- or k in null_default_fields
533
- ) # pylint: disable=no-member
534
-
535
- if val is not None and val != UNSET_SENTINEL:
536
- m[k] = val
537
- elif val != UNSET_SENTINEL and (
538
- not k in optional_fields or (optional_nullable and is_set)
539
- ):
540
- m[k] = val
541
-
542
- return m
543
-
544
-
545
- class ModelConfigurationRetryTypedDict(TypedDict):
703
+ optional_fields = set(
704
+ [
705
+ "name",
706
+ "audio",
707
+ "frequency_penalty",
708
+ "max_tokens",
709
+ "max_completion_tokens",
710
+ "logprobs",
711
+ "top_logprobs",
712
+ "n",
713
+ "presence_penalty",
714
+ "response_format",
715
+ "reasoning_effort",
716
+ "verbosity",
717
+ "seed",
718
+ "stop",
719
+ "stream_options",
720
+ "thinking",
721
+ "temperature",
722
+ "top_p",
723
+ "top_k",
724
+ "tool_choice",
725
+ "parallel_tool_calls",
726
+ "modalities",
727
+ "guardrails",
728
+ "fallbacks",
729
+ "retry",
730
+ "cache",
731
+ "load_balancer",
732
+ "timeout",
733
+ ]
734
+ )
735
+ nullable_fields = set(
736
+ [
737
+ "audio",
738
+ "frequency_penalty",
739
+ "max_tokens",
740
+ "max_completion_tokens",
741
+ "logprobs",
742
+ "top_logprobs",
743
+ "n",
744
+ "presence_penalty",
745
+ "seed",
746
+ "stop",
747
+ "stream_options",
748
+ "temperature",
749
+ "top_p",
750
+ "top_k",
751
+ "modalities",
752
+ ]
753
+ )
754
+ serialized = handler(self)
755
+ m = {}
756
+
757
+ for n, f in type(self).model_fields.items():
758
+ k = f.alias or n
759
+ val = serialized.get(k)
760
+ is_nullable_and_explicitly_set = (
761
+ k in nullable_fields
762
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
763
+ )
764
+
765
+ if val != UNSET_SENTINEL:
766
+ if (
767
+ val is not None
768
+ or k not in optional_fields
769
+ or is_nullable_and_explicitly_set
770
+ ):
771
+ m[k] = val
772
+
773
+ return m
774
+
775
+
776
+ class UpdateAgentModelConfigurationAgentsRetryTypedDict(TypedDict):
546
777
  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."""
547
778
 
548
779
  count: NotRequired[float]
@@ -551,7 +782,7 @@ class ModelConfigurationRetryTypedDict(TypedDict):
551
782
  r"""HTTP status codes that trigger retry logic"""
552
783
 
553
784
 
554
- class ModelConfigurationRetry(BaseModel):
785
+ class UpdateAgentModelConfigurationAgentsRetry(BaseModel):
555
786
  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
787
 
557
788
  count: Optional[float] = 3
@@ -560,6 +791,22 @@ class ModelConfigurationRetry(BaseModel):
560
791
  on_codes: Optional[List[float]] = None
561
792
  r"""HTTP status codes that trigger retry logic"""
562
793
 
794
+ @model_serializer(mode="wrap")
795
+ def serialize_model(self, handler):
796
+ optional_fields = set(["count", "on_codes"])
797
+ serialized = handler(self)
798
+ m = {}
799
+
800
+ for n, f in type(self).model_fields.items():
801
+ k = f.alias or n
802
+ val = serialized.get(k)
803
+
804
+ if val != UNSET_SENTINEL:
805
+ if val is not None or k not in optional_fields:
806
+ m[k] = val
807
+
808
+ return m
809
+
563
810
 
564
811
  class UpdateAgentModelConfiguration2TypedDict(TypedDict):
565
812
  r"""
@@ -571,7 +818,7 @@ class UpdateAgentModelConfiguration2TypedDict(TypedDict):
571
818
  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."""
572
819
  parameters: NotRequired[ModelConfigurationParametersTypedDict]
573
820
  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."""
574
- retry: NotRequired[ModelConfigurationRetryTypedDict]
821
+ retry: NotRequired[UpdateAgentModelConfigurationAgentsRetryTypedDict]
575
822
  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."""
576
823
 
577
824
 
@@ -587,9 +834,25 @@ class UpdateAgentModelConfiguration2(BaseModel):
587
834
  parameters: Optional[ModelConfigurationParameters] = None
588
835
  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."""
589
836
 
590
- retry: Optional[ModelConfigurationRetry] = None
837
+ retry: Optional[UpdateAgentModelConfigurationAgentsRetry] = None
591
838
  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."""
592
839
 
840
+ @model_serializer(mode="wrap")
841
+ def serialize_model(self, handler):
842
+ optional_fields = set(["parameters", "retry"])
843
+ serialized = handler(self)
844
+ m = {}
845
+
846
+ for n, f in type(self).model_fields.items():
847
+ k = f.alias or n
848
+ val = serialized.get(k)
849
+
850
+ if val != UNSET_SENTINEL:
851
+ if val is not None or k not in optional_fields:
852
+ m[k] = val
853
+
854
+ return m
855
+
593
856
 
594
857
  UpdateAgentModelConfigurationTypedDict = TypeAliasType(
595
858
  "UpdateAgentModelConfigurationTypedDict",
@@ -675,6 +938,22 @@ class UpdateAgentResponseFormatAgentsRequestRequestBodyJSONSchema(BaseModel):
675
938
  strict: Optional[bool] = False
676
939
  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."""
677
940
 
941
+ @model_serializer(mode="wrap")
942
+ def serialize_model(self, handler):
943
+ optional_fields = set(["description", "schema", "strict"])
944
+ serialized = handler(self)
945
+ m = {}
946
+
947
+ for n, f in type(self).model_fields.items():
948
+ k = f.alias or n
949
+ val = serialized.get(k)
950
+
951
+ if val != UNSET_SENTINEL:
952
+ if val is not None or k not in optional_fields:
953
+ m[k] = val
954
+
955
+ return m
956
+
678
957
 
679
958
  class UpdateAgentResponseFormatAgentsRequestJSONSchemaTypedDict(TypedDict):
680
959
  r"""
@@ -807,6 +1086,22 @@ class UpdateAgentFallbackModelConfigurationStreamOptions(BaseModel):
807
1086
  include_usage: Optional[bool] = None
808
1087
  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."""
809
1088
 
1089
+ @model_serializer(mode="wrap")
1090
+ def serialize_model(self, handler):
1091
+ optional_fields = set(["include_usage"])
1092
+ serialized = handler(self)
1093
+ m = {}
1094
+
1095
+ for n, f in type(self).model_fields.items():
1096
+ k = f.alias or n
1097
+ val = serialized.get(k)
1098
+
1099
+ if val != UNSET_SENTINEL:
1100
+ if val is not None or k not in optional_fields:
1101
+ m[k] = val
1102
+
1103
+ return m
1104
+
810
1105
 
811
1106
  UpdateAgentFallbackModelConfigurationThinkingTypedDict = TypeAliasType(
812
1107
  "UpdateAgentFallbackModelConfigurationThinkingTypedDict",
@@ -849,6 +1144,22 @@ class UpdateAgentToolChoiceAgents2(BaseModel):
849
1144
  type: Optional[UpdateAgentToolChoiceAgentsType] = None
850
1145
  r"""The type of the tool. Currently, only function is supported."""
851
1146
 
1147
+ @model_serializer(mode="wrap")
1148
+ def serialize_model(self, handler):
1149
+ optional_fields = set(["type"])
1150
+ serialized = handler(self)
1151
+ m = {}
1152
+
1153
+ for n, f in type(self).model_fields.items():
1154
+ k = f.alias or n
1155
+ val = serialized.get(k)
1156
+
1157
+ if val != UNSET_SENTINEL:
1158
+ if val is not None or k not in optional_fields:
1159
+ m[k] = val
1160
+
1161
+ return m
1162
+
852
1163
 
853
1164
  UpdateAgentToolChoiceAgents1 = Literal[
854
1165
  "none",
@@ -915,76 +1226,245 @@ class UpdateAgentFallbackModelConfigurationGuardrails(BaseModel):
915
1226
  r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
916
1227
 
917
1228
 
918
- class UpdateAgentFallbackModelConfigurationParametersTypedDict(TypedDict):
919
- r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1229
+ class UpdateAgentFallbackModelConfigurationFallbacksTypedDict(TypedDict):
1230
+ model: str
1231
+ r"""Fallback model identifier"""
920
1232
 
921
- audio: NotRequired[Nullable[UpdateAgentFallbackModelConfigurationAudioTypedDict]]
922
- r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
923
- frequency_penalty: NotRequired[Nullable[float]]
924
- 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."""
925
- max_tokens: NotRequired[Nullable[int]]
926
- 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.
927
1233
 
928
- This value is now `deprecated` in favor of `max_completion_tokens`, and is not compatible with o1 series models.
929
- """
930
- max_completion_tokens: NotRequired[Nullable[int]]
931
- r"""An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens"""
932
- logprobs: NotRequired[Nullable[bool]]
933
- 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."""
934
- top_logprobs: NotRequired[Nullable[int]]
935
- 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."""
936
- n: NotRequired[Nullable[int]]
937
- 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."""
938
- presence_penalty: NotRequired[Nullable[float]]
939
- 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."""
940
- response_format: NotRequired[
941
- UpdateAgentFallbackModelConfigurationResponseFormatTypedDict
942
- ]
943
- r"""An object specifying the format that the model must output"""
944
- reasoning_effort: NotRequired[UpdateAgentFallbackModelConfigurationReasoningEffort]
945
- 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.
1234
+ class UpdateAgentFallbackModelConfigurationFallbacks(BaseModel):
1235
+ model: str
1236
+ r"""Fallback model identifier"""
946
1237
 
947
- - `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.
948
- - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
949
- - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
950
- - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
951
1238
 
952
- Any of \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\".
953
- """
954
- verbosity: NotRequired[str]
955
- r"""Adjusts response verbosity. Lower levels yield shorter answers."""
956
- seed: NotRequired[Nullable[float]]
957
- 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."""
958
- stop: NotRequired[Nullable[UpdateAgentFallbackModelConfigurationStopTypedDict]]
959
- r"""Up to 4 sequences where the API will stop generating further tokens."""
960
- stream_options: NotRequired[
961
- Nullable[UpdateAgentFallbackModelConfigurationStreamOptionsTypedDict]
962
- ]
963
- r"""Options for streaming response. Only set this when you set stream: true."""
964
- thinking: NotRequired[UpdateAgentFallbackModelConfigurationThinkingTypedDict]
965
- temperature: NotRequired[Nullable[float]]
966
- 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."""
967
- top_p: NotRequired[Nullable[float]]
968
- r"""An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass."""
969
- top_k: NotRequired[Nullable[float]]
970
- r"""Limits the model to consider only the top k most likely tokens at each step."""
971
- tool_choice: NotRequired[UpdateAgentFallbackModelConfigurationToolChoiceTypedDict]
972
- r"""Controls which (if any) tool is called by the model."""
973
- parallel_tool_calls: NotRequired[bool]
974
- r"""Whether to enable parallel function calling during tool use."""
975
- modalities: NotRequired[
976
- Nullable[List[UpdateAgentFallbackModelConfigurationModalities]]
977
- ]
978
- 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\"]."""
979
- guardrails: NotRequired[
1239
+ class UpdateAgentFallbackModelConfigurationRetryTypedDict(TypedDict):
1240
+ r"""Retry configuration for the request"""
1241
+
1242
+ count: NotRequired[float]
1243
+ r"""Number of retry attempts (1-5)"""
1244
+ on_codes: NotRequired[List[float]]
1245
+ r"""HTTP status codes that trigger retry logic"""
1246
+
1247
+
1248
+ class UpdateAgentFallbackModelConfigurationRetry(BaseModel):
1249
+ r"""Retry configuration for the request"""
1250
+
1251
+ count: Optional[float] = 3
1252
+ r"""Number of retry attempts (1-5)"""
1253
+
1254
+ on_codes: Optional[List[float]] = None
1255
+ r"""HTTP status codes that trigger retry logic"""
1256
+
1257
+ @model_serializer(mode="wrap")
1258
+ def serialize_model(self, handler):
1259
+ optional_fields = set(["count", "on_codes"])
1260
+ serialized = handler(self)
1261
+ m = {}
1262
+
1263
+ for n, f in type(self).model_fields.items():
1264
+ k = f.alias or n
1265
+ val = serialized.get(k)
1266
+
1267
+ if val != UNSET_SENTINEL:
1268
+ if val is not None or k not in optional_fields:
1269
+ m[k] = val
1270
+
1271
+ return m
1272
+
1273
+
1274
+ UpdateAgentFallbackModelConfigurationType = Literal["exact_match",]
1275
+
1276
+
1277
+ class UpdateAgentFallbackModelConfigurationCacheTypedDict(TypedDict):
1278
+ r"""Cache configuration for the request."""
1279
+
1280
+ type: UpdateAgentFallbackModelConfigurationType
1281
+ ttl: NotRequired[float]
1282
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1283
+
1284
+
1285
+ class UpdateAgentFallbackModelConfigurationCache(BaseModel):
1286
+ r"""Cache configuration for the request."""
1287
+
1288
+ type: UpdateAgentFallbackModelConfigurationType
1289
+
1290
+ ttl: Optional[float] = 1800
1291
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1292
+
1293
+ @model_serializer(mode="wrap")
1294
+ def serialize_model(self, handler):
1295
+ optional_fields = set(["ttl"])
1296
+ serialized = handler(self)
1297
+ m = {}
1298
+
1299
+ for n, f in type(self).model_fields.items():
1300
+ k = f.alias or n
1301
+ val = serialized.get(k)
1302
+
1303
+ if val != UNSET_SENTINEL:
1304
+ if val is not None or k not in optional_fields:
1305
+ m[k] = val
1306
+
1307
+ return m
1308
+
1309
+
1310
+ UpdateAgentLoadBalancerAgentsType = Literal["weight_based",]
1311
+
1312
+
1313
+ class UpdateAgentLoadBalancerAgentsModelsTypedDict(TypedDict):
1314
+ model: str
1315
+ r"""Model identifier for load balancing"""
1316
+ weight: NotRequired[float]
1317
+ r"""Weight assigned to this model for load balancing"""
1318
+
1319
+
1320
+ class UpdateAgentLoadBalancerAgentsModels(BaseModel):
1321
+ model: str
1322
+ r"""Model identifier for load balancing"""
1323
+
1324
+ weight: Optional[float] = 0.5
1325
+ r"""Weight assigned to this model for load balancing"""
1326
+
1327
+ @model_serializer(mode="wrap")
1328
+ def serialize_model(self, handler):
1329
+ optional_fields = set(["weight"])
1330
+ serialized = handler(self)
1331
+ m = {}
1332
+
1333
+ for n, f in type(self).model_fields.items():
1334
+ k = f.alias or n
1335
+ val = serialized.get(k)
1336
+
1337
+ if val != UNSET_SENTINEL:
1338
+ if val is not None or k not in optional_fields:
1339
+ m[k] = val
1340
+
1341
+ return m
1342
+
1343
+
1344
+ class UpdateAgentLoadBalancerAgents1TypedDict(TypedDict):
1345
+ type: UpdateAgentLoadBalancerAgentsType
1346
+ models: List[UpdateAgentLoadBalancerAgentsModelsTypedDict]
1347
+
1348
+
1349
+ class UpdateAgentLoadBalancerAgents1(BaseModel):
1350
+ type: UpdateAgentLoadBalancerAgentsType
1351
+
1352
+ models: List[UpdateAgentLoadBalancerAgentsModels]
1353
+
1354
+
1355
+ UpdateAgentFallbackModelConfigurationLoadBalancerTypedDict = (
1356
+ UpdateAgentLoadBalancerAgents1TypedDict
1357
+ )
1358
+ r"""Load balancer configuration for the request."""
1359
+
1360
+
1361
+ UpdateAgentFallbackModelConfigurationLoadBalancer = UpdateAgentLoadBalancerAgents1
1362
+ r"""Load balancer configuration for the request."""
1363
+
1364
+
1365
+ class UpdateAgentFallbackModelConfigurationTimeoutTypedDict(TypedDict):
1366
+ 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."""
1367
+
1368
+ call_timeout: float
1369
+ r"""Timeout value in milliseconds"""
1370
+
1371
+
1372
+ class UpdateAgentFallbackModelConfigurationTimeout(BaseModel):
1373
+ 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."""
1374
+
1375
+ call_timeout: float
1376
+ r"""Timeout value in milliseconds"""
1377
+
1378
+
1379
+ class UpdateAgentFallbackModelConfigurationParametersTypedDict(TypedDict):
1380
+ r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1381
+
1382
+ name: NotRequired[str]
1383
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
1384
+ audio: NotRequired[Nullable[UpdateAgentFallbackModelConfigurationAudioTypedDict]]
1385
+ r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
1386
+ frequency_penalty: NotRequired[Nullable[float]]
1387
+ 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."""
1388
+ max_tokens: NotRequired[Nullable[int]]
1389
+ 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.
1390
+
1391
+ This value is now `deprecated` in favor of `max_completion_tokens`, and is not compatible with o1 series models.
1392
+ """
1393
+ max_completion_tokens: NotRequired[Nullable[int]]
1394
+ r"""An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens"""
1395
+ logprobs: NotRequired[Nullable[bool]]
1396
+ 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."""
1397
+ top_logprobs: NotRequired[Nullable[int]]
1398
+ 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."""
1399
+ n: NotRequired[Nullable[int]]
1400
+ 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."""
1401
+ presence_penalty: NotRequired[Nullable[float]]
1402
+ 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."""
1403
+ response_format: NotRequired[
1404
+ UpdateAgentFallbackModelConfigurationResponseFormatTypedDict
1405
+ ]
1406
+ r"""An object specifying the format that the model must output"""
1407
+ reasoning_effort: NotRequired[UpdateAgentFallbackModelConfigurationReasoningEffort]
1408
+ 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.
1409
+
1410
+ - `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.
1411
+ - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
1412
+ - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
1413
+ - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
1414
+
1415
+ Any of \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\".
1416
+ """
1417
+ verbosity: NotRequired[str]
1418
+ r"""Adjusts response verbosity. Lower levels yield shorter answers."""
1419
+ seed: NotRequired[Nullable[float]]
1420
+ 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."""
1421
+ stop: NotRequired[Nullable[UpdateAgentFallbackModelConfigurationStopTypedDict]]
1422
+ r"""Up to 4 sequences where the API will stop generating further tokens."""
1423
+ stream_options: NotRequired[
1424
+ Nullable[UpdateAgentFallbackModelConfigurationStreamOptionsTypedDict]
1425
+ ]
1426
+ r"""Options for streaming response. Only set this when you set stream: true."""
1427
+ thinking: NotRequired[UpdateAgentFallbackModelConfigurationThinkingTypedDict]
1428
+ temperature: NotRequired[Nullable[float]]
1429
+ 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."""
1430
+ top_p: NotRequired[Nullable[float]]
1431
+ r"""An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass."""
1432
+ top_k: NotRequired[Nullable[float]]
1433
+ r"""Limits the model to consider only the top k most likely tokens at each step."""
1434
+ tool_choice: NotRequired[UpdateAgentFallbackModelConfigurationToolChoiceTypedDict]
1435
+ r"""Controls which (if any) tool is called by the model."""
1436
+ parallel_tool_calls: NotRequired[bool]
1437
+ r"""Whether to enable parallel function calling during tool use."""
1438
+ modalities: NotRequired[
1439
+ Nullable[List[UpdateAgentFallbackModelConfigurationModalities]]
1440
+ ]
1441
+ 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\"]."""
1442
+ guardrails: NotRequired[
980
1443
  List[UpdateAgentFallbackModelConfigurationGuardrailsTypedDict]
981
1444
  ]
982
1445
  r"""A list of guardrails to apply to the request."""
1446
+ fallbacks: NotRequired[
1447
+ List[UpdateAgentFallbackModelConfigurationFallbacksTypedDict]
1448
+ ]
1449
+ r"""Array of fallback models to use if primary model fails"""
1450
+ retry: NotRequired[UpdateAgentFallbackModelConfigurationRetryTypedDict]
1451
+ r"""Retry configuration for the request"""
1452
+ cache: NotRequired[UpdateAgentFallbackModelConfigurationCacheTypedDict]
1453
+ r"""Cache configuration for the request."""
1454
+ load_balancer: NotRequired[
1455
+ UpdateAgentFallbackModelConfigurationLoadBalancerTypedDict
1456
+ ]
1457
+ r"""Load balancer configuration for the request."""
1458
+ timeout: NotRequired[UpdateAgentFallbackModelConfigurationTimeoutTypedDict]
1459
+ 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."""
983
1460
 
984
1461
 
985
1462
  class UpdateAgentFallbackModelConfigurationParameters(BaseModel):
986
1463
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
987
1464
 
1465
+ name: Optional[str] = None
1466
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
1467
+
988
1468
  audio: OptionalNullable[UpdateAgentFallbackModelConfigurationAudio] = UNSET
989
1469
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
990
1470
 
@@ -1069,77 +1549,97 @@ class UpdateAgentFallbackModelConfigurationParameters(BaseModel):
1069
1549
  guardrails: Optional[List[UpdateAgentFallbackModelConfigurationGuardrails]] = None
1070
1550
  r"""A list of guardrails to apply to the request."""
1071
1551
 
1552
+ fallbacks: Optional[List[UpdateAgentFallbackModelConfigurationFallbacks]] = None
1553
+ r"""Array of fallback models to use if primary model fails"""
1554
+
1555
+ retry: Optional[UpdateAgentFallbackModelConfigurationRetry] = None
1556
+ r"""Retry configuration for the request"""
1557
+
1558
+ cache: Optional[UpdateAgentFallbackModelConfigurationCache] = None
1559
+ r"""Cache configuration for the request."""
1560
+
1561
+ load_balancer: Optional[UpdateAgentFallbackModelConfigurationLoadBalancer] = None
1562
+ r"""Load balancer configuration for the request."""
1563
+
1564
+ timeout: Optional[UpdateAgentFallbackModelConfigurationTimeout] = None
1565
+ 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."""
1566
+
1072
1567
  @model_serializer(mode="wrap")
1073
1568
  def serialize_model(self, handler):
1074
- optional_fields = [
1075
- "audio",
1076
- "frequency_penalty",
1077
- "max_tokens",
1078
- "max_completion_tokens",
1079
- "logprobs",
1080
- "top_logprobs",
1081
- "n",
1082
- "presence_penalty",
1083
- "response_format",
1084
- "reasoning_effort",
1085
- "verbosity",
1086
- "seed",
1087
- "stop",
1088
- "stream_options",
1089
- "thinking",
1090
- "temperature",
1091
- "top_p",
1092
- "top_k",
1093
- "tool_choice",
1094
- "parallel_tool_calls",
1095
- "modalities",
1096
- "guardrails",
1097
- ]
1098
- nullable_fields = [
1099
- "audio",
1100
- "frequency_penalty",
1101
- "max_tokens",
1102
- "max_completion_tokens",
1103
- "logprobs",
1104
- "top_logprobs",
1105
- "n",
1106
- "presence_penalty",
1107
- "seed",
1108
- "stop",
1109
- "stream_options",
1110
- "temperature",
1111
- "top_p",
1112
- "top_k",
1113
- "modalities",
1114
- ]
1115
- null_default_fields = []
1116
-
1569
+ optional_fields = set(
1570
+ [
1571
+ "name",
1572
+ "audio",
1573
+ "frequency_penalty",
1574
+ "max_tokens",
1575
+ "max_completion_tokens",
1576
+ "logprobs",
1577
+ "top_logprobs",
1578
+ "n",
1579
+ "presence_penalty",
1580
+ "response_format",
1581
+ "reasoning_effort",
1582
+ "verbosity",
1583
+ "seed",
1584
+ "stop",
1585
+ "stream_options",
1586
+ "thinking",
1587
+ "temperature",
1588
+ "top_p",
1589
+ "top_k",
1590
+ "tool_choice",
1591
+ "parallel_tool_calls",
1592
+ "modalities",
1593
+ "guardrails",
1594
+ "fallbacks",
1595
+ "retry",
1596
+ "cache",
1597
+ "load_balancer",
1598
+ "timeout",
1599
+ ]
1600
+ )
1601
+ nullable_fields = set(
1602
+ [
1603
+ "audio",
1604
+ "frequency_penalty",
1605
+ "max_tokens",
1606
+ "max_completion_tokens",
1607
+ "logprobs",
1608
+ "top_logprobs",
1609
+ "n",
1610
+ "presence_penalty",
1611
+ "seed",
1612
+ "stop",
1613
+ "stream_options",
1614
+ "temperature",
1615
+ "top_p",
1616
+ "top_k",
1617
+ "modalities",
1618
+ ]
1619
+ )
1117
1620
  serialized = handler(self)
1118
-
1119
1621
  m = {}
1120
1622
 
1121
1623
  for n, f in type(self).model_fields.items():
1122
1624
  k = f.alias or n
1123
1625
  val = serialized.get(k)
1124
- serialized.pop(k, None)
1125
-
1126
- optional_nullable = k in optional_fields and k in nullable_fields
1127
- is_set = (
1128
- self.__pydantic_fields_set__.intersection({n})
1129
- or k in null_default_fields
1130
- ) # pylint: disable=no-member
1131
-
1132
- if val is not None and val != UNSET_SENTINEL:
1133
- m[k] = val
1134
- elif val != UNSET_SENTINEL and (
1135
- not k in optional_fields or (optional_nullable and is_set)
1136
- ):
1137
- m[k] = val
1626
+ is_nullable_and_explicitly_set = (
1627
+ k in nullable_fields
1628
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
1629
+ )
1630
+
1631
+ if val != UNSET_SENTINEL:
1632
+ if (
1633
+ val is not None
1634
+ or k not in optional_fields
1635
+ or is_nullable_and_explicitly_set
1636
+ ):
1637
+ m[k] = val
1138
1638
 
1139
1639
  return m
1140
1640
 
1141
1641
 
1142
- class UpdateAgentFallbackModelConfigurationRetryTypedDict(TypedDict):
1642
+ class UpdateAgentFallbackModelConfigurationAgentsRetryTypedDict(TypedDict):
1143
1643
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1144
1644
 
1145
1645
  count: NotRequired[float]
@@ -1148,7 +1648,7 @@ class UpdateAgentFallbackModelConfigurationRetryTypedDict(TypedDict):
1148
1648
  r"""HTTP status codes that trigger retry logic"""
1149
1649
 
1150
1650
 
1151
- class UpdateAgentFallbackModelConfigurationRetry(BaseModel):
1651
+ class UpdateAgentFallbackModelConfigurationAgentsRetry(BaseModel):
1152
1652
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1153
1653
 
1154
1654
  count: Optional[float] = 3
@@ -1157,6 +1657,22 @@ class UpdateAgentFallbackModelConfigurationRetry(BaseModel):
1157
1657
  on_codes: Optional[List[float]] = None
1158
1658
  r"""HTTP status codes that trigger retry logic"""
1159
1659
 
1660
+ @model_serializer(mode="wrap")
1661
+ def serialize_model(self, handler):
1662
+ optional_fields = set(["count", "on_codes"])
1663
+ serialized = handler(self)
1664
+ m = {}
1665
+
1666
+ for n, f in type(self).model_fields.items():
1667
+ k = f.alias or n
1668
+ val = serialized.get(k)
1669
+
1670
+ if val != UNSET_SENTINEL:
1671
+ if val is not None or k not in optional_fields:
1672
+ m[k] = val
1673
+
1674
+ return m
1675
+
1160
1676
 
1161
1677
  class UpdateAgentFallbackModelConfiguration2TypedDict(TypedDict):
1162
1678
  r"""Fallback model configuration with optional parameters and retry settings."""
@@ -1165,7 +1681,7 @@ class UpdateAgentFallbackModelConfiguration2TypedDict(TypedDict):
1165
1681
  r"""A fallback model ID string. Must support tool calling."""
1166
1682
  parameters: NotRequired[UpdateAgentFallbackModelConfigurationParametersTypedDict]
1167
1683
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1168
- retry: NotRequired[UpdateAgentFallbackModelConfigurationRetryTypedDict]
1684
+ retry: NotRequired[UpdateAgentFallbackModelConfigurationAgentsRetryTypedDict]
1169
1685
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1170
1686
 
1171
1687
 
@@ -1178,9 +1694,25 @@ class UpdateAgentFallbackModelConfiguration2(BaseModel):
1178
1694
  parameters: Optional[UpdateAgentFallbackModelConfigurationParameters] = None
1179
1695
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1180
1696
 
1181
- retry: Optional[UpdateAgentFallbackModelConfigurationRetry] = None
1697
+ retry: Optional[UpdateAgentFallbackModelConfigurationAgentsRetry] = None
1182
1698
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1183
1699
 
1700
+ @model_serializer(mode="wrap")
1701
+ def serialize_model(self, handler):
1702
+ optional_fields = set(["parameters", "retry"])
1703
+ serialized = handler(self)
1704
+ m = {}
1705
+
1706
+ for n, f in type(self).model_fields.items():
1707
+ k = f.alias or n
1708
+ val = serialized.get(k)
1709
+
1710
+ if val != UNSET_SENTINEL:
1711
+ if val is not None or k not in optional_fields:
1712
+ m[k] = val
1713
+
1714
+ return m
1715
+
1184
1716
 
1185
1717
  UpdateAgentFallbackModelConfigurationTypedDict = TypeAliasType(
1186
1718
  "UpdateAgentFallbackModelConfigurationTypedDict",
@@ -1204,7 +1736,7 @@ UpdateAgentToolApprovalRequired = Literal[
1204
1736
  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."""
1205
1737
 
1206
1738
 
1207
- UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools15Type = Literal[
1739
+ UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools16Type = Literal[
1208
1740
  "mcp",
1209
1741
  ]
1210
1742
  r"""MCP tool type"""
@@ -1216,7 +1748,7 @@ class AgentToolInputCRUDMCPToolTypedDict(TypedDict):
1216
1748
  tool_id: str
1217
1749
  r"""The ID of the specific nested tool within the MCP server"""
1218
1750
  type: NotRequired[
1219
- UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools15Type
1751
+ UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools16Type
1220
1752
  ]
1221
1753
  r"""MCP tool type"""
1222
1754
  key: NotRequired[str]
@@ -1234,7 +1766,7 @@ class AgentToolInputCRUDMCPTool(BaseModel):
1234
1766
  r"""The ID of the specific nested tool within the MCP server"""
1235
1767
 
1236
1768
  type: Optional[
1237
- UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools15Type
1769
+ UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools16Type
1238
1770
  ] = "mcp"
1239
1771
  r"""MCP tool type"""
1240
1772
 
@@ -1247,6 +1779,77 @@ class AgentToolInputCRUDMCPTool(BaseModel):
1247
1779
  requires_approval: Optional[bool] = False
1248
1780
  r"""Whether this tool requires approval before execution"""
1249
1781
 
1782
+ @model_serializer(mode="wrap")
1783
+ def serialize_model(self, handler):
1784
+ optional_fields = set(["type", "key", "id", "requires_approval"])
1785
+ serialized = handler(self)
1786
+ m = {}
1787
+
1788
+ for n, f in type(self).model_fields.items():
1789
+ k = f.alias or n
1790
+ val = serialized.get(k)
1791
+
1792
+ if val != UNSET_SENTINEL:
1793
+ if val is not None or k not in optional_fields:
1794
+ m[k] = val
1795
+
1796
+ return m
1797
+
1798
+
1799
+ UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools15Type = Literal[
1800
+ "json_schema",
1801
+ ]
1802
+ r"""JSON Schema tool type"""
1803
+
1804
+
1805
+ class AgentToolInputCRUDJSONSchemaToolTypedDict(TypedDict):
1806
+ r"""Enforces structured output format using JSON Schema. Must reference a pre-created JSON Schema tool by key or id."""
1807
+
1808
+ type: NotRequired[
1809
+ UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools15Type
1810
+ ]
1811
+ r"""JSON Schema tool type"""
1812
+ key: NotRequired[str]
1813
+ r"""The key of the pre-created JSON Schema tool"""
1814
+ id: NotRequired[str]
1815
+ r"""The ID of the pre-created JSON Schema tool"""
1816
+ requires_approval: NotRequired[bool]
1817
+ r"""Whether this tool requires approval before execution"""
1818
+
1819
+
1820
+ class AgentToolInputCRUDJSONSchemaTool(BaseModel):
1821
+ r"""Enforces structured output format using JSON Schema. Must reference a pre-created JSON Schema tool by key or id."""
1822
+
1823
+ type: Optional[
1824
+ UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools15Type
1825
+ ] = "json_schema"
1826
+ r"""JSON Schema tool type"""
1827
+
1828
+ key: Optional[str] = None
1829
+ r"""The key of the pre-created JSON Schema tool"""
1830
+
1831
+ id: Optional[str] = None
1832
+ r"""The ID of the pre-created JSON Schema tool"""
1833
+
1834
+ requires_approval: Optional[bool] = False
1835
+ r"""Whether this tool requires approval before execution"""
1836
+
1837
+ @model_serializer(mode="wrap")
1838
+ def serialize_model(self, handler):
1839
+ optional_fields = set(["type", "key", "id", "requires_approval"])
1840
+ serialized = handler(self)
1841
+ m = {}
1842
+
1843
+ for n, f in type(self).model_fields.items():
1844
+ k = f.alias or n
1845
+ val = serialized.get(k)
1846
+
1847
+ if val != UNSET_SENTINEL:
1848
+ if val is not None or k not in optional_fields:
1849
+ m[k] = val
1850
+
1851
+ return m
1852
+
1250
1853
 
1251
1854
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools14Type = Literal[
1252
1855
  "function",
@@ -1286,6 +1889,22 @@ class AgentToolInputCRUDFunctionTool(BaseModel):
1286
1889
  requires_approval: Optional[bool] = False
1287
1890
  r"""Whether this tool requires approval before execution"""
1288
1891
 
1892
+ @model_serializer(mode="wrap")
1893
+ def serialize_model(self, handler):
1894
+ optional_fields = set(["type", "key", "id", "requires_approval"])
1895
+ serialized = handler(self)
1896
+ m = {}
1897
+
1898
+ for n, f in type(self).model_fields.items():
1899
+ k = f.alias or n
1900
+ val = serialized.get(k)
1901
+
1902
+ if val != UNSET_SENTINEL:
1903
+ if val is not None or k not in optional_fields:
1904
+ m[k] = val
1905
+
1906
+ return m
1907
+
1289
1908
 
1290
1909
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools13Type = Literal[
1291
1910
  "code",
@@ -1325,6 +1944,22 @@ class AgentToolInputCRUDCodeExecutionTool(BaseModel):
1325
1944
  requires_approval: Optional[bool] = False
1326
1945
  r"""Whether this tool requires approval before execution"""
1327
1946
 
1947
+ @model_serializer(mode="wrap")
1948
+ def serialize_model(self, handler):
1949
+ optional_fields = set(["type", "key", "id", "requires_approval"])
1950
+ serialized = handler(self)
1951
+ m = {}
1952
+
1953
+ for n, f in type(self).model_fields.items():
1954
+ k = f.alias or n
1955
+ val = serialized.get(k)
1956
+
1957
+ if val != UNSET_SENTINEL:
1958
+ if val is not None or k not in optional_fields:
1959
+ m[k] = val
1960
+
1961
+ return m
1962
+
1328
1963
 
1329
1964
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools12Type = Literal[
1330
1965
  "http",
@@ -1364,6 +1999,22 @@ class AgentToolInputCRUDHTTPTool(BaseModel):
1364
1999
  requires_approval: Optional[bool] = False
1365
2000
  r"""Whether this tool requires approval before execution"""
1366
2001
 
2002
+ @model_serializer(mode="wrap")
2003
+ def serialize_model(self, handler):
2004
+ optional_fields = set(["type", "key", "id", "requires_approval"])
2005
+ serialized = handler(self)
2006
+ m = {}
2007
+
2008
+ for n, f in type(self).model_fields.items():
2009
+ k = f.alias or n
2010
+ val = serialized.get(k)
2011
+
2012
+ if val != UNSET_SENTINEL:
2013
+ if val is not None or k not in optional_fields:
2014
+ m[k] = val
2015
+
2016
+ return m
2017
+
1367
2018
 
1368
2019
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools11Type = Literal[
1369
2020
  "current_date",
@@ -1386,6 +2037,22 @@ class AgentToolInputCRUDCurrentDateTool(BaseModel):
1386
2037
  requires_approval: Optional[bool] = None
1387
2038
  r"""Whether this tool requires approval before execution"""
1388
2039
 
2040
+ @model_serializer(mode="wrap")
2041
+ def serialize_model(self, handler):
2042
+ optional_fields = set(["requires_approval"])
2043
+ serialized = handler(self)
2044
+ m = {}
2045
+
2046
+ for n, f in type(self).model_fields.items():
2047
+ k = f.alias or n
2048
+ val = serialized.get(k)
2049
+
2050
+ if val != UNSET_SENTINEL:
2051
+ if val is not None or k not in optional_fields:
2052
+ m[k] = val
2053
+
2054
+ return m
2055
+
1389
2056
 
1390
2057
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools10Type = Literal[
1391
2058
  "query_knowledge_base",
@@ -1408,6 +2075,22 @@ class AgentToolInputCRUDQueryKnowledgeBaseTool(BaseModel):
1408
2075
  requires_approval: Optional[bool] = None
1409
2076
  r"""Whether this tool requires approval before execution"""
1410
2077
 
2078
+ @model_serializer(mode="wrap")
2079
+ def serialize_model(self, handler):
2080
+ optional_fields = set(["requires_approval"])
2081
+ serialized = handler(self)
2082
+ m = {}
2083
+
2084
+ for n, f in type(self).model_fields.items():
2085
+ k = f.alias or n
2086
+ val = serialized.get(k)
2087
+
2088
+ if val != UNSET_SENTINEL:
2089
+ if val is not None or k not in optional_fields:
2090
+ m[k] = val
2091
+
2092
+ return m
2093
+
1411
2094
 
1412
2095
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools9Type = Literal[
1413
2096
  "retrieve_knowledge_bases",
@@ -1430,6 +2113,22 @@ class AgentToolInputCRUDRetrieveKnowledgeBasesTool(BaseModel):
1430
2113
  requires_approval: Optional[bool] = None
1431
2114
  r"""Whether this tool requires approval before execution"""
1432
2115
 
2116
+ @model_serializer(mode="wrap")
2117
+ def serialize_model(self, handler):
2118
+ optional_fields = set(["requires_approval"])
2119
+ serialized = handler(self)
2120
+ m = {}
2121
+
2122
+ for n, f in type(self).model_fields.items():
2123
+ k = f.alias or n
2124
+ val = serialized.get(k)
2125
+
2126
+ if val != UNSET_SENTINEL:
2127
+ if val is not None or k not in optional_fields:
2128
+ m[k] = val
2129
+
2130
+ return m
2131
+
1433
2132
 
1434
2133
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools8Type = Literal[
1435
2134
  "delete_memory_document",
@@ -1452,6 +2151,22 @@ class AgentToolInputCRUDDeleteMemoryDocumentTool(BaseModel):
1452
2151
  requires_approval: Optional[bool] = None
1453
2152
  r"""Whether this tool requires approval before execution"""
1454
2153
 
2154
+ @model_serializer(mode="wrap")
2155
+ def serialize_model(self, handler):
2156
+ optional_fields = set(["requires_approval"])
2157
+ serialized = handler(self)
2158
+ m = {}
2159
+
2160
+ for n, f in type(self).model_fields.items():
2161
+ k = f.alias or n
2162
+ val = serialized.get(k)
2163
+
2164
+ if val != UNSET_SENTINEL:
2165
+ if val is not None or k not in optional_fields:
2166
+ m[k] = val
2167
+
2168
+ return m
2169
+
1455
2170
 
1456
2171
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsTools7Type = Literal[
1457
2172
  "retrieve_memory_stores",
@@ -1474,6 +2189,22 @@ class AgentToolInputCRUDRetrieveMemoryStoresTool(BaseModel):
1474
2189
  requires_approval: Optional[bool] = None
1475
2190
  r"""Whether this tool requires approval before execution"""
1476
2191
 
2192
+ @model_serializer(mode="wrap")
2193
+ def serialize_model(self, handler):
2194
+ optional_fields = set(["requires_approval"])
2195
+ serialized = handler(self)
2196
+ m = {}
2197
+
2198
+ for n, f in type(self).model_fields.items():
2199
+ k = f.alias or n
2200
+ val = serialized.get(k)
2201
+
2202
+ if val != UNSET_SENTINEL:
2203
+ if val is not None or k not in optional_fields:
2204
+ m[k] = val
2205
+
2206
+ return m
2207
+
1477
2208
 
1478
2209
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsToolsType = Literal[
1479
2210
  "write_memory_store",
@@ -1496,6 +2227,22 @@ class AgentToolInputCRUDWriteMemoryStoreTool(BaseModel):
1496
2227
  requires_approval: Optional[bool] = None
1497
2228
  r"""Whether this tool requires approval before execution"""
1498
2229
 
2230
+ @model_serializer(mode="wrap")
2231
+ def serialize_model(self, handler):
2232
+ optional_fields = set(["requires_approval"])
2233
+ serialized = handler(self)
2234
+ m = {}
2235
+
2236
+ for n, f in type(self).model_fields.items():
2237
+ k = f.alias or n
2238
+ val = serialized.get(k)
2239
+
2240
+ if val != UNSET_SENTINEL:
2241
+ if val is not None or k not in optional_fields:
2242
+ m[k] = val
2243
+
2244
+ return m
2245
+
1499
2246
 
1500
2247
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodySettingsType = Literal[
1501
2248
  "query_memory_store",
@@ -1518,6 +2265,22 @@ class AgentToolInputCRUDQueryMemoryStoreTool(BaseModel):
1518
2265
  requires_approval: Optional[bool] = None
1519
2266
  r"""Whether this tool requires approval before execution"""
1520
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
+
1521
2284
 
1522
2285
  UpdateAgentAgentToolInputCRUDAgentsRequestRequestBodyType = Literal["retrieve_agents",]
1523
2286
 
@@ -1538,6 +2301,22 @@ class AgentToolInputCRUDRetrieveAgentsTool(BaseModel):
1538
2301
  requires_approval: Optional[bool] = None
1539
2302
  r"""Whether this tool requires approval before execution"""
1540
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
+
1541
2320
 
1542
2321
  UpdateAgentAgentToolInputCRUDAgentsRequestType = Literal["call_sub_agent",]
1543
2322
 
@@ -1558,6 +2337,22 @@ class AgentToolInputCRUDCallSubAgentTool(BaseModel):
1558
2337
  requires_approval: Optional[bool] = None
1559
2338
  r"""Whether this tool requires approval before execution"""
1560
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
+
1561
2356
 
1562
2357
  UpdateAgentAgentToolInputCRUDAgentsType = Literal["web_scraper",]
1563
2358
 
@@ -1578,6 +2373,22 @@ class AgentToolInputCRUDWebScraperTool(BaseModel):
1578
2373
  requires_approval: Optional[bool] = None
1579
2374
  r"""Whether this tool requires approval before execution"""
1580
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
+
1581
2392
 
1582
2393
  UpdateAgentAgentToolInputCRUDType = Literal["google_search",]
1583
2394
 
@@ -1593,10 +2404,26 @@ class AgentToolInputCRUDGoogleSearchToolTypedDict(TypedDict):
1593
2404
  class AgentToolInputCRUDGoogleSearchTool(BaseModel):
1594
2405
  r"""Performs Google searches to retrieve web content"""
1595
2406
 
1596
- type: UpdateAgentAgentToolInputCRUDType
2407
+ type: UpdateAgentAgentToolInputCRUDType
2408
+
2409
+ requires_approval: Optional[bool] = None
2410
+ r"""Whether this tool requires approval before execution"""
2411
+
2412
+ @model_serializer(mode="wrap")
2413
+ def serialize_model(self, handler):
2414
+ optional_fields = set(["requires_approval"])
2415
+ serialized = handler(self)
2416
+ m = {}
2417
+
2418
+ for n, f in type(self).model_fields.items():
2419
+ k = f.alias or n
2420
+ val = serialized.get(k)
2421
+
2422
+ if val != UNSET_SENTINEL:
2423
+ if val is not None or k not in optional_fields:
2424
+ m[k] = val
1597
2425
 
1598
- requires_approval: Optional[bool] = None
1599
- r"""Whether this tool requires approval before execution"""
2426
+ return m
1600
2427
 
1601
2428
 
1602
2429
  UpdateAgentAgentToolInputCRUDTypedDict = TypeAliasType(
@@ -1616,10 +2443,11 @@ UpdateAgentAgentToolInputCRUDTypedDict = TypeAliasType(
1616
2443
  AgentToolInputCRUDHTTPToolTypedDict,
1617
2444
  AgentToolInputCRUDCodeExecutionToolTypedDict,
1618
2445
  AgentToolInputCRUDFunctionToolTypedDict,
2446
+ AgentToolInputCRUDJSONSchemaToolTypedDict,
1619
2447
  AgentToolInputCRUDMCPToolTypedDict,
1620
2448
  ],
1621
2449
  )
1622
- 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."""
2450
+ 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."""
1623
2451
 
1624
2452
 
1625
2453
  UpdateAgentAgentToolInputCRUD = TypeAliasType(
@@ -1639,10 +2467,11 @@ UpdateAgentAgentToolInputCRUD = TypeAliasType(
1639
2467
  AgentToolInputCRUDHTTPTool,
1640
2468
  AgentToolInputCRUDCodeExecutionTool,
1641
2469
  AgentToolInputCRUDFunctionTool,
2470
+ AgentToolInputCRUDJSONSchemaTool,
1642
2471
  AgentToolInputCRUDMCPTool,
1643
2472
  ],
1644
2473
  )
1645
- 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."""
2474
+ 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."""
1646
2475
 
1647
2476
 
1648
2477
  UpdateAgentExecuteOn = Literal[
@@ -1671,6 +2500,22 @@ class UpdateAgentEvaluators(BaseModel):
1671
2500
  sample_rate: Optional[float] = 50
1672
2501
  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."""
1673
2502
 
2503
+ @model_serializer(mode="wrap")
2504
+ def serialize_model(self, handler):
2505
+ optional_fields = set(["sample_rate"])
2506
+ serialized = handler(self)
2507
+ m = {}
2508
+
2509
+ for n, f in type(self).model_fields.items():
2510
+ k = f.alias or n
2511
+ val = serialized.get(k)
2512
+
2513
+ if val != UNSET_SENTINEL:
2514
+ if val is not None or k not in optional_fields:
2515
+ m[k] = val
2516
+
2517
+ return m
2518
+
1674
2519
 
1675
2520
  UpdateAgentAgentsExecuteOn = Literal[
1676
2521
  "input",
@@ -1698,6 +2543,22 @@ class UpdateAgentGuardrails(BaseModel):
1698
2543
  sample_rate: Optional[float] = 50
1699
2544
  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."""
1700
2545
 
2546
+ @model_serializer(mode="wrap")
2547
+ def serialize_model(self, handler):
2548
+ optional_fields = set(["sample_rate"])
2549
+ serialized = handler(self)
2550
+ m = {}
2551
+
2552
+ for n, f in type(self).model_fields.items():
2553
+ k = f.alias or n
2554
+ val = serialized.get(k)
2555
+
2556
+ if val != UNSET_SENTINEL:
2557
+ if val is not None or k not in optional_fields:
2558
+ m[k] = val
2559
+
2560
+ return m
2561
+
1701
2562
 
1702
2563
  class UpdateAgentSettingsTypedDict(TypedDict):
1703
2564
  max_iterations: NotRequired[int]
@@ -1733,6 +2594,31 @@ class UpdateAgentSettings(BaseModel):
1733
2594
  guardrails: Optional[List[UpdateAgentGuardrails]] = None
1734
2595
  r"""Configuration for a guardrail applied to the agent"""
1735
2596
 
2597
+ @model_serializer(mode="wrap")
2598
+ def serialize_model(self, handler):
2599
+ optional_fields = set(
2600
+ [
2601
+ "max_iterations",
2602
+ "max_execution_time",
2603
+ "tool_approval_required",
2604
+ "tools",
2605
+ "evaluators",
2606
+ "guardrails",
2607
+ ]
2608
+ )
2609
+ serialized = handler(self)
2610
+ m = {}
2611
+
2612
+ for n, f in type(self).model_fields.items():
2613
+ k = f.alias or n
2614
+ val = serialized.get(k)
2615
+
2616
+ if val != UNSET_SENTINEL:
2617
+ if val is not None or k not in optional_fields:
2618
+ m[k] = val
2619
+
2620
+ return m
2621
+
1736
2622
 
1737
2623
  class UpdateAgentKnowledgeBasesTypedDict(TypedDict):
1738
2624
  knowledge_id: str
@@ -1758,6 +2644,22 @@ class UpdateAgentTeamOfAgents(BaseModel):
1758
2644
  role: Optional[str] = None
1759
2645
  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."""
1760
2646
 
2647
+ @model_serializer(mode="wrap")
2648
+ def serialize_model(self, handler):
2649
+ optional_fields = set(["role"])
2650
+ serialized = handler(self)
2651
+ m = {}
2652
+
2653
+ for n, f in type(self).model_fields.items():
2654
+ k = f.alias or n
2655
+ val = serialized.get(k)
2656
+
2657
+ if val != UNSET_SENTINEL:
2658
+ if val is not None or k not in optional_fields:
2659
+ m[k] = val
2660
+
2661
+ return m
2662
+
1761
2663
 
1762
2664
  class UpdateAgentUpdateAgentRequestTypedDict(TypedDict):
1763
2665
  r"""Request body for updating an existing agent via the API. Uses simplified tool input format."""
@@ -1838,6 +2740,40 @@ class UpdateAgentUpdateAgentRequest(BaseModel):
1838
2740
  variables: Optional[Dict[str, Any]] = None
1839
2741
  r"""Extracted variables from agent instructions"""
1840
2742
 
2743
+ @model_serializer(mode="wrap")
2744
+ def serialize_model(self, handler):
2745
+ optional_fields = set(
2746
+ [
2747
+ "key",
2748
+ "display_name",
2749
+ "project_id",
2750
+ "role",
2751
+ "description",
2752
+ "instructions",
2753
+ "system_prompt",
2754
+ "model",
2755
+ "fallback_models",
2756
+ "settings",
2757
+ "path",
2758
+ "memory_stores",
2759
+ "knowledge_bases",
2760
+ "team_of_agents",
2761
+ "variables",
2762
+ ]
2763
+ )
2764
+ serialized = handler(self)
2765
+ m = {}
2766
+
2767
+ for n, f in type(self).model_fields.items():
2768
+ k = f.alias or n
2769
+ val = serialized.get(k)
2770
+
2771
+ if val != UNSET_SENTINEL:
2772
+ if val is not None or k not in optional_fields:
2773
+ m[k] = val
2774
+
2775
+ return m
2776
+
1841
2777
 
1842
2778
  class UpdateAgentRequestTypedDict(TypedDict):
1843
2779
  agent_key: str
@@ -1957,6 +2893,32 @@ class UpdateAgentTools(BaseModel):
1957
2893
  timeout: Optional[float] = 120
1958
2894
  r"""Tool execution timeout in seconds (default: 2 minutes, max: 10 minutes)"""
1959
2895
 
2896
+ @model_serializer(mode="wrap")
2897
+ def serialize_model(self, handler):
2898
+ optional_fields = set(
2899
+ [
2900
+ "key",
2901
+ "display_name",
2902
+ "description",
2903
+ "requires_approval",
2904
+ "tool_id",
2905
+ "conditions",
2906
+ "timeout",
2907
+ ]
2908
+ )
2909
+ serialized = handler(self)
2910
+ m = {}
2911
+
2912
+ for n, f in type(self).model_fields.items():
2913
+ k = f.alias or n
2914
+ val = serialized.get(k)
2915
+
2916
+ if val != UNSET_SENTINEL:
2917
+ if val is not None or k not in optional_fields:
2918
+ m[k] = val
2919
+
2920
+ return m
2921
+
1960
2922
 
1961
2923
  UpdateAgentAgentsResponseExecuteOn = Literal[
1962
2924
  "input",
@@ -1984,6 +2946,22 @@ class UpdateAgentAgentsEvaluators(BaseModel):
1984
2946
  sample_rate: Optional[float] = 50
1985
2947
  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."""
1986
2948
 
2949
+ @model_serializer(mode="wrap")
2950
+ def serialize_model(self, handler):
2951
+ optional_fields = set(["sample_rate"])
2952
+ serialized = handler(self)
2953
+ m = {}
2954
+
2955
+ for n, f in type(self).model_fields.items():
2956
+ k = f.alias or n
2957
+ val = serialized.get(k)
2958
+
2959
+ if val != UNSET_SENTINEL:
2960
+ if val is not None or k not in optional_fields:
2961
+ m[k] = val
2962
+
2963
+ return m
2964
+
1987
2965
 
1988
2966
  UpdateAgentAgentsResponse200ExecuteOn = Literal[
1989
2967
  "input",
@@ -2011,6 +2989,22 @@ class UpdateAgentAgentsGuardrails(BaseModel):
2011
2989
  sample_rate: Optional[float] = 50
2012
2990
  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."""
2013
2991
 
2992
+ @model_serializer(mode="wrap")
2993
+ def serialize_model(self, handler):
2994
+ optional_fields = set(["sample_rate"])
2995
+ serialized = handler(self)
2996
+ m = {}
2997
+
2998
+ for n, f in type(self).model_fields.items():
2999
+ k = f.alias or n
3000
+ val = serialized.get(k)
3001
+
3002
+ if val != UNSET_SENTINEL:
3003
+ if val is not None or k not in optional_fields:
3004
+ m[k] = val
3005
+
3006
+ return m
3007
+
2014
3008
 
2015
3009
  class UpdateAgentAgentsSettingsTypedDict(TypedDict):
2016
3010
  max_iterations: NotRequired[int]
@@ -2046,6 +3040,31 @@ class UpdateAgentAgentsSettings(BaseModel):
2046
3040
  guardrails: Optional[List[UpdateAgentAgentsGuardrails]] = None
2047
3041
  r"""Configuration for a guardrail applied to the agent"""
2048
3042
 
3043
+ @model_serializer(mode="wrap")
3044
+ def serialize_model(self, handler):
3045
+ optional_fields = set(
3046
+ [
3047
+ "max_iterations",
3048
+ "max_execution_time",
3049
+ "tool_approval_required",
3050
+ "tools",
3051
+ "evaluators",
3052
+ "guardrails",
3053
+ ]
3054
+ )
3055
+ serialized = handler(self)
3056
+ m = {}
3057
+
3058
+ for n, f in type(self).model_fields.items():
3059
+ k = f.alias or n
3060
+ val = serialized.get(k)
3061
+
3062
+ if val != UNSET_SENTINEL:
3063
+ if val is not None or k not in optional_fields:
3064
+ m[k] = val
3065
+
3066
+ return m
3067
+
2049
3068
 
2050
3069
  UpdateAgentVoice = Literal[
2051
3070
  "alloy",
@@ -2114,6 +3133,22 @@ class UpdateAgentResponseFormatAgentsResponseJSONSchema(BaseModel):
2114
3133
  strict: Optional[bool] = False
2115
3134
  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."""
2116
3135
 
3136
+ @model_serializer(mode="wrap")
3137
+ def serialize_model(self, handler):
3138
+ optional_fields = set(["description", "schema", "strict"])
3139
+ serialized = handler(self)
3140
+ m = {}
3141
+
3142
+ for n, f in type(self).model_fields.items():
3143
+ k = f.alias or n
3144
+ val = serialized.get(k)
3145
+
3146
+ if val != UNSET_SENTINEL:
3147
+ if val is not None or k not in optional_fields:
3148
+ m[k] = val
3149
+
3150
+ return m
3151
+
2117
3152
 
2118
3153
  class UpdateAgentResponseFormatAgentsResponse200JSONSchemaTypedDict(TypedDict):
2119
3154
  r"""
@@ -2246,6 +3281,22 @@ class UpdateAgentStreamOptions(BaseModel):
2246
3281
  include_usage: Optional[bool] = None
2247
3282
  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."""
2248
3283
 
3284
+ @model_serializer(mode="wrap")
3285
+ def serialize_model(self, handler):
3286
+ optional_fields = set(["include_usage"])
3287
+ serialized = handler(self)
3288
+ m = {}
3289
+
3290
+ for n, f in type(self).model_fields.items():
3291
+ k = f.alias or n
3292
+ val = serialized.get(k)
3293
+
3294
+ if val != UNSET_SENTINEL:
3295
+ if val is not None or k not in optional_fields:
3296
+ m[k] = val
3297
+
3298
+ return m
3299
+
2249
3300
 
2250
3301
  UpdateAgentThinkingTypedDict = TypeAliasType(
2251
3302
  "UpdateAgentThinkingTypedDict",
@@ -2288,6 +3339,22 @@ class UpdateAgentToolChoiceAgentsResponse2(BaseModel):
2288
3339
  type: Optional[UpdateAgentToolChoiceAgentsResponseType] = None
2289
3340
  r"""The type of the tool. Currently, only function is supported."""
2290
3341
 
3342
+ @model_serializer(mode="wrap")
3343
+ def serialize_model(self, handler):
3344
+ optional_fields = set(["type"])
3345
+ serialized = handler(self)
3346
+ m = {}
3347
+
3348
+ for n, f in type(self).model_fields.items():
3349
+ k = f.alias or n
3350
+ val = serialized.get(k)
3351
+
3352
+ if val != UNSET_SENTINEL:
3353
+ if val is not None or k not in optional_fields:
3354
+ m[k] = val
3355
+
3356
+ return m
3357
+
2291
3358
 
2292
3359
  UpdateAgentToolChoiceAgentsResponse1 = Literal[
2293
3360
  "none",
@@ -2313,51 +3380,201 @@ UpdateAgentToolChoice = TypeAliasType(
2313
3380
  r"""Controls which (if any) tool is called by the model."""
2314
3381
 
2315
3382
 
2316
- UpdateAgentModalities = Literal[
2317
- "text",
2318
- "audio",
2319
- ]
3383
+ UpdateAgentModalities = Literal[
3384
+ "text",
3385
+ "audio",
3386
+ ]
3387
+
3388
+
3389
+ UpdateAgentIDAgentsResponse1 = Literal[
3390
+ "orq_pii_detection",
3391
+ "orq_sexual_moderation",
3392
+ "orq_harmful_moderation",
3393
+ ]
3394
+ r"""The key of the guardrail."""
3395
+
3396
+
3397
+ UpdateAgentIDTypedDict = TypeAliasType(
3398
+ "UpdateAgentIDTypedDict", Union[UpdateAgentIDAgentsResponse1, str]
3399
+ )
3400
+
3401
+
3402
+ UpdateAgentID = TypeAliasType("UpdateAgentID", Union[UpdateAgentIDAgentsResponse1, str])
3403
+
3404
+
3405
+ UpdateAgentAgentsResponse200ApplicationJSONExecuteOn = Literal[
3406
+ "input",
3407
+ "output",
3408
+ ]
3409
+ r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
3410
+
3411
+
3412
+ class UpdateAgentAgentsResponseGuardrailsTypedDict(TypedDict):
3413
+ id: UpdateAgentIDTypedDict
3414
+ execute_on: UpdateAgentAgentsResponse200ApplicationJSONExecuteOn
3415
+ r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
3416
+
3417
+
3418
+ class UpdateAgentAgentsResponseGuardrails(BaseModel):
3419
+ id: UpdateAgentID
3420
+
3421
+ execute_on: UpdateAgentAgentsResponse200ApplicationJSONExecuteOn
3422
+ r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
3423
+
3424
+
3425
+ class UpdateAgentFallbacksTypedDict(TypedDict):
3426
+ model: str
3427
+ r"""Fallback model identifier"""
3428
+
3429
+
3430
+ class UpdateAgentFallbacks(BaseModel):
3431
+ model: str
3432
+ r"""Fallback model identifier"""
3433
+
3434
+
3435
+ class UpdateAgentAgentsRetryTypedDict(TypedDict):
3436
+ r"""Retry configuration for the request"""
3437
+
3438
+ count: NotRequired[float]
3439
+ r"""Number of retry attempts (1-5)"""
3440
+ on_codes: NotRequired[List[float]]
3441
+ r"""HTTP status codes that trigger retry logic"""
3442
+
3443
+
3444
+ class UpdateAgentAgentsRetry(BaseModel):
3445
+ r"""Retry configuration for the request"""
3446
+
3447
+ count: Optional[float] = 3
3448
+ r"""Number of retry attempts (1-5)"""
3449
+
3450
+ on_codes: Optional[List[float]] = None
3451
+ r"""HTTP status codes that trigger retry logic"""
3452
+
3453
+ @model_serializer(mode="wrap")
3454
+ def serialize_model(self, handler):
3455
+ optional_fields = set(["count", "on_codes"])
3456
+ serialized = handler(self)
3457
+ m = {}
3458
+
3459
+ for n, f in type(self).model_fields.items():
3460
+ k = f.alias or n
3461
+ val = serialized.get(k)
3462
+
3463
+ if val != UNSET_SENTINEL:
3464
+ if val is not None or k not in optional_fields:
3465
+ m[k] = val
3466
+
3467
+ return m
3468
+
3469
+
3470
+ UpdateAgentType = Literal["exact_match",]
3471
+
3472
+
3473
+ class UpdateAgentCacheTypedDict(TypedDict):
3474
+ r"""Cache configuration for the request."""
3475
+
3476
+ type: UpdateAgentType
3477
+ ttl: NotRequired[float]
3478
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
3479
+
3480
+
3481
+ class UpdateAgentCache(BaseModel):
3482
+ r"""Cache configuration for the request."""
3483
+
3484
+ type: UpdateAgentType
3485
+
3486
+ ttl: Optional[float] = 1800
3487
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
3488
+
3489
+ @model_serializer(mode="wrap")
3490
+ def serialize_model(self, handler):
3491
+ optional_fields = set(["ttl"])
3492
+ serialized = handler(self)
3493
+ m = {}
3494
+
3495
+ for n, f in type(self).model_fields.items():
3496
+ k = f.alias or n
3497
+ val = serialized.get(k)
3498
+
3499
+ if val != UNSET_SENTINEL:
3500
+ if val is not None or k not in optional_fields:
3501
+ m[k] = val
3502
+
3503
+ return m
3504
+
3505
+
3506
+ UpdateAgentLoadBalancerAgentsResponseType = Literal["weight_based",]
3507
+
3508
+
3509
+ class UpdateAgentLoadBalancerAgentsResponseModelsTypedDict(TypedDict):
3510
+ model: str
3511
+ r"""Model identifier for load balancing"""
3512
+ weight: NotRequired[float]
3513
+ r"""Weight assigned to this model for load balancing"""
3514
+
3515
+
3516
+ class UpdateAgentLoadBalancerAgentsResponseModels(BaseModel):
3517
+ model: str
3518
+ r"""Model identifier for load balancing"""
3519
+
3520
+ weight: Optional[float] = 0.5
3521
+ r"""Weight assigned to this model for load balancing"""
3522
+
3523
+ @model_serializer(mode="wrap")
3524
+ def serialize_model(self, handler):
3525
+ optional_fields = set(["weight"])
3526
+ serialized = handler(self)
3527
+ m = {}
3528
+
3529
+ for n, f in type(self).model_fields.items():
3530
+ k = f.alias or n
3531
+ val = serialized.get(k)
3532
+
3533
+ if val != UNSET_SENTINEL:
3534
+ if val is not None or k not in optional_fields:
3535
+ m[k] = val
3536
+
3537
+ return m
2320
3538
 
2321
3539
 
2322
- UpdateAgentIDAgentsResponse1 = Literal[
2323
- "orq_pii_detection",
2324
- "orq_sexual_moderation",
2325
- "orq_harmful_moderation",
2326
- ]
2327
- r"""The key of the guardrail."""
3540
+ class UpdateAgentLoadBalancerAgentsResponse1TypedDict(TypedDict):
3541
+ type: UpdateAgentLoadBalancerAgentsResponseType
3542
+ models: List[UpdateAgentLoadBalancerAgentsResponseModelsTypedDict]
2328
3543
 
2329
3544
 
2330
- UpdateAgentIDTypedDict = TypeAliasType(
2331
- "UpdateAgentIDTypedDict", Union[UpdateAgentIDAgentsResponse1, str]
2332
- )
3545
+ class UpdateAgentLoadBalancerAgentsResponse1(BaseModel):
3546
+ type: UpdateAgentLoadBalancerAgentsResponseType
2333
3547
 
3548
+ models: List[UpdateAgentLoadBalancerAgentsResponseModels]
2334
3549
 
2335
- UpdateAgentID = TypeAliasType("UpdateAgentID", Union[UpdateAgentIDAgentsResponse1, str])
2336
3550
 
3551
+ UpdateAgentLoadBalancerTypedDict = UpdateAgentLoadBalancerAgentsResponse1TypedDict
3552
+ r"""Load balancer configuration for the request."""
2337
3553
 
2338
- UpdateAgentAgentsResponse200ApplicationJSONExecuteOn = Literal[
2339
- "input",
2340
- "output",
2341
- ]
2342
- r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
2343
3554
 
3555
+ UpdateAgentLoadBalancer = UpdateAgentLoadBalancerAgentsResponse1
3556
+ r"""Load balancer configuration for the request."""
2344
3557
 
2345
- class UpdateAgentAgentsResponseGuardrailsTypedDict(TypedDict):
2346
- id: UpdateAgentIDTypedDict
2347
- execute_on: UpdateAgentAgentsResponse200ApplicationJSONExecuteOn
2348
- r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
2349
3558
 
3559
+ class UpdateAgentTimeoutTypedDict(TypedDict):
3560
+ 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."""
2350
3561
 
2351
- class UpdateAgentAgentsResponseGuardrails(BaseModel):
2352
- id: UpdateAgentID
3562
+ call_timeout: float
3563
+ r"""Timeout value in milliseconds"""
2353
3564
 
2354
- execute_on: UpdateAgentAgentsResponse200ApplicationJSONExecuteOn
2355
- r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
3565
+
3566
+ class UpdateAgentTimeout(BaseModel):
3567
+ 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."""
3568
+
3569
+ call_timeout: float
3570
+ r"""Timeout value in milliseconds"""
2356
3571
 
2357
3572
 
2358
3573
  class UpdateAgentParametersTypedDict(TypedDict):
2359
3574
  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."""
2360
3575
 
3576
+ name: NotRequired[str]
3577
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
2361
3578
  audio: NotRequired[Nullable[UpdateAgentAudioTypedDict]]
2362
3579
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
2363
3580
  frequency_penalty: NotRequired[Nullable[float]]
@@ -2412,11 +3629,24 @@ class UpdateAgentParametersTypedDict(TypedDict):
2412
3629
  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\"]."""
2413
3630
  guardrails: NotRequired[List[UpdateAgentAgentsResponseGuardrailsTypedDict]]
2414
3631
  r"""A list of guardrails to apply to the request."""
3632
+ fallbacks: NotRequired[List[UpdateAgentFallbacksTypedDict]]
3633
+ r"""Array of fallback models to use if primary model fails"""
3634
+ retry: NotRequired[UpdateAgentAgentsRetryTypedDict]
3635
+ r"""Retry configuration for the request"""
3636
+ cache: NotRequired[UpdateAgentCacheTypedDict]
3637
+ r"""Cache configuration for the request."""
3638
+ load_balancer: NotRequired[UpdateAgentLoadBalancerTypedDict]
3639
+ r"""Load balancer configuration for the request."""
3640
+ timeout: NotRequired[UpdateAgentTimeoutTypedDict]
3641
+ 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."""
2415
3642
 
2416
3643
 
2417
3644
  class UpdateAgentParameters(BaseModel):
2418
3645
  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."""
2419
3646
 
3647
+ name: Optional[str] = None
3648
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
3649
+
2420
3650
  audio: OptionalNullable[UpdateAgentAudio] = UNSET
2421
3651
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
2422
3652
 
@@ -2493,72 +3723,92 @@ class UpdateAgentParameters(BaseModel):
2493
3723
  guardrails: Optional[List[UpdateAgentAgentsResponseGuardrails]] = None
2494
3724
  r"""A list of guardrails to apply to the request."""
2495
3725
 
3726
+ fallbacks: Optional[List[UpdateAgentFallbacks]] = None
3727
+ r"""Array of fallback models to use if primary model fails"""
3728
+
3729
+ retry: Optional[UpdateAgentAgentsRetry] = None
3730
+ r"""Retry configuration for the request"""
3731
+
3732
+ cache: Optional[UpdateAgentCache] = None
3733
+ r"""Cache configuration for the request."""
3734
+
3735
+ load_balancer: Optional[UpdateAgentLoadBalancer] = None
3736
+ r"""Load balancer configuration for the request."""
3737
+
3738
+ timeout: Optional[UpdateAgentTimeout] = None
3739
+ 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."""
3740
+
2496
3741
  @model_serializer(mode="wrap")
2497
3742
  def serialize_model(self, handler):
2498
- optional_fields = [
2499
- "audio",
2500
- "frequency_penalty",
2501
- "max_tokens",
2502
- "max_completion_tokens",
2503
- "logprobs",
2504
- "top_logprobs",
2505
- "n",
2506
- "presence_penalty",
2507
- "response_format",
2508
- "reasoning_effort",
2509
- "verbosity",
2510
- "seed",
2511
- "stop",
2512
- "stream_options",
2513
- "thinking",
2514
- "temperature",
2515
- "top_p",
2516
- "top_k",
2517
- "tool_choice",
2518
- "parallel_tool_calls",
2519
- "modalities",
2520
- "guardrails",
2521
- ]
2522
- nullable_fields = [
2523
- "audio",
2524
- "frequency_penalty",
2525
- "max_tokens",
2526
- "max_completion_tokens",
2527
- "logprobs",
2528
- "top_logprobs",
2529
- "n",
2530
- "presence_penalty",
2531
- "seed",
2532
- "stop",
2533
- "stream_options",
2534
- "temperature",
2535
- "top_p",
2536
- "top_k",
2537
- "modalities",
2538
- ]
2539
- null_default_fields = []
2540
-
3743
+ optional_fields = set(
3744
+ [
3745
+ "name",
3746
+ "audio",
3747
+ "frequency_penalty",
3748
+ "max_tokens",
3749
+ "max_completion_tokens",
3750
+ "logprobs",
3751
+ "top_logprobs",
3752
+ "n",
3753
+ "presence_penalty",
3754
+ "response_format",
3755
+ "reasoning_effort",
3756
+ "verbosity",
3757
+ "seed",
3758
+ "stop",
3759
+ "stream_options",
3760
+ "thinking",
3761
+ "temperature",
3762
+ "top_p",
3763
+ "top_k",
3764
+ "tool_choice",
3765
+ "parallel_tool_calls",
3766
+ "modalities",
3767
+ "guardrails",
3768
+ "fallbacks",
3769
+ "retry",
3770
+ "cache",
3771
+ "load_balancer",
3772
+ "timeout",
3773
+ ]
3774
+ )
3775
+ nullable_fields = set(
3776
+ [
3777
+ "audio",
3778
+ "frequency_penalty",
3779
+ "max_tokens",
3780
+ "max_completion_tokens",
3781
+ "logprobs",
3782
+ "top_logprobs",
3783
+ "n",
3784
+ "presence_penalty",
3785
+ "seed",
3786
+ "stop",
3787
+ "stream_options",
3788
+ "temperature",
3789
+ "top_p",
3790
+ "top_k",
3791
+ "modalities",
3792
+ ]
3793
+ )
2541
3794
  serialized = handler(self)
2542
-
2543
3795
  m = {}
2544
3796
 
2545
3797
  for n, f in type(self).model_fields.items():
2546
3798
  k = f.alias or n
2547
3799
  val = serialized.get(k)
2548
- serialized.pop(k, None)
2549
-
2550
- optional_nullable = k in optional_fields and k in nullable_fields
2551
- is_set = (
2552
- self.__pydantic_fields_set__.intersection({n})
2553
- or k in null_default_fields
2554
- ) # pylint: disable=no-member
2555
-
2556
- if val is not None and val != UNSET_SENTINEL:
2557
- m[k] = val
2558
- elif val != UNSET_SENTINEL and (
2559
- not k in optional_fields or (optional_nullable and is_set)
2560
- ):
2561
- m[k] = val
3800
+ is_nullable_and_explicitly_set = (
3801
+ k in nullable_fields
3802
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
3803
+ )
3804
+
3805
+ if val != UNSET_SENTINEL:
3806
+ if (
3807
+ val is not None
3808
+ or k not in optional_fields
3809
+ or is_nullable_and_explicitly_set
3810
+ ):
3811
+ m[k] = val
2562
3812
 
2563
3813
  return m
2564
3814
 
@@ -2581,6 +3831,22 @@ class UpdateAgentRetry(BaseModel):
2581
3831
  on_codes: Optional[List[float]] = None
2582
3832
  r"""HTTP status codes that trigger retry logic"""
2583
3833
 
3834
+ @model_serializer(mode="wrap")
3835
+ def serialize_model(self, handler):
3836
+ optional_fields = set(["count", "on_codes"])
3837
+ serialized = handler(self)
3838
+ m = {}
3839
+
3840
+ for n, f in type(self).model_fields.items():
3841
+ k = f.alias or n
3842
+ val = serialized.get(k)
3843
+
3844
+ if val != UNSET_SENTINEL:
3845
+ if val is not None or k not in optional_fields:
3846
+ m[k] = val
3847
+
3848
+ return m
3849
+
2584
3850
 
2585
3851
  UpdateAgentFallbackModelConfigurationAgentsVoice = Literal[
2586
3852
  "alloy",
@@ -2656,6 +3922,22 @@ class UpdateAgentResponseFormatAgentsResponse200ApplicationJSONJSONSchema(BaseMo
2656
3922
  strict: Optional[bool] = False
2657
3923
  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."""
2658
3924
 
3925
+ @model_serializer(mode="wrap")
3926
+ def serialize_model(self, handler):
3927
+ optional_fields = set(["description", "schema", "strict"])
3928
+ serialized = handler(self)
3929
+ m = {}
3930
+
3931
+ for n, f in type(self).model_fields.items():
3932
+ k = f.alias or n
3933
+ val = serialized.get(k)
3934
+
3935
+ if val != UNSET_SENTINEL:
3936
+ if val is not None or k not in optional_fields:
3937
+ m[k] = val
3938
+
3939
+ return m
3940
+
2659
3941
 
2660
3942
  class UpdateAgentResponseFormatAgentsResponse200ApplicationJSONResponseBodyJSONSchemaTypedDict(
2661
3943
  TypedDict
@@ -2801,6 +4083,22 @@ class UpdateAgentFallbackModelConfigurationAgentsStreamOptions(BaseModel):
2801
4083
  include_usage: Optional[bool] = None
2802
4084
  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."""
2803
4085
 
4086
+ @model_serializer(mode="wrap")
4087
+ def serialize_model(self, handler):
4088
+ optional_fields = set(["include_usage"])
4089
+ serialized = handler(self)
4090
+ m = {}
4091
+
4092
+ for n, f in type(self).model_fields.items():
4093
+ k = f.alias or n
4094
+ val = serialized.get(k)
4095
+
4096
+ if val != UNSET_SENTINEL:
4097
+ if val is not None or k not in optional_fields:
4098
+ m[k] = val
4099
+
4100
+ return m
4101
+
2804
4102
 
2805
4103
  UpdateAgentFallbackModelConfigurationAgentsThinkingTypedDict = TypeAliasType(
2806
4104
  "UpdateAgentFallbackModelConfigurationAgentsThinkingTypedDict",
@@ -2843,6 +4141,22 @@ class UpdateAgentToolChoiceAgentsResponse2002(BaseModel):
2843
4141
  type: Optional[UpdateAgentToolChoiceAgentsResponse200Type] = None
2844
4142
  r"""The type of the tool. Currently, only function is supported."""
2845
4143
 
4144
+ @model_serializer(mode="wrap")
4145
+ def serialize_model(self, handler):
4146
+ optional_fields = set(["type"])
4147
+ serialized = handler(self)
4148
+ m = {}
4149
+
4150
+ for n, f in type(self).model_fields.items():
4151
+ k = f.alias or n
4152
+ val = serialized.get(k)
4153
+
4154
+ if val != UNSET_SENTINEL:
4155
+ if val is not None or k not in optional_fields:
4156
+ m[k] = val
4157
+
4158
+ return m
4159
+
2846
4160
 
2847
4161
  UpdateAgentToolChoiceAgentsResponse2001 = Literal[
2848
4162
  "none",
@@ -2916,9 +4230,163 @@ class UpdateAgentFallbackModelConfigurationAgentsGuardrails(BaseModel):
2916
4230
  r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
2917
4231
 
2918
4232
 
4233
+ class UpdateAgentFallbackModelConfigurationAgentsFallbacksTypedDict(TypedDict):
4234
+ model: str
4235
+ r"""Fallback model identifier"""
4236
+
4237
+
4238
+ class UpdateAgentFallbackModelConfigurationAgentsFallbacks(BaseModel):
4239
+ model: str
4240
+ r"""Fallback model identifier"""
4241
+
4242
+
4243
+ class UpdateAgentFallbackModelConfigurationAgentsResponse200RetryTypedDict(TypedDict):
4244
+ r"""Retry configuration for the request"""
4245
+
4246
+ count: NotRequired[float]
4247
+ r"""Number of retry attempts (1-5)"""
4248
+ on_codes: NotRequired[List[float]]
4249
+ r"""HTTP status codes that trigger retry logic"""
4250
+
4251
+
4252
+ class UpdateAgentFallbackModelConfigurationAgentsResponse200Retry(BaseModel):
4253
+ r"""Retry configuration for the request"""
4254
+
4255
+ count: Optional[float] = 3
4256
+ r"""Number of retry attempts (1-5)"""
4257
+
4258
+ on_codes: Optional[List[float]] = None
4259
+ r"""HTTP status codes that trigger retry logic"""
4260
+
4261
+ @model_serializer(mode="wrap")
4262
+ def serialize_model(self, handler):
4263
+ optional_fields = set(["count", "on_codes"])
4264
+ serialized = handler(self)
4265
+ m = {}
4266
+
4267
+ for n, f in type(self).model_fields.items():
4268
+ k = f.alias or n
4269
+ val = serialized.get(k)
4270
+
4271
+ if val != UNSET_SENTINEL:
4272
+ if val is not None or k not in optional_fields:
4273
+ m[k] = val
4274
+
4275
+ return m
4276
+
4277
+
4278
+ UpdateAgentFallbackModelConfigurationAgentsType = Literal["exact_match",]
4279
+
4280
+
4281
+ class UpdateAgentFallbackModelConfigurationAgentsCacheTypedDict(TypedDict):
4282
+ r"""Cache configuration for the request."""
4283
+
4284
+ type: UpdateAgentFallbackModelConfigurationAgentsType
4285
+ ttl: NotRequired[float]
4286
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
4287
+
4288
+
4289
+ class UpdateAgentFallbackModelConfigurationAgentsCache(BaseModel):
4290
+ r"""Cache configuration for the request."""
4291
+
4292
+ type: UpdateAgentFallbackModelConfigurationAgentsType
4293
+
4294
+ ttl: Optional[float] = 1800
4295
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
4296
+
4297
+ @model_serializer(mode="wrap")
4298
+ def serialize_model(self, handler):
4299
+ optional_fields = set(["ttl"])
4300
+ serialized = handler(self)
4301
+ m = {}
4302
+
4303
+ for n, f in type(self).model_fields.items():
4304
+ k = f.alias or n
4305
+ val = serialized.get(k)
4306
+
4307
+ if val != UNSET_SENTINEL:
4308
+ if val is not None or k not in optional_fields:
4309
+ m[k] = val
4310
+
4311
+ return m
4312
+
4313
+
4314
+ UpdateAgentLoadBalancerAgentsResponse200Type = Literal["weight_based",]
4315
+
4316
+
4317
+ class UpdateAgentLoadBalancerAgentsResponse200ModelsTypedDict(TypedDict):
4318
+ model: str
4319
+ r"""Model identifier for load balancing"""
4320
+ weight: NotRequired[float]
4321
+ r"""Weight assigned to this model for load balancing"""
4322
+
4323
+
4324
+ class UpdateAgentLoadBalancerAgentsResponse200Models(BaseModel):
4325
+ model: str
4326
+ r"""Model identifier for load balancing"""
4327
+
4328
+ weight: Optional[float] = 0.5
4329
+ r"""Weight assigned to this model for load balancing"""
4330
+
4331
+ @model_serializer(mode="wrap")
4332
+ def serialize_model(self, handler):
4333
+ optional_fields = set(["weight"])
4334
+ serialized = handler(self)
4335
+ m = {}
4336
+
4337
+ for n, f in type(self).model_fields.items():
4338
+ k = f.alias or n
4339
+ val = serialized.get(k)
4340
+
4341
+ if val != UNSET_SENTINEL:
4342
+ if val is not None or k not in optional_fields:
4343
+ m[k] = val
4344
+
4345
+ return m
4346
+
4347
+
4348
+ class UpdateAgentLoadBalancerAgentsResponse2001TypedDict(TypedDict):
4349
+ type: UpdateAgentLoadBalancerAgentsResponse200Type
4350
+ models: List[UpdateAgentLoadBalancerAgentsResponse200ModelsTypedDict]
4351
+
4352
+
4353
+ class UpdateAgentLoadBalancerAgentsResponse2001(BaseModel):
4354
+ type: UpdateAgentLoadBalancerAgentsResponse200Type
4355
+
4356
+ models: List[UpdateAgentLoadBalancerAgentsResponse200Models]
4357
+
4358
+
4359
+ UpdateAgentFallbackModelConfigurationAgentsLoadBalancerTypedDict = (
4360
+ UpdateAgentLoadBalancerAgentsResponse2001TypedDict
4361
+ )
4362
+ r"""Load balancer configuration for the request."""
4363
+
4364
+
4365
+ UpdateAgentFallbackModelConfigurationAgentsLoadBalancer = (
4366
+ UpdateAgentLoadBalancerAgentsResponse2001
4367
+ )
4368
+ r"""Load balancer configuration for the request."""
4369
+
4370
+
4371
+ class UpdateAgentFallbackModelConfigurationAgentsTimeoutTypedDict(TypedDict):
4372
+ 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."""
4373
+
4374
+ call_timeout: float
4375
+ r"""Timeout value in milliseconds"""
4376
+
4377
+
4378
+ class UpdateAgentFallbackModelConfigurationAgentsTimeout(BaseModel):
4379
+ 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."""
4380
+
4381
+ call_timeout: float
4382
+ r"""Timeout value in milliseconds"""
4383
+
4384
+
2919
4385
  class UpdateAgentFallbackModelConfigurationAgentsParametersTypedDict(TypedDict):
2920
4386
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
2921
4387
 
4388
+ name: NotRequired[str]
4389
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
2922
4390
  audio: NotRequired[
2923
4391
  Nullable[UpdateAgentFallbackModelConfigurationAgentsAudioTypedDict]
2924
4392
  ]
@@ -2989,11 +4457,30 @@ class UpdateAgentFallbackModelConfigurationAgentsParametersTypedDict(TypedDict):
2989
4457
  List[UpdateAgentFallbackModelConfigurationAgentsGuardrailsTypedDict]
2990
4458
  ]
2991
4459
  r"""A list of guardrails to apply to the request."""
4460
+ fallbacks: NotRequired[
4461
+ List[UpdateAgentFallbackModelConfigurationAgentsFallbacksTypedDict]
4462
+ ]
4463
+ r"""Array of fallback models to use if primary model fails"""
4464
+ retry: NotRequired[
4465
+ UpdateAgentFallbackModelConfigurationAgentsResponse200RetryTypedDict
4466
+ ]
4467
+ r"""Retry configuration for the request"""
4468
+ cache: NotRequired[UpdateAgentFallbackModelConfigurationAgentsCacheTypedDict]
4469
+ r"""Cache configuration for the request."""
4470
+ load_balancer: NotRequired[
4471
+ UpdateAgentFallbackModelConfigurationAgentsLoadBalancerTypedDict
4472
+ ]
4473
+ r"""Load balancer configuration for the request."""
4474
+ timeout: NotRequired[UpdateAgentFallbackModelConfigurationAgentsTimeoutTypedDict]
4475
+ 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."""
2992
4476
 
2993
4477
 
2994
4478
  class UpdateAgentFallbackModelConfigurationAgentsParameters(BaseModel):
2995
4479
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
2996
4480
 
4481
+ name: Optional[str] = None
4482
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
4483
+
2997
4484
  audio: OptionalNullable[UpdateAgentFallbackModelConfigurationAgentsAudio] = UNSET
2998
4485
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
2999
4486
 
@@ -3080,77 +4567,101 @@ class UpdateAgentFallbackModelConfigurationAgentsParameters(BaseModel):
3080
4567
  ] = None
3081
4568
  r"""A list of guardrails to apply to the request."""
3082
4569
 
4570
+ fallbacks: Optional[List[UpdateAgentFallbackModelConfigurationAgentsFallbacks]] = (
4571
+ None
4572
+ )
4573
+ r"""Array of fallback models to use if primary model fails"""
4574
+
4575
+ retry: Optional[UpdateAgentFallbackModelConfigurationAgentsResponse200Retry] = None
4576
+ r"""Retry configuration for the request"""
4577
+
4578
+ cache: Optional[UpdateAgentFallbackModelConfigurationAgentsCache] = None
4579
+ r"""Cache configuration for the request."""
4580
+
4581
+ load_balancer: Optional[UpdateAgentFallbackModelConfigurationAgentsLoadBalancer] = (
4582
+ None
4583
+ )
4584
+ r"""Load balancer configuration for the request."""
4585
+
4586
+ timeout: Optional[UpdateAgentFallbackModelConfigurationAgentsTimeout] = None
4587
+ 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."""
4588
+
3083
4589
  @model_serializer(mode="wrap")
3084
4590
  def serialize_model(self, handler):
3085
- optional_fields = [
3086
- "audio",
3087
- "frequency_penalty",
3088
- "max_tokens",
3089
- "max_completion_tokens",
3090
- "logprobs",
3091
- "top_logprobs",
3092
- "n",
3093
- "presence_penalty",
3094
- "response_format",
3095
- "reasoning_effort",
3096
- "verbosity",
3097
- "seed",
3098
- "stop",
3099
- "stream_options",
3100
- "thinking",
3101
- "temperature",
3102
- "top_p",
3103
- "top_k",
3104
- "tool_choice",
3105
- "parallel_tool_calls",
3106
- "modalities",
3107
- "guardrails",
3108
- ]
3109
- nullable_fields = [
3110
- "audio",
3111
- "frequency_penalty",
3112
- "max_tokens",
3113
- "max_completion_tokens",
3114
- "logprobs",
3115
- "top_logprobs",
3116
- "n",
3117
- "presence_penalty",
3118
- "seed",
3119
- "stop",
3120
- "stream_options",
3121
- "temperature",
3122
- "top_p",
3123
- "top_k",
3124
- "modalities",
3125
- ]
3126
- null_default_fields = []
3127
-
4591
+ optional_fields = set(
4592
+ [
4593
+ "name",
4594
+ "audio",
4595
+ "frequency_penalty",
4596
+ "max_tokens",
4597
+ "max_completion_tokens",
4598
+ "logprobs",
4599
+ "top_logprobs",
4600
+ "n",
4601
+ "presence_penalty",
4602
+ "response_format",
4603
+ "reasoning_effort",
4604
+ "verbosity",
4605
+ "seed",
4606
+ "stop",
4607
+ "stream_options",
4608
+ "thinking",
4609
+ "temperature",
4610
+ "top_p",
4611
+ "top_k",
4612
+ "tool_choice",
4613
+ "parallel_tool_calls",
4614
+ "modalities",
4615
+ "guardrails",
4616
+ "fallbacks",
4617
+ "retry",
4618
+ "cache",
4619
+ "load_balancer",
4620
+ "timeout",
4621
+ ]
4622
+ )
4623
+ nullable_fields = set(
4624
+ [
4625
+ "audio",
4626
+ "frequency_penalty",
4627
+ "max_tokens",
4628
+ "max_completion_tokens",
4629
+ "logprobs",
4630
+ "top_logprobs",
4631
+ "n",
4632
+ "presence_penalty",
4633
+ "seed",
4634
+ "stop",
4635
+ "stream_options",
4636
+ "temperature",
4637
+ "top_p",
4638
+ "top_k",
4639
+ "modalities",
4640
+ ]
4641
+ )
3128
4642
  serialized = handler(self)
3129
-
3130
4643
  m = {}
3131
4644
 
3132
4645
  for n, f in type(self).model_fields.items():
3133
4646
  k = f.alias or n
3134
4647
  val = serialized.get(k)
3135
- serialized.pop(k, None)
3136
-
3137
- optional_nullable = k in optional_fields and k in nullable_fields
3138
- is_set = (
3139
- self.__pydantic_fields_set__.intersection({n})
3140
- or k in null_default_fields
3141
- ) # pylint: disable=no-member
3142
-
3143
- if val is not None and val != UNSET_SENTINEL:
3144
- m[k] = val
3145
- elif val != UNSET_SENTINEL and (
3146
- not k in optional_fields or (optional_nullable and is_set)
3147
- ):
3148
- m[k] = val
4648
+ is_nullable_and_explicitly_set = (
4649
+ k in nullable_fields
4650
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
4651
+ )
4652
+
4653
+ if val != UNSET_SENTINEL:
4654
+ if (
4655
+ val is not None
4656
+ or k not in optional_fields
4657
+ or is_nullable_and_explicitly_set
4658
+ ):
4659
+ m[k] = val
3149
4660
 
3150
4661
  return m
3151
4662
 
3152
4663
 
3153
- class UpdateAgentFallbackModelConfigurationAgentsRetryTypedDict(TypedDict):
4664
+ class UpdateAgentFallbackModelConfigurationAgentsResponseRetryTypedDict(TypedDict):
3154
4665
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
3155
4666
 
3156
4667
  count: NotRequired[float]
@@ -3159,7 +4670,7 @@ class UpdateAgentFallbackModelConfigurationAgentsRetryTypedDict(TypedDict):
3159
4670
  r"""HTTP status codes that trigger retry logic"""
3160
4671
 
3161
4672
 
3162
- class UpdateAgentFallbackModelConfigurationAgentsRetry(BaseModel):
4673
+ class UpdateAgentFallbackModelConfigurationAgentsResponseRetry(BaseModel):
3163
4674
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
3164
4675
 
3165
4676
  count: Optional[float] = 3
@@ -3168,6 +4679,22 @@ class UpdateAgentFallbackModelConfigurationAgentsRetry(BaseModel):
3168
4679
  on_codes: Optional[List[float]] = None
3169
4680
  r"""HTTP status codes that trigger retry logic"""
3170
4681
 
4682
+ @model_serializer(mode="wrap")
4683
+ def serialize_model(self, handler):
4684
+ optional_fields = set(["count", "on_codes"])
4685
+ serialized = handler(self)
4686
+ m = {}
4687
+
4688
+ for n, f in type(self).model_fields.items():
4689
+ k = f.alias or n
4690
+ val = serialized.get(k)
4691
+
4692
+ if val != UNSET_SENTINEL:
4693
+ if val is not None or k not in optional_fields:
4694
+ m[k] = val
4695
+
4696
+ return m
4697
+
3171
4698
 
3172
4699
  class UpdateAgentFallbackModelConfigurationAgents2TypedDict(TypedDict):
3173
4700
  r"""Fallback model configuration with optional parameters and retry settings."""
@@ -3178,7 +4705,9 @@ class UpdateAgentFallbackModelConfigurationAgents2TypedDict(TypedDict):
3178
4705
  UpdateAgentFallbackModelConfigurationAgentsParametersTypedDict
3179
4706
  ]
3180
4707
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
3181
- retry: NotRequired[UpdateAgentFallbackModelConfigurationAgentsRetryTypedDict]
4708
+ retry: NotRequired[
4709
+ UpdateAgentFallbackModelConfigurationAgentsResponseRetryTypedDict
4710
+ ]
3182
4711
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
3183
4712
 
3184
4713
 
@@ -3191,9 +4720,25 @@ class UpdateAgentFallbackModelConfigurationAgents2(BaseModel):
3191
4720
  parameters: Optional[UpdateAgentFallbackModelConfigurationAgentsParameters] = None
3192
4721
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
3193
4722
 
3194
- retry: Optional[UpdateAgentFallbackModelConfigurationAgentsRetry] = None
4723
+ retry: Optional[UpdateAgentFallbackModelConfigurationAgentsResponseRetry] = None
3195
4724
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
3196
4725
 
4726
+ @model_serializer(mode="wrap")
4727
+ def serialize_model(self, handler):
4728
+ optional_fields = set(["parameters", "retry"])
4729
+ serialized = handler(self)
4730
+ m = {}
4731
+
4732
+ for n, f in type(self).model_fields.items():
4733
+ k = f.alias or n
4734
+ val = serialized.get(k)
4735
+
4736
+ if val != UNSET_SENTINEL:
4737
+ if val is not None or k not in optional_fields:
4738
+ m[k] = val
4739
+
4740
+ return m
4741
+
3197
4742
 
3198
4743
  UpdateAgentAgentsFallbackModelConfigurationTypedDict = TypeAliasType(
3199
4744
  "UpdateAgentAgentsFallbackModelConfigurationTypedDict",
@@ -3244,31 +4789,28 @@ class UpdateAgentModel(BaseModel):
3244
4789
 
3245
4790
  @model_serializer(mode="wrap")
3246
4791
  def serialize_model(self, handler):
3247
- optional_fields = ["integration_id", "parameters", "retry", "fallback_models"]
3248
- nullable_fields = ["integration_id", "fallback_models"]
3249
- null_default_fields = []
3250
-
4792
+ optional_fields = set(
4793
+ ["integration_id", "parameters", "retry", "fallback_models"]
4794
+ )
4795
+ nullable_fields = set(["integration_id", "fallback_models"])
3251
4796
  serialized = handler(self)
3252
-
3253
4797
  m = {}
3254
4798
 
3255
4799
  for n, f in type(self).model_fields.items():
3256
4800
  k = f.alias or n
3257
4801
  val = serialized.get(k)
3258
- serialized.pop(k, None)
3259
-
3260
- optional_nullable = k in optional_fields and k in nullable_fields
3261
- is_set = (
3262
- self.__pydantic_fields_set__.intersection({n})
3263
- or k in null_default_fields
3264
- ) # pylint: disable=no-member
3265
-
3266
- if val is not None and val != UNSET_SENTINEL:
3267
- m[k] = val
3268
- elif val != UNSET_SENTINEL and (
3269
- not k in optional_fields or (optional_nullable and is_set)
3270
- ):
3271
- m[k] = val
4802
+ is_nullable_and_explicitly_set = (
4803
+ k in nullable_fields
4804
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
4805
+ )
4806
+
4807
+ if val != UNSET_SENTINEL:
4808
+ if (
4809
+ val is not None
4810
+ or k not in optional_fields
4811
+ or is_nullable_and_explicitly_set
4812
+ ):
4813
+ m[k] = val
3272
4814
 
3273
4815
  return m
3274
4816
 
@@ -3287,6 +4829,22 @@ class UpdateAgentAgentsTeamOfAgents(BaseModel):
3287
4829
  role: Optional[str] = None
3288
4830
  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."""
3289
4831
 
4832
+ @model_serializer(mode="wrap")
4833
+ def serialize_model(self, handler):
4834
+ optional_fields = set(["role"])
4835
+ serialized = handler(self)
4836
+ m = {}
4837
+
4838
+ for n, f in type(self).model_fields.items():
4839
+ k = f.alias or n
4840
+ val = serialized.get(k)
4841
+
4842
+ if val != UNSET_SENTINEL:
4843
+ if val is not None or k not in optional_fields:
4844
+ m[k] = val
4845
+
4846
+ return m
4847
+
3290
4848
 
3291
4849
  class UpdateAgentMetricsTypedDict(TypedDict):
3292
4850
  total_cost: NotRequired[float]
@@ -3295,6 +4853,22 @@ class UpdateAgentMetricsTypedDict(TypedDict):
3295
4853
  class UpdateAgentMetrics(BaseModel):
3296
4854
  total_cost: Optional[float] = 0
3297
4855
 
4856
+ @model_serializer(mode="wrap")
4857
+ def serialize_model(self, handler):
4858
+ optional_fields = set(["total_cost"])
4859
+ serialized = handler(self)
4860
+ m = {}
4861
+
4862
+ for n, f in type(self).model_fields.items():
4863
+ k = f.alias or n
4864
+ val = serialized.get(k)
4865
+
4866
+ if val != UNSET_SENTINEL:
4867
+ if val is not None or k not in optional_fields:
4868
+ m[k] = val
4869
+
4870
+ return m
4871
+
3298
4872
 
3299
4873
  class UpdateAgentAgentsKnowledgeBasesTypedDict(TypedDict):
3300
4874
  knowledge_id: str
@@ -3419,42 +4993,39 @@ class UpdateAgentResponseBody(BaseModel):
3419
4993
 
3420
4994
  @model_serializer(mode="wrap")
3421
4995
  def serialize_model(self, handler):
3422
- optional_fields = [
3423
- "created_by_id",
3424
- "updated_by_id",
3425
- "created",
3426
- "updated",
3427
- "system_prompt",
3428
- "settings",
3429
- "version_hash",
3430
- "metrics",
3431
- "variables",
3432
- "knowledge_bases",
3433
- "source",
3434
- ]
3435
- nullable_fields = ["created_by_id", "updated_by_id"]
3436
- null_default_fields = []
3437
-
4996
+ optional_fields = set(
4997
+ [
4998
+ "created_by_id",
4999
+ "updated_by_id",
5000
+ "created",
5001
+ "updated",
5002
+ "system_prompt",
5003
+ "settings",
5004
+ "version_hash",
5005
+ "metrics",
5006
+ "variables",
5007
+ "knowledge_bases",
5008
+ "source",
5009
+ ]
5010
+ )
5011
+ nullable_fields = set(["created_by_id", "updated_by_id"])
3438
5012
  serialized = handler(self)
3439
-
3440
5013
  m = {}
3441
5014
 
3442
5015
  for n, f in type(self).model_fields.items():
3443
5016
  k = f.alias or n
3444
5017
  val = serialized.get(k)
3445
- serialized.pop(k, None)
3446
-
3447
- optional_nullable = k in optional_fields and k in nullable_fields
3448
- is_set = (
3449
- self.__pydantic_fields_set__.intersection({n})
3450
- or k in null_default_fields
3451
- ) # pylint: disable=no-member
3452
-
3453
- if val is not None and val != UNSET_SENTINEL:
3454
- m[k] = val
3455
- elif val != UNSET_SENTINEL and (
3456
- not k in optional_fields or (optional_nullable and is_set)
3457
- ):
3458
- m[k] = val
5018
+ is_nullable_and_explicitly_set = (
5019
+ k in nullable_fields
5020
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
5021
+ )
5022
+
5023
+ if val != UNSET_SENTINEL:
5024
+ if (
5025
+ val is not None
5026
+ or k not in optional_fields
5027
+ or is_nullable_and_explicitly_set
5028
+ ):
5029
+ m[k] = val
3459
5030
 
3460
5031
  return m