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
@@ -51,6 +51,22 @@ class ListAgentsRequest(BaseModel):
51
51
  ] = None
52
52
  r"""A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `before=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the previous page of the list."""
53
53
 
54
+ @model_serializer(mode="wrap")
55
+ def serialize_model(self, handler):
56
+ optional_fields = set(["limit", "starting_after", "ending_before"])
57
+ serialized = handler(self)
58
+ m = {}
59
+
60
+ for n, f in type(self).model_fields.items():
61
+ k = f.alias or n
62
+ val = serialized.get(k)
63
+
64
+ if val != UNSET_SENTINEL:
65
+ if val is not None or k not in optional_fields:
66
+ m[k] = val
67
+
68
+ return m
69
+
54
70
 
55
71
  ListAgentsObject = Literal["list",]
56
72
 
@@ -133,6 +149,32 @@ class ListAgentsTools(BaseModel):
133
149
  timeout: Optional[float] = 120
134
150
  r"""Tool execution timeout in seconds (default: 2 minutes, max: 10 minutes)"""
135
151
 
152
+ @model_serializer(mode="wrap")
153
+ def serialize_model(self, handler):
154
+ optional_fields = set(
155
+ [
156
+ "key",
157
+ "display_name",
158
+ "description",
159
+ "requires_approval",
160
+ "tool_id",
161
+ "conditions",
162
+ "timeout",
163
+ ]
164
+ )
165
+ serialized = handler(self)
166
+ m = {}
167
+
168
+ for n, f in type(self).model_fields.items():
169
+ k = f.alias or n
170
+ val = serialized.get(k)
171
+
172
+ if val != UNSET_SENTINEL:
173
+ if val is not None or k not in optional_fields:
174
+ m[k] = val
175
+
176
+ return m
177
+
136
178
 
137
179
  ListAgentsExecuteOn = Literal[
138
180
  "input",
@@ -160,6 +202,22 @@ class ListAgentsEvaluators(BaseModel):
160
202
  sample_rate: Optional[float] = 50
161
203
  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."""
162
204
 
205
+ @model_serializer(mode="wrap")
206
+ def serialize_model(self, handler):
207
+ optional_fields = set(["sample_rate"])
208
+ serialized = handler(self)
209
+ m = {}
210
+
211
+ for n, f in type(self).model_fields.items():
212
+ k = f.alias or n
213
+ val = serialized.get(k)
214
+
215
+ if val != UNSET_SENTINEL:
216
+ if val is not None or k not in optional_fields:
217
+ m[k] = val
218
+
219
+ return m
220
+
163
221
 
164
222
  ListAgentsAgentsExecuteOn = Literal[
165
223
  "input",
@@ -187,6 +245,22 @@ class ListAgentsGuardrails(BaseModel):
187
245
  sample_rate: Optional[float] = 50
188
246
  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."""
189
247
 
248
+ @model_serializer(mode="wrap")
249
+ def serialize_model(self, handler):
250
+ optional_fields = set(["sample_rate"])
251
+ serialized = handler(self)
252
+ m = {}
253
+
254
+ for n, f in type(self).model_fields.items():
255
+ k = f.alias or n
256
+ val = serialized.get(k)
257
+
258
+ if val != UNSET_SENTINEL:
259
+ if val is not None or k not in optional_fields:
260
+ m[k] = val
261
+
262
+ return m
263
+
190
264
 
191
265
  class ListAgentsSettingsTypedDict(TypedDict):
192
266
  max_iterations: NotRequired[int]
@@ -220,6 +294,31 @@ class ListAgentsSettings(BaseModel):
220
294
  guardrails: Optional[List[ListAgentsGuardrails]] = None
221
295
  r"""Configuration for a guardrail applied to the agent"""
222
296
 
297
+ @model_serializer(mode="wrap")
298
+ def serialize_model(self, handler):
299
+ optional_fields = set(
300
+ [
301
+ "max_iterations",
302
+ "max_execution_time",
303
+ "tool_approval_required",
304
+ "tools",
305
+ "evaluators",
306
+ "guardrails",
307
+ ]
308
+ )
309
+ serialized = handler(self)
310
+ m = {}
311
+
312
+ for n, f in type(self).model_fields.items():
313
+ k = f.alias or n
314
+ val = serialized.get(k)
315
+
316
+ if val != UNSET_SENTINEL:
317
+ if val is not None or k not in optional_fields:
318
+ m[k] = val
319
+
320
+ return m
321
+
223
322
 
224
323
  ListAgentsVoice = Literal[
225
324
  "alloy",
@@ -288,6 +387,22 @@ class ListAgentsResponseFormatJSONSchema(BaseModel):
288
387
  strict: Optional[bool] = False
289
388
  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."""
290
389
 
390
+ @model_serializer(mode="wrap")
391
+ def serialize_model(self, handler):
392
+ optional_fields = set(["description", "schema", "strict"])
393
+ serialized = handler(self)
394
+ m = {}
395
+
396
+ for n, f in type(self).model_fields.items():
397
+ k = f.alias or n
398
+ val = serialized.get(k)
399
+
400
+ if val != UNSET_SENTINEL:
401
+ if val is not None or k not in optional_fields:
402
+ m[k] = val
403
+
404
+ return m
405
+
291
406
 
292
407
  class ListAgentsResponseFormatAgentsJSONSchemaTypedDict(TypedDict):
293
408
  r"""
@@ -416,6 +531,22 @@ class ListAgentsStreamOptions(BaseModel):
416
531
  include_usage: Optional[bool] = None
417
532
  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."""
418
533
 
534
+ @model_serializer(mode="wrap")
535
+ def serialize_model(self, handler):
536
+ optional_fields = set(["include_usage"])
537
+ serialized = handler(self)
538
+ m = {}
539
+
540
+ for n, f in type(self).model_fields.items():
541
+ k = f.alias or n
542
+ val = serialized.get(k)
543
+
544
+ if val != UNSET_SENTINEL:
545
+ if val is not None or k not in optional_fields:
546
+ m[k] = val
547
+
548
+ return m
549
+
419
550
 
420
551
  ListAgentsThinkingTypedDict = TypeAliasType(
421
552
  "ListAgentsThinkingTypedDict",
@@ -458,6 +589,22 @@ class ListAgentsToolChoice2(BaseModel):
458
589
  type: Optional[ListAgentsToolChoiceType] = None
459
590
  r"""The type of the tool. Currently, only function is supported."""
460
591
 
592
+ @model_serializer(mode="wrap")
593
+ def serialize_model(self, handler):
594
+ optional_fields = set(["type"])
595
+ serialized = handler(self)
596
+ m = {}
597
+
598
+ for n, f in type(self).model_fields.items():
599
+ k = f.alias or n
600
+ val = serialized.get(k)
601
+
602
+ if val != UNSET_SENTINEL:
603
+ if val is not None or k not in optional_fields:
604
+ m[k] = val
605
+
606
+ return m
607
+
461
608
 
462
609
  ListAgentsToolChoice1 = Literal[
463
610
  "none",
@@ -521,9 +668,159 @@ class ListAgentsAgentsGuardrails(BaseModel):
521
668
  r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
522
669
 
523
670
 
671
+ class ListAgentsFallbacksTypedDict(TypedDict):
672
+ model: str
673
+ r"""Fallback model identifier"""
674
+
675
+
676
+ class ListAgentsFallbacks(BaseModel):
677
+ model: str
678
+ r"""Fallback model identifier"""
679
+
680
+
681
+ class ListAgentsAgentsRetryTypedDict(TypedDict):
682
+ r"""Retry configuration for the request"""
683
+
684
+ count: NotRequired[float]
685
+ r"""Number of retry attempts (1-5)"""
686
+ on_codes: NotRequired[List[float]]
687
+ r"""HTTP status codes that trigger retry logic"""
688
+
689
+
690
+ class ListAgentsAgentsRetry(BaseModel):
691
+ r"""Retry configuration for the request"""
692
+
693
+ count: Optional[float] = 3
694
+ r"""Number of retry attempts (1-5)"""
695
+
696
+ on_codes: Optional[List[float]] = None
697
+ r"""HTTP status codes that trigger retry logic"""
698
+
699
+ @model_serializer(mode="wrap")
700
+ def serialize_model(self, handler):
701
+ optional_fields = set(["count", "on_codes"])
702
+ serialized = handler(self)
703
+ m = {}
704
+
705
+ for n, f in type(self).model_fields.items():
706
+ k = f.alias or n
707
+ val = serialized.get(k)
708
+
709
+ if val != UNSET_SENTINEL:
710
+ if val is not None or k not in optional_fields:
711
+ m[k] = val
712
+
713
+ return m
714
+
715
+
716
+ ListAgentsType = Literal["exact_match",]
717
+
718
+
719
+ class ListAgentsCacheTypedDict(TypedDict):
720
+ r"""Cache configuration for the request."""
721
+
722
+ type: ListAgentsType
723
+ ttl: NotRequired[float]
724
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
725
+
726
+
727
+ class ListAgentsCache(BaseModel):
728
+ r"""Cache configuration for the request."""
729
+
730
+ type: ListAgentsType
731
+
732
+ ttl: Optional[float] = 1800
733
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
734
+
735
+ @model_serializer(mode="wrap")
736
+ def serialize_model(self, handler):
737
+ optional_fields = set(["ttl"])
738
+ serialized = handler(self)
739
+ m = {}
740
+
741
+ for n, f in type(self).model_fields.items():
742
+ k = f.alias or n
743
+ val = serialized.get(k)
744
+
745
+ if val != UNSET_SENTINEL:
746
+ if val is not None or k not in optional_fields:
747
+ m[k] = val
748
+
749
+ return m
750
+
751
+
752
+ ListAgentsLoadBalancerType = Literal["weight_based",]
753
+
754
+
755
+ class ListAgentsLoadBalancerModelsTypedDict(TypedDict):
756
+ model: str
757
+ r"""Model identifier for load balancing"""
758
+ weight: NotRequired[float]
759
+ r"""Weight assigned to this model for load balancing"""
760
+
761
+
762
+ class ListAgentsLoadBalancerModels(BaseModel):
763
+ model: str
764
+ r"""Model identifier for load balancing"""
765
+
766
+ weight: Optional[float] = 0.5
767
+ r"""Weight assigned to this model for load balancing"""
768
+
769
+ @model_serializer(mode="wrap")
770
+ def serialize_model(self, handler):
771
+ optional_fields = set(["weight"])
772
+ serialized = handler(self)
773
+ m = {}
774
+
775
+ for n, f in type(self).model_fields.items():
776
+ k = f.alias or n
777
+ val = serialized.get(k)
778
+
779
+ if val != UNSET_SENTINEL:
780
+ if val is not None or k not in optional_fields:
781
+ m[k] = val
782
+
783
+ return m
784
+
785
+
786
+ class ListAgentsLoadBalancer1TypedDict(TypedDict):
787
+ type: ListAgentsLoadBalancerType
788
+ models: List[ListAgentsLoadBalancerModelsTypedDict]
789
+
790
+
791
+ class ListAgentsLoadBalancer1(BaseModel):
792
+ type: ListAgentsLoadBalancerType
793
+
794
+ models: List[ListAgentsLoadBalancerModels]
795
+
796
+
797
+ ListAgentsLoadBalancerTypedDict = ListAgentsLoadBalancer1TypedDict
798
+ r"""Load balancer configuration for the request."""
799
+
800
+
801
+ ListAgentsLoadBalancer = ListAgentsLoadBalancer1
802
+ r"""Load balancer configuration for the request."""
803
+
804
+
805
+ class ListAgentsTimeoutTypedDict(TypedDict):
806
+ 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."""
807
+
808
+ call_timeout: float
809
+ r"""Timeout value in milliseconds"""
810
+
811
+
812
+ class ListAgentsTimeout(BaseModel):
813
+ 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."""
814
+
815
+ call_timeout: float
816
+ r"""Timeout value in milliseconds"""
817
+
818
+
524
819
  class ListAgentsParametersTypedDict(TypedDict):
525
820
  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."""
526
821
 
822
+ name: NotRequired[str]
823
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
527
824
  audio: NotRequired[Nullable[ListAgentsAudioTypedDict]]
528
825
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
529
826
  frequency_penalty: NotRequired[Nullable[float]]
@@ -578,11 +875,24 @@ class ListAgentsParametersTypedDict(TypedDict):
578
875
  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\"]."""
579
876
  guardrails: NotRequired[List[ListAgentsAgentsGuardrailsTypedDict]]
580
877
  r"""A list of guardrails to apply to the request."""
878
+ fallbacks: NotRequired[List[ListAgentsFallbacksTypedDict]]
879
+ r"""Array of fallback models to use if primary model fails"""
880
+ retry: NotRequired[ListAgentsAgentsRetryTypedDict]
881
+ r"""Retry configuration for the request"""
882
+ cache: NotRequired[ListAgentsCacheTypedDict]
883
+ r"""Cache configuration for the request."""
884
+ load_balancer: NotRequired[ListAgentsLoadBalancerTypedDict]
885
+ r"""Load balancer configuration for the request."""
886
+ timeout: NotRequired[ListAgentsTimeoutTypedDict]
887
+ 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."""
581
888
 
582
889
 
583
890
  class ListAgentsParameters(BaseModel):
584
891
  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."""
585
892
 
893
+ name: Optional[str] = None
894
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
895
+
586
896
  audio: OptionalNullable[ListAgentsAudio] = UNSET
587
897
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
588
898
 
@@ -659,72 +969,92 @@ class ListAgentsParameters(BaseModel):
659
969
  guardrails: Optional[List[ListAgentsAgentsGuardrails]] = None
660
970
  r"""A list of guardrails to apply to the request."""
661
971
 
972
+ fallbacks: Optional[List[ListAgentsFallbacks]] = None
973
+ r"""Array of fallback models to use if primary model fails"""
974
+
975
+ retry: Optional[ListAgentsAgentsRetry] = None
976
+ r"""Retry configuration for the request"""
977
+
978
+ cache: Optional[ListAgentsCache] = None
979
+ r"""Cache configuration for the request."""
980
+
981
+ load_balancer: Optional[ListAgentsLoadBalancer] = None
982
+ r"""Load balancer configuration for the request."""
983
+
984
+ timeout: Optional[ListAgentsTimeout] = None
985
+ 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."""
986
+
662
987
  @model_serializer(mode="wrap")
663
988
  def serialize_model(self, handler):
664
- optional_fields = [
665
- "audio",
666
- "frequency_penalty",
667
- "max_tokens",
668
- "max_completion_tokens",
669
- "logprobs",
670
- "top_logprobs",
671
- "n",
672
- "presence_penalty",
673
- "response_format",
674
- "reasoning_effort",
675
- "verbosity",
676
- "seed",
677
- "stop",
678
- "stream_options",
679
- "thinking",
680
- "temperature",
681
- "top_p",
682
- "top_k",
683
- "tool_choice",
684
- "parallel_tool_calls",
685
- "modalities",
686
- "guardrails",
687
- ]
688
- nullable_fields = [
689
- "audio",
690
- "frequency_penalty",
691
- "max_tokens",
692
- "max_completion_tokens",
693
- "logprobs",
694
- "top_logprobs",
695
- "n",
696
- "presence_penalty",
697
- "seed",
698
- "stop",
699
- "stream_options",
700
- "temperature",
701
- "top_p",
702
- "top_k",
703
- "modalities",
704
- ]
705
- null_default_fields = []
706
-
989
+ optional_fields = set(
990
+ [
991
+ "name",
992
+ "audio",
993
+ "frequency_penalty",
994
+ "max_tokens",
995
+ "max_completion_tokens",
996
+ "logprobs",
997
+ "top_logprobs",
998
+ "n",
999
+ "presence_penalty",
1000
+ "response_format",
1001
+ "reasoning_effort",
1002
+ "verbosity",
1003
+ "seed",
1004
+ "stop",
1005
+ "stream_options",
1006
+ "thinking",
1007
+ "temperature",
1008
+ "top_p",
1009
+ "top_k",
1010
+ "tool_choice",
1011
+ "parallel_tool_calls",
1012
+ "modalities",
1013
+ "guardrails",
1014
+ "fallbacks",
1015
+ "retry",
1016
+ "cache",
1017
+ "load_balancer",
1018
+ "timeout",
1019
+ ]
1020
+ )
1021
+ nullable_fields = set(
1022
+ [
1023
+ "audio",
1024
+ "frequency_penalty",
1025
+ "max_tokens",
1026
+ "max_completion_tokens",
1027
+ "logprobs",
1028
+ "top_logprobs",
1029
+ "n",
1030
+ "presence_penalty",
1031
+ "seed",
1032
+ "stop",
1033
+ "stream_options",
1034
+ "temperature",
1035
+ "top_p",
1036
+ "top_k",
1037
+ "modalities",
1038
+ ]
1039
+ )
707
1040
  serialized = handler(self)
708
-
709
1041
  m = {}
710
1042
 
711
1043
  for n, f in type(self).model_fields.items():
712
1044
  k = f.alias or n
713
1045
  val = serialized.get(k)
714
- serialized.pop(k, None)
715
-
716
- optional_nullable = k in optional_fields and k in nullable_fields
717
- is_set = (
718
- self.__pydantic_fields_set__.intersection({n})
719
- or k in null_default_fields
720
- ) # pylint: disable=no-member
721
-
722
- if val is not None and val != UNSET_SENTINEL:
723
- m[k] = val
724
- elif val != UNSET_SENTINEL and (
725
- not k in optional_fields or (optional_nullable and is_set)
726
- ):
727
- m[k] = val
1046
+ is_nullable_and_explicitly_set = (
1047
+ k in nullable_fields
1048
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
1049
+ )
1050
+
1051
+ if val != UNSET_SENTINEL:
1052
+ if (
1053
+ val is not None
1054
+ or k not in optional_fields
1055
+ or is_nullable_and_explicitly_set
1056
+ ):
1057
+ m[k] = val
728
1058
 
729
1059
  return m
730
1060
 
@@ -747,6 +1077,22 @@ class ListAgentsRetry(BaseModel):
747
1077
  on_codes: Optional[List[float]] = None
748
1078
  r"""HTTP status codes that trigger retry logic"""
749
1079
 
1080
+ @model_serializer(mode="wrap")
1081
+ def serialize_model(self, handler):
1082
+ optional_fields = set(["count", "on_codes"])
1083
+ serialized = handler(self)
1084
+ m = {}
1085
+
1086
+ for n, f in type(self).model_fields.items():
1087
+ k = f.alias or n
1088
+ val = serialized.get(k)
1089
+
1090
+ if val != UNSET_SENTINEL:
1091
+ if val is not None or k not in optional_fields:
1092
+ m[k] = val
1093
+
1094
+ return m
1095
+
750
1096
 
751
1097
  ListAgentsFallbackModelConfigurationVoice = Literal[
752
1098
  "alloy",
@@ -819,6 +1165,22 @@ class ListAgentsResponseFormatAgentsResponseJSONSchema(BaseModel):
819
1165
  strict: Optional[bool] = False
820
1166
  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."""
821
1167
 
1168
+ @model_serializer(mode="wrap")
1169
+ def serialize_model(self, handler):
1170
+ optional_fields = set(["description", "schema", "strict"])
1171
+ serialized = handler(self)
1172
+ m = {}
1173
+
1174
+ for n, f in type(self).model_fields.items():
1175
+ k = f.alias or n
1176
+ val = serialized.get(k)
1177
+
1178
+ if val != UNSET_SENTINEL:
1179
+ if val is not None or k not in optional_fields:
1180
+ m[k] = val
1181
+
1182
+ return m
1183
+
822
1184
 
823
1185
  class ListAgentsResponseFormatAgentsResponse200JSONSchemaTypedDict(TypedDict):
824
1186
  r"""
@@ -951,6 +1313,22 @@ class ListAgentsFallbackModelConfigurationStreamOptions(BaseModel):
951
1313
  include_usage: Optional[bool] = None
952
1314
  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."""
953
1315
 
1316
+ @model_serializer(mode="wrap")
1317
+ def serialize_model(self, handler):
1318
+ optional_fields = set(["include_usage"])
1319
+ serialized = handler(self)
1320
+ m = {}
1321
+
1322
+ for n, f in type(self).model_fields.items():
1323
+ k = f.alias or n
1324
+ val = serialized.get(k)
1325
+
1326
+ if val != UNSET_SENTINEL:
1327
+ if val is not None or k not in optional_fields:
1328
+ m[k] = val
1329
+
1330
+ return m
1331
+
954
1332
 
955
1333
  ListAgentsFallbackModelConfigurationThinkingTypedDict = TypeAliasType(
956
1334
  "ListAgentsFallbackModelConfigurationThinkingTypedDict",
@@ -993,6 +1371,22 @@ class ListAgentsToolChoiceAgents2(BaseModel):
993
1371
  type: Optional[ListAgentsToolChoiceAgentsType] = None
994
1372
  r"""The type of the tool. Currently, only function is supported."""
995
1373
 
1374
+ @model_serializer(mode="wrap")
1375
+ def serialize_model(self, handler):
1376
+ optional_fields = set(["type"])
1377
+ serialized = handler(self)
1378
+ m = {}
1379
+
1380
+ for n, f in type(self).model_fields.items():
1381
+ k = f.alias or n
1382
+ val = serialized.get(k)
1383
+
1384
+ if val != UNSET_SENTINEL:
1385
+ if val is not None or k not in optional_fields:
1386
+ m[k] = val
1387
+
1388
+ return m
1389
+
996
1390
 
997
1391
  ListAgentsToolChoiceAgents1 = Literal[
998
1392
  "none",
@@ -1059,9 +1453,161 @@ class ListAgentsFallbackModelConfigurationGuardrails(BaseModel):
1059
1453
  r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
1060
1454
 
1061
1455
 
1456
+ class ListAgentsFallbackModelConfigurationFallbacksTypedDict(TypedDict):
1457
+ model: str
1458
+ r"""Fallback model identifier"""
1459
+
1460
+
1461
+ class ListAgentsFallbackModelConfigurationFallbacks(BaseModel):
1462
+ model: str
1463
+ r"""Fallback model identifier"""
1464
+
1465
+
1466
+ class ListAgentsFallbackModelConfigurationAgentsRetryTypedDict(TypedDict):
1467
+ r"""Retry configuration for the request"""
1468
+
1469
+ count: NotRequired[float]
1470
+ r"""Number of retry attempts (1-5)"""
1471
+ on_codes: NotRequired[List[float]]
1472
+ r"""HTTP status codes that trigger retry logic"""
1473
+
1474
+
1475
+ class ListAgentsFallbackModelConfigurationAgentsRetry(BaseModel):
1476
+ r"""Retry configuration for the request"""
1477
+
1478
+ count: Optional[float] = 3
1479
+ r"""Number of retry attempts (1-5)"""
1480
+
1481
+ on_codes: Optional[List[float]] = None
1482
+ r"""HTTP status codes that trigger retry logic"""
1483
+
1484
+ @model_serializer(mode="wrap")
1485
+ def serialize_model(self, handler):
1486
+ optional_fields = set(["count", "on_codes"])
1487
+ serialized = handler(self)
1488
+ m = {}
1489
+
1490
+ for n, f in type(self).model_fields.items():
1491
+ k = f.alias or n
1492
+ val = serialized.get(k)
1493
+
1494
+ if val != UNSET_SENTINEL:
1495
+ if val is not None or k not in optional_fields:
1496
+ m[k] = val
1497
+
1498
+ return m
1499
+
1500
+
1501
+ ListAgentsFallbackModelConfigurationType = Literal["exact_match",]
1502
+
1503
+
1504
+ class ListAgentsFallbackModelConfigurationCacheTypedDict(TypedDict):
1505
+ r"""Cache configuration for the request."""
1506
+
1507
+ type: ListAgentsFallbackModelConfigurationType
1508
+ ttl: NotRequired[float]
1509
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1510
+
1511
+
1512
+ class ListAgentsFallbackModelConfigurationCache(BaseModel):
1513
+ r"""Cache configuration for the request."""
1514
+
1515
+ type: ListAgentsFallbackModelConfigurationType
1516
+
1517
+ ttl: Optional[float] = 1800
1518
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1519
+
1520
+ @model_serializer(mode="wrap")
1521
+ def serialize_model(self, handler):
1522
+ optional_fields = set(["ttl"])
1523
+ serialized = handler(self)
1524
+ m = {}
1525
+
1526
+ for n, f in type(self).model_fields.items():
1527
+ k = f.alias or n
1528
+ val = serialized.get(k)
1529
+
1530
+ if val != UNSET_SENTINEL:
1531
+ if val is not None or k not in optional_fields:
1532
+ m[k] = val
1533
+
1534
+ return m
1535
+
1536
+
1537
+ ListAgentsLoadBalancerAgentsType = Literal["weight_based",]
1538
+
1539
+
1540
+ class ListAgentsLoadBalancerAgentsModelsTypedDict(TypedDict):
1541
+ model: str
1542
+ r"""Model identifier for load balancing"""
1543
+ weight: NotRequired[float]
1544
+ r"""Weight assigned to this model for load balancing"""
1545
+
1546
+
1547
+ class ListAgentsLoadBalancerAgentsModels(BaseModel):
1548
+ model: str
1549
+ r"""Model identifier for load balancing"""
1550
+
1551
+ weight: Optional[float] = 0.5
1552
+ r"""Weight assigned to this model for load balancing"""
1553
+
1554
+ @model_serializer(mode="wrap")
1555
+ def serialize_model(self, handler):
1556
+ optional_fields = set(["weight"])
1557
+ serialized = handler(self)
1558
+ m = {}
1559
+
1560
+ for n, f in type(self).model_fields.items():
1561
+ k = f.alias or n
1562
+ val = serialized.get(k)
1563
+
1564
+ if val != UNSET_SENTINEL:
1565
+ if val is not None or k not in optional_fields:
1566
+ m[k] = val
1567
+
1568
+ return m
1569
+
1570
+
1571
+ class ListAgentsLoadBalancerAgents1TypedDict(TypedDict):
1572
+ type: ListAgentsLoadBalancerAgentsType
1573
+ models: List[ListAgentsLoadBalancerAgentsModelsTypedDict]
1574
+
1575
+
1576
+ class ListAgentsLoadBalancerAgents1(BaseModel):
1577
+ type: ListAgentsLoadBalancerAgentsType
1578
+
1579
+ models: List[ListAgentsLoadBalancerAgentsModels]
1580
+
1581
+
1582
+ ListAgentsFallbackModelConfigurationLoadBalancerTypedDict = (
1583
+ ListAgentsLoadBalancerAgents1TypedDict
1584
+ )
1585
+ r"""Load balancer configuration for the request."""
1586
+
1587
+
1588
+ ListAgentsFallbackModelConfigurationLoadBalancer = ListAgentsLoadBalancerAgents1
1589
+ r"""Load balancer configuration for the request."""
1590
+
1591
+
1592
+ class ListAgentsFallbackModelConfigurationTimeoutTypedDict(TypedDict):
1593
+ 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."""
1594
+
1595
+ call_timeout: float
1596
+ r"""Timeout value in milliseconds"""
1597
+
1598
+
1599
+ class ListAgentsFallbackModelConfigurationTimeout(BaseModel):
1600
+ 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."""
1601
+
1602
+ call_timeout: float
1603
+ r"""Timeout value in milliseconds"""
1604
+
1605
+
1062
1606
  class ListAgentsFallbackModelConfigurationParametersTypedDict(TypedDict):
1063
1607
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1064
1608
 
1609
+ name: NotRequired[str]
1610
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
1065
1611
  audio: NotRequired[Nullable[ListAgentsFallbackModelConfigurationAudioTypedDict]]
1066
1612
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
1067
1613
  frequency_penalty: NotRequired[Nullable[float]]
@@ -1124,11 +1670,26 @@ class ListAgentsFallbackModelConfigurationParametersTypedDict(TypedDict):
1124
1670
  List[ListAgentsFallbackModelConfigurationGuardrailsTypedDict]
1125
1671
  ]
1126
1672
  r"""A list of guardrails to apply to the request."""
1673
+ fallbacks: NotRequired[List[ListAgentsFallbackModelConfigurationFallbacksTypedDict]]
1674
+ r"""Array of fallback models to use if primary model fails"""
1675
+ retry: NotRequired[ListAgentsFallbackModelConfigurationAgentsRetryTypedDict]
1676
+ r"""Retry configuration for the request"""
1677
+ cache: NotRequired[ListAgentsFallbackModelConfigurationCacheTypedDict]
1678
+ r"""Cache configuration for the request."""
1679
+ load_balancer: NotRequired[
1680
+ ListAgentsFallbackModelConfigurationLoadBalancerTypedDict
1681
+ ]
1682
+ r"""Load balancer configuration for the request."""
1683
+ timeout: NotRequired[ListAgentsFallbackModelConfigurationTimeoutTypedDict]
1684
+ 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."""
1127
1685
 
1128
1686
 
1129
1687
  class ListAgentsFallbackModelConfigurationParameters(BaseModel):
1130
1688
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1131
1689
 
1690
+ name: Optional[str] = None
1691
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
1692
+
1132
1693
  audio: OptionalNullable[ListAgentsFallbackModelConfigurationAudio] = UNSET
1133
1694
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
1134
1695
 
@@ -1211,72 +1772,92 @@ class ListAgentsFallbackModelConfigurationParameters(BaseModel):
1211
1772
  guardrails: Optional[List[ListAgentsFallbackModelConfigurationGuardrails]] = None
1212
1773
  r"""A list of guardrails to apply to the request."""
1213
1774
 
1775
+ fallbacks: Optional[List[ListAgentsFallbackModelConfigurationFallbacks]] = None
1776
+ r"""Array of fallback models to use if primary model fails"""
1777
+
1778
+ retry: Optional[ListAgentsFallbackModelConfigurationAgentsRetry] = None
1779
+ r"""Retry configuration for the request"""
1780
+
1781
+ cache: Optional[ListAgentsFallbackModelConfigurationCache] = None
1782
+ r"""Cache configuration for the request."""
1783
+
1784
+ load_balancer: Optional[ListAgentsFallbackModelConfigurationLoadBalancer] = None
1785
+ r"""Load balancer configuration for the request."""
1786
+
1787
+ timeout: Optional[ListAgentsFallbackModelConfigurationTimeout] = None
1788
+ 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."""
1789
+
1214
1790
  @model_serializer(mode="wrap")
1215
1791
  def serialize_model(self, handler):
1216
- optional_fields = [
1217
- "audio",
1218
- "frequency_penalty",
1219
- "max_tokens",
1220
- "max_completion_tokens",
1221
- "logprobs",
1222
- "top_logprobs",
1223
- "n",
1224
- "presence_penalty",
1225
- "response_format",
1226
- "reasoning_effort",
1227
- "verbosity",
1228
- "seed",
1229
- "stop",
1230
- "stream_options",
1231
- "thinking",
1232
- "temperature",
1233
- "top_p",
1234
- "top_k",
1235
- "tool_choice",
1236
- "parallel_tool_calls",
1237
- "modalities",
1238
- "guardrails",
1239
- ]
1240
- nullable_fields = [
1241
- "audio",
1242
- "frequency_penalty",
1243
- "max_tokens",
1244
- "max_completion_tokens",
1245
- "logprobs",
1246
- "top_logprobs",
1247
- "n",
1248
- "presence_penalty",
1249
- "seed",
1250
- "stop",
1251
- "stream_options",
1252
- "temperature",
1253
- "top_p",
1254
- "top_k",
1255
- "modalities",
1256
- ]
1257
- null_default_fields = []
1258
-
1792
+ optional_fields = set(
1793
+ [
1794
+ "name",
1795
+ "audio",
1796
+ "frequency_penalty",
1797
+ "max_tokens",
1798
+ "max_completion_tokens",
1799
+ "logprobs",
1800
+ "top_logprobs",
1801
+ "n",
1802
+ "presence_penalty",
1803
+ "response_format",
1804
+ "reasoning_effort",
1805
+ "verbosity",
1806
+ "seed",
1807
+ "stop",
1808
+ "stream_options",
1809
+ "thinking",
1810
+ "temperature",
1811
+ "top_p",
1812
+ "top_k",
1813
+ "tool_choice",
1814
+ "parallel_tool_calls",
1815
+ "modalities",
1816
+ "guardrails",
1817
+ "fallbacks",
1818
+ "retry",
1819
+ "cache",
1820
+ "load_balancer",
1821
+ "timeout",
1822
+ ]
1823
+ )
1824
+ nullable_fields = set(
1825
+ [
1826
+ "audio",
1827
+ "frequency_penalty",
1828
+ "max_tokens",
1829
+ "max_completion_tokens",
1830
+ "logprobs",
1831
+ "top_logprobs",
1832
+ "n",
1833
+ "presence_penalty",
1834
+ "seed",
1835
+ "stop",
1836
+ "stream_options",
1837
+ "temperature",
1838
+ "top_p",
1839
+ "top_k",
1840
+ "modalities",
1841
+ ]
1842
+ )
1259
1843
  serialized = handler(self)
1260
-
1261
1844
  m = {}
1262
1845
 
1263
1846
  for n, f in type(self).model_fields.items():
1264
1847
  k = f.alias or n
1265
1848
  val = serialized.get(k)
1266
- serialized.pop(k, None)
1267
-
1268
- optional_nullable = k in optional_fields and k in nullable_fields
1269
- is_set = (
1270
- self.__pydantic_fields_set__.intersection({n})
1271
- or k in null_default_fields
1272
- ) # pylint: disable=no-member
1273
-
1274
- if val is not None and val != UNSET_SENTINEL:
1275
- m[k] = val
1276
- elif val != UNSET_SENTINEL and (
1277
- not k in optional_fields or (optional_nullable and is_set)
1278
- ):
1279
- m[k] = val
1849
+ is_nullable_and_explicitly_set = (
1850
+ k in nullable_fields
1851
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
1852
+ )
1853
+
1854
+ if val != UNSET_SENTINEL:
1855
+ if (
1856
+ val is not None
1857
+ or k not in optional_fields
1858
+ or is_nullable_and_explicitly_set
1859
+ ):
1860
+ m[k] = val
1280
1861
 
1281
1862
  return m
1282
1863
 
@@ -1299,6 +1880,22 @@ class ListAgentsFallbackModelConfigurationRetry(BaseModel):
1299
1880
  on_codes: Optional[List[float]] = None
1300
1881
  r"""HTTP status codes that trigger retry logic"""
1301
1882
 
1883
+ @model_serializer(mode="wrap")
1884
+ def serialize_model(self, handler):
1885
+ optional_fields = set(["count", "on_codes"])
1886
+ serialized = handler(self)
1887
+ m = {}
1888
+
1889
+ for n, f in type(self).model_fields.items():
1890
+ k = f.alias or n
1891
+ val = serialized.get(k)
1892
+
1893
+ if val != UNSET_SENTINEL:
1894
+ if val is not None or k not in optional_fields:
1895
+ m[k] = val
1896
+
1897
+ return m
1898
+
1302
1899
 
1303
1900
  class ListAgentsFallbackModelConfiguration2TypedDict(TypedDict):
1304
1901
  r"""Fallback model configuration with optional parameters and retry settings."""
@@ -1323,6 +1920,22 @@ class ListAgentsFallbackModelConfiguration2(BaseModel):
1323
1920
  retry: Optional[ListAgentsFallbackModelConfigurationRetry] = None
1324
1921
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1325
1922
 
1923
+ @model_serializer(mode="wrap")
1924
+ def serialize_model(self, handler):
1925
+ optional_fields = set(["parameters", "retry"])
1926
+ serialized = handler(self)
1927
+ m = {}
1928
+
1929
+ for n, f in type(self).model_fields.items():
1930
+ k = f.alias or n
1931
+ val = serialized.get(k)
1932
+
1933
+ if val != UNSET_SENTINEL:
1934
+ if val is not None or k not in optional_fields:
1935
+ m[k] = val
1936
+
1937
+ return m
1938
+
1326
1939
 
1327
1940
  ListAgentsFallbackModelConfigurationTypedDict = TypeAliasType(
1328
1941
  "ListAgentsFallbackModelConfigurationTypedDict",
@@ -1373,31 +1986,28 @@ class ListAgentsModel(BaseModel):
1373
1986
 
1374
1987
  @model_serializer(mode="wrap")
1375
1988
  def serialize_model(self, handler):
1376
- optional_fields = ["integration_id", "parameters", "retry", "fallback_models"]
1377
- nullable_fields = ["integration_id", "fallback_models"]
1378
- null_default_fields = []
1379
-
1989
+ optional_fields = set(
1990
+ ["integration_id", "parameters", "retry", "fallback_models"]
1991
+ )
1992
+ nullable_fields = set(["integration_id", "fallback_models"])
1380
1993
  serialized = handler(self)
1381
-
1382
1994
  m = {}
1383
1995
 
1384
1996
  for n, f in type(self).model_fields.items():
1385
1997
  k = f.alias or n
1386
1998
  val = serialized.get(k)
1387
- serialized.pop(k, None)
1388
-
1389
- optional_nullable = k in optional_fields and k in nullable_fields
1390
- is_set = (
1391
- self.__pydantic_fields_set__.intersection({n})
1392
- or k in null_default_fields
1393
- ) # pylint: disable=no-member
1394
-
1395
- if val is not None and val != UNSET_SENTINEL:
1396
- m[k] = val
1397
- elif val != UNSET_SENTINEL and (
1398
- not k in optional_fields or (optional_nullable and is_set)
1399
- ):
1400
- m[k] = val
1999
+ is_nullable_and_explicitly_set = (
2000
+ k in nullable_fields
2001
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
2002
+ )
2003
+
2004
+ if val != UNSET_SENTINEL:
2005
+ if (
2006
+ val is not None
2007
+ or k not in optional_fields
2008
+ or is_nullable_and_explicitly_set
2009
+ ):
2010
+ m[k] = val
1401
2011
 
1402
2012
  return m
1403
2013
 
@@ -1416,6 +2026,22 @@ class ListAgentsTeamOfAgents(BaseModel):
1416
2026
  role: Optional[str] = None
1417
2027
  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."""
1418
2028
 
2029
+ @model_serializer(mode="wrap")
2030
+ def serialize_model(self, handler):
2031
+ optional_fields = set(["role"])
2032
+ serialized = handler(self)
2033
+ m = {}
2034
+
2035
+ for n, f in type(self).model_fields.items():
2036
+ k = f.alias or n
2037
+ val = serialized.get(k)
2038
+
2039
+ if val != UNSET_SENTINEL:
2040
+ if val is not None or k not in optional_fields:
2041
+ m[k] = val
2042
+
2043
+ return m
2044
+
1419
2045
 
1420
2046
  class ListAgentsMetricsTypedDict(TypedDict):
1421
2047
  total_cost: NotRequired[float]
@@ -1424,6 +2050,22 @@ class ListAgentsMetricsTypedDict(TypedDict):
1424
2050
  class ListAgentsMetrics(BaseModel):
1425
2051
  total_cost: Optional[float] = 0
1426
2052
 
2053
+ @model_serializer(mode="wrap")
2054
+ def serialize_model(self, handler):
2055
+ optional_fields = set(["total_cost"])
2056
+ serialized = handler(self)
2057
+ m = {}
2058
+
2059
+ for n, f in type(self).model_fields.items():
2060
+ k = f.alias or n
2061
+ val = serialized.get(k)
2062
+
2063
+ if val != UNSET_SENTINEL:
2064
+ if val is not None or k not in optional_fields:
2065
+ m[k] = val
2066
+
2067
+ return m
2068
+
1427
2069
 
1428
2070
  class ListAgentsKnowledgeBasesTypedDict(TypedDict):
1429
2071
  knowledge_id: str
@@ -1538,43 +2180,40 @@ class ListAgentsData(BaseModel):
1538
2180
 
1539
2181
  @model_serializer(mode="wrap")
1540
2182
  def serialize_model(self, handler):
1541
- optional_fields = [
1542
- "created_by_id",
1543
- "updated_by_id",
1544
- "created",
1545
- "updated",
1546
- "system_prompt",
1547
- "settings",
1548
- "version_hash",
1549
- "metrics",
1550
- "variables",
1551
- "knowledge_bases",
1552
- "source",
1553
- ]
1554
- nullable_fields = ["created_by_id", "updated_by_id"]
1555
- null_default_fields = []
1556
-
2183
+ optional_fields = set(
2184
+ [
2185
+ "created_by_id",
2186
+ "updated_by_id",
2187
+ "created",
2188
+ "updated",
2189
+ "system_prompt",
2190
+ "settings",
2191
+ "version_hash",
2192
+ "metrics",
2193
+ "variables",
2194
+ "knowledge_bases",
2195
+ "source",
2196
+ ]
2197
+ )
2198
+ nullable_fields = set(["created_by_id", "updated_by_id"])
1557
2199
  serialized = handler(self)
1558
-
1559
2200
  m = {}
1560
2201
 
1561
2202
  for n, f in type(self).model_fields.items():
1562
2203
  k = f.alias or n
1563
2204
  val = serialized.get(k)
1564
- serialized.pop(k, None)
1565
-
1566
- optional_nullable = k in optional_fields and k in nullable_fields
1567
- is_set = (
1568
- self.__pydantic_fields_set__.intersection({n})
1569
- or k in null_default_fields
1570
- ) # pylint: disable=no-member
1571
-
1572
- if val is not None and val != UNSET_SENTINEL:
1573
- m[k] = val
1574
- elif val != UNSET_SENTINEL and (
1575
- not k in optional_fields or (optional_nullable and is_set)
1576
- ):
1577
- m[k] = val
2205
+ is_nullable_and_explicitly_set = (
2206
+ k in nullable_fields
2207
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
2208
+ )
2209
+
2210
+ if val != UNSET_SENTINEL:
2211
+ if (
2212
+ val is not None
2213
+ or k not in optional_fields
2214
+ or is_nullable_and_explicitly_set
2215
+ ):
2216
+ m[k] = val
1578
2217
 
1579
2218
  return m
1580
2219