orq-ai-sdk 4.2.0rc48__py3-none-any.whl → 4.2.12__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 (103) hide show
  1. orq_ai_sdk/_hooks/globalhook.py +0 -1
  2. orq_ai_sdk/_version.py +3 -3
  3. orq_ai_sdk/audio.py +30 -0
  4. orq_ai_sdk/chat.py +22 -0
  5. orq_ai_sdk/completions.py +438 -0
  6. orq_ai_sdk/contacts.py +43 -886
  7. orq_ai_sdk/deployments.py +61 -0
  8. orq_ai_sdk/edits.py +364 -0
  9. orq_ai_sdk/embeddings.py +344 -0
  10. orq_ai_sdk/generations.py +370 -0
  11. orq_ai_sdk/images.py +28 -0
  12. orq_ai_sdk/models/__init__.py +3839 -424
  13. orq_ai_sdk/models/conversationresponse.py +1 -1
  14. orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
  15. orq_ai_sdk/models/createagentrequestop.py +768 -12
  16. orq_ai_sdk/models/createagentresponse.py +68 -2
  17. orq_ai_sdk/models/createchatcompletionop.py +538 -313
  18. orq_ai_sdk/models/createcompletionop.py +2078 -0
  19. orq_ai_sdk/models/createcontactop.py +5 -10
  20. orq_ai_sdk/models/createconversationop.py +1 -1
  21. orq_ai_sdk/models/createconversationresponseop.py +2 -2
  22. orq_ai_sdk/models/createdatasetitemop.py +4 -4
  23. orq_ai_sdk/models/createdatasetop.py +1 -1
  24. orq_ai_sdk/models/createdatasourceop.py +1 -1
  25. orq_ai_sdk/models/createembeddingop.py +579 -0
  26. orq_ai_sdk/models/createevalop.py +14 -14
  27. orq_ai_sdk/models/createidentityop.py +1 -1
  28. orq_ai_sdk/models/createimageeditop.py +715 -0
  29. orq_ai_sdk/models/createimageop.py +228 -82
  30. orq_ai_sdk/models/createimagevariationop.py +706 -0
  31. orq_ai_sdk/models/creatememoryop.py +4 -2
  32. orq_ai_sdk/models/createmoderationop.py +521 -0
  33. orq_ai_sdk/models/createpromptop.py +375 -6
  34. orq_ai_sdk/models/creatererankop.py +608 -0
  35. orq_ai_sdk/models/createresponseop.py +2567 -0
  36. orq_ai_sdk/models/createspeechop.py +466 -0
  37. orq_ai_sdk/models/createtoolop.py +6 -6
  38. orq_ai_sdk/models/createtranscriptionop.py +732 -0
  39. orq_ai_sdk/models/createtranslationop.py +702 -0
  40. orq_ai_sdk/models/deploymentgetconfigop.py +17 -7
  41. orq_ai_sdk/models/deploymentsop.py +1 -0
  42. orq_ai_sdk/models/deploymentstreamop.py +7 -0
  43. orq_ai_sdk/models/filegetop.py +1 -1
  44. orq_ai_sdk/models/filelistop.py +1 -1
  45. orq_ai_sdk/models/fileuploadop.py +1 -1
  46. orq_ai_sdk/models/generateconversationnameop.py +1 -1
  47. orq_ai_sdk/models/getallmemoriesop.py +4 -2
  48. orq_ai_sdk/models/getallpromptsop.py +188 -3
  49. orq_ai_sdk/models/getalltoolsop.py +6 -6
  50. orq_ai_sdk/models/getevalsop.py +17 -17
  51. orq_ai_sdk/models/getonepromptop.py +188 -3
  52. orq_ai_sdk/models/getpromptversionop.py +188 -3
  53. orq_ai_sdk/models/invokedeploymentrequest.py +11 -4
  54. orq_ai_sdk/models/listagentsop.py +372 -0
  55. orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
  56. orq_ai_sdk/models/listdatasetsop.py +1 -1
  57. orq_ai_sdk/models/listdatasourcesop.py +1 -1
  58. orq_ai_sdk/models/listidentitiesop.py +1 -1
  59. orq_ai_sdk/models/listmodelsop.py +1 -0
  60. orq_ai_sdk/models/listpromptversionsop.py +188 -3
  61. orq_ai_sdk/models/partdoneevent.py +1 -1
  62. orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
  63. orq_ai_sdk/models/publiccontact.py +9 -3
  64. orq_ai_sdk/models/publicidentity.py +62 -0
  65. orq_ai_sdk/models/reasoningpart.py +1 -1
  66. orq_ai_sdk/models/responsedoneevent.py +14 -11
  67. orq_ai_sdk/models/retrieveagentrequestop.py +382 -0
  68. orq_ai_sdk/models/retrievedatapointop.py +4 -4
  69. orq_ai_sdk/models/retrievedatasetop.py +1 -1
  70. orq_ai_sdk/models/retrievedatasourceop.py +1 -1
  71. orq_ai_sdk/models/retrieveidentityop.py +1 -1
  72. orq_ai_sdk/models/retrievememoryop.py +4 -2
  73. orq_ai_sdk/models/retrievetoolop.py +6 -6
  74. orq_ai_sdk/models/runagentop.py +379 -9
  75. orq_ai_sdk/models/streamrunagentop.py +385 -9
  76. orq_ai_sdk/models/updateagentop.py +770 -12
  77. orq_ai_sdk/models/updateconversationop.py +1 -1
  78. orq_ai_sdk/models/updatedatapointop.py +4 -4
  79. orq_ai_sdk/models/updatedatasetop.py +1 -1
  80. orq_ai_sdk/models/updatedatasourceop.py +1 -1
  81. orq_ai_sdk/models/updateevalop.py +14 -14
  82. orq_ai_sdk/models/updateidentityop.py +1 -1
  83. orq_ai_sdk/models/updatememoryop.py +4 -2
  84. orq_ai_sdk/models/updatepromptop.py +375 -6
  85. orq_ai_sdk/models/updatetoolop.py +7 -7
  86. orq_ai_sdk/moderations.py +218 -0
  87. orq_ai_sdk/orq_completions.py +666 -0
  88. orq_ai_sdk/orq_responses.py +398 -0
  89. orq_ai_sdk/rerank.py +330 -0
  90. orq_ai_sdk/router.py +89 -641
  91. orq_ai_sdk/speech.py +333 -0
  92. orq_ai_sdk/transcriptions.py +416 -0
  93. orq_ai_sdk/translations.py +384 -0
  94. orq_ai_sdk/variations.py +364 -0
  95. orq_ai_sdk-4.2.12.dist-info/METADATA +888 -0
  96. {orq_ai_sdk-4.2.0rc48.dist-info → orq_ai_sdk-4.2.12.dist-info}/RECORD +98 -75
  97. {orq_ai_sdk-4.2.0rc48.dist-info → orq_ai_sdk-4.2.12.dist-info}/WHEEL +1 -1
  98. orq_ai_sdk/models/deletecontactop.py +0 -44
  99. orq_ai_sdk/models/listcontactsop.py +0 -265
  100. orq_ai_sdk/models/retrievecontactop.py +0 -142
  101. orq_ai_sdk/models/updatecontactop.py +0 -233
  102. orq_ai_sdk-4.2.0rc48.dist-info/METADATA +0 -788
  103. {orq_ai_sdk-4.2.0rc48.dist-info → orq_ai_sdk-4.2.12.dist-info}/top_level.txt +0 -0
@@ -81,7 +81,7 @@ class RetrieveDatasetResponseBody(BaseModel):
81
81
  created: Optional[datetime] = None
82
82
  r"""The date and time the resource was created"""
83
83
 
84
- updated: Optional[datetime] = parse_datetime("2026-01-20T13:00:20.021Z")
84
+ updated: Optional[datetime] = parse_datetime("2026-01-27T09:10:34.517Z")
85
85
  r"""The date and time the resource was last updated"""
86
86
 
87
87
  @model_serializer(mode="wrap")
@@ -90,7 +90,7 @@ class RetrieveDatasourceResponseBody(BaseModel):
90
90
  r"""The number of chunks in the datasource"""
91
91
 
92
92
  id: Annotated[Optional[str], pydantic.Field(alias="_id")] = (
93
- "01KFDQW6KSCQPGDN54DM6JRNRN"
93
+ "01KFZBGG96WJ7P91349B0NCQJ5"
94
94
  )
95
95
  r"""The unique identifier of the data source"""
96
96
 
@@ -103,7 +103,7 @@ class RetrieveIdentityResponseBody(BaseModel):
103
103
  created: Optional[datetime] = None
104
104
  r"""The date and time the resource was created"""
105
105
 
106
- updated: Optional[datetime] = parse_datetime("2026-01-20T13:00:20.021Z")
106
+ updated: Optional[datetime] = parse_datetime("2026-01-27T09:10:34.517Z")
107
107
  r"""The date and time the resource was last updated"""
108
108
 
109
109
  @model_serializer(mode="wrap")
@@ -37,8 +37,9 @@ class RetrieveMemoryResponseBodyTypedDict(TypedDict):
37
37
  r"""Memory successfully retrieved."""
38
38
 
39
39
  id: str
40
+ r"""Unique identifier for the memory. This is automatically generated by the system."""
40
41
  entity_id: str
41
- r"""This property have been deprecated and moved to `_id`. Please refer to `_id` for future operations"""
42
+ r"""Customer provided entity ID for the memory. This is used to link the memory to a specific user/company/session/etc. Has to be unique within the memory store."""
42
43
  created: str
43
44
  updated: str
44
45
  store_id: str
@@ -53,6 +54,7 @@ class RetrieveMemoryResponseBody(BaseModel):
53
54
  r"""Memory successfully retrieved."""
54
55
 
55
56
  id: Annotated[str, pydantic.Field(alias="_id")]
57
+ r"""Unique identifier for the memory. This is automatically generated by the system."""
56
58
 
57
59
  entity_id: Annotated[
58
60
  str,
@@ -60,7 +62,7 @@ class RetrieveMemoryResponseBody(BaseModel):
60
62
  deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
61
63
  ),
62
64
  ]
63
- r"""This property have been deprecated and moved to `_id`. Please refer to `_id` for future operations"""
65
+ r"""Customer provided entity ID for the memory. This is used to link the memory to a specific user/company/session/etc. Has to be unique within the memory store."""
64
66
 
65
67
  created: str
66
68
 
@@ -171,7 +171,7 @@ class RetrieveToolResponseBodyCodeExecutionTool(BaseModel):
171
171
  code_tool: RetrieveToolResponseBodyCodeTool
172
172
 
173
173
  id: Annotated[Optional[str], pydantic.Field(alias="_id")] = (
174
- "tool_01KFDQW6FZM1GMF9GGSCQ23NQF"
174
+ "tool_01KFZBGG604CGG7H53H4C239C3"
175
175
  )
176
176
 
177
177
  display_name: Optional[str] = None
@@ -302,7 +302,7 @@ class RetrieveToolResponseBodyTools(BaseModel):
302
302
  RetrieveToolResponseBodyToolsSchema, pydantic.Field(alias="schema")
303
303
  ]
304
304
 
305
- id: Optional[str] = "01KFDQW6FYH2DTV2TFN6WJ8KJB"
305
+ id: Optional[str] = "01KFZBGG5ZVG9PC6BRP0GD93XP"
306
306
 
307
307
  description: Optional[str] = None
308
308
 
@@ -433,7 +433,7 @@ class RetrieveToolResponseBodyMCPTool(BaseModel):
433
433
  mcp: RetrieveToolResponseBodyMcp
434
434
 
435
435
  id: Annotated[Optional[str], pydantic.Field(alias="_id")] = (
436
- "tool_01KFDQW6FXHJK2ZBQ31SS9ERJT"
436
+ "tool_01KFZBGG5YBT50YCBTZ8XS31TR"
437
437
  )
438
438
 
439
439
  display_name: Optional[str] = None
@@ -734,7 +734,7 @@ class RetrieveToolResponseBodyHTTPTool(BaseModel):
734
734
  http: RetrieveToolResponseBodyHTTP
735
735
 
736
736
  id: Annotated[Optional[str], pydantic.Field(alias="_id")] = (
737
- "tool_01KFDQW6FVKKJKZ74KTGPA6159"
737
+ "tool_01KFZBGG5WCA0DTA0WHVWVWDEK"
738
738
  )
739
739
 
740
740
  display_name: Optional[str] = None
@@ -929,7 +929,7 @@ class RetrieveToolResponseBodyJSONSchemaTool(BaseModel):
929
929
  json_schema: RetrieveToolResponseBodyJSONSchema
930
930
 
931
931
  id: Annotated[Optional[str], pydantic.Field(alias="_id")] = (
932
- "tool_01KFDQW6FT6DTW2D8J75SWBZEK"
932
+ "tool_01KFZBGG5TYCZC00XA0DN9ZD6X"
933
933
  )
934
934
 
935
935
  display_name: Optional[str] = None
@@ -1128,7 +1128,7 @@ class RetrieveToolResponseBodyFunctionTool(BaseModel):
1128
1128
  function: RetrieveToolResponseBodyFunction
1129
1129
 
1130
1130
  id: Annotated[Optional[str], pydantic.Field(alias="_id")] = (
1131
- "tool_01KFDQW6FS48981SVSNKZ0XKT6"
1131
+ "tool_01KFZBGG5REZQNNMMPKS6DVS8V"
1132
1132
  )
1133
1133
 
1134
1134
  display_name: Optional[str] = None
@@ -388,9 +388,159 @@ class RunAgentModelConfigurationGuardrails(BaseModel):
388
388
  r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
389
389
 
390
390
 
391
+ class RunAgentModelConfigurationFallbacksTypedDict(TypedDict):
392
+ model: str
393
+ r"""Fallback model identifier"""
394
+
395
+
396
+ class RunAgentModelConfigurationFallbacks(BaseModel):
397
+ model: str
398
+ r"""Fallback model identifier"""
399
+
400
+
401
+ class RunAgentModelConfigurationRetryTypedDict(TypedDict):
402
+ r"""Retry configuration for the request"""
403
+
404
+ count: NotRequired[float]
405
+ r"""Number of retry attempts (1-5)"""
406
+ on_codes: NotRequired[List[float]]
407
+ r"""HTTP status codes that trigger retry logic"""
408
+
409
+
410
+ class RunAgentModelConfigurationRetry(BaseModel):
411
+ r"""Retry configuration for the request"""
412
+
413
+ count: Optional[float] = 3
414
+ r"""Number of retry attempts (1-5)"""
415
+
416
+ on_codes: Optional[List[float]] = None
417
+ r"""HTTP status codes that trigger retry logic"""
418
+
419
+ @model_serializer(mode="wrap")
420
+ def serialize_model(self, handler):
421
+ optional_fields = set(["count", "on_codes"])
422
+ serialized = handler(self)
423
+ m = {}
424
+
425
+ for n, f in type(self).model_fields.items():
426
+ k = f.alias or n
427
+ val = serialized.get(k)
428
+
429
+ if val != UNSET_SENTINEL:
430
+ if val is not None or k not in optional_fields:
431
+ m[k] = val
432
+
433
+ return m
434
+
435
+
436
+ RunAgentModelConfigurationType = Literal["exact_match",]
437
+
438
+
439
+ class RunAgentModelConfigurationCacheTypedDict(TypedDict):
440
+ r"""Cache configuration for the request."""
441
+
442
+ type: RunAgentModelConfigurationType
443
+ ttl: NotRequired[float]
444
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
445
+
446
+
447
+ class RunAgentModelConfigurationCache(BaseModel):
448
+ r"""Cache configuration for the request."""
449
+
450
+ type: RunAgentModelConfigurationType
451
+
452
+ ttl: Optional[float] = 1800
453
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
454
+
455
+ @model_serializer(mode="wrap")
456
+ def serialize_model(self, handler):
457
+ optional_fields = set(["ttl"])
458
+ serialized = handler(self)
459
+ m = {}
460
+
461
+ for n, f in type(self).model_fields.items():
462
+ k = f.alias or n
463
+ val = serialized.get(k)
464
+
465
+ if val != UNSET_SENTINEL:
466
+ if val is not None or k not in optional_fields:
467
+ m[k] = val
468
+
469
+ return m
470
+
471
+
472
+ RunAgentLoadBalancerType = Literal["weight_based",]
473
+
474
+
475
+ class RunAgentLoadBalancerModelsTypedDict(TypedDict):
476
+ model: str
477
+ r"""Model identifier for load balancing"""
478
+ weight: NotRequired[float]
479
+ r"""Weight assigned to this model for load balancing"""
480
+
481
+
482
+ class RunAgentLoadBalancerModels(BaseModel):
483
+ model: str
484
+ r"""Model identifier for load balancing"""
485
+
486
+ weight: Optional[float] = 0.5
487
+ r"""Weight assigned to this model for load balancing"""
488
+
489
+ @model_serializer(mode="wrap")
490
+ def serialize_model(self, handler):
491
+ optional_fields = set(["weight"])
492
+ serialized = handler(self)
493
+ m = {}
494
+
495
+ for n, f in type(self).model_fields.items():
496
+ k = f.alias or n
497
+ val = serialized.get(k)
498
+
499
+ if val != UNSET_SENTINEL:
500
+ if val is not None or k not in optional_fields:
501
+ m[k] = val
502
+
503
+ return m
504
+
505
+
506
+ class RunAgentLoadBalancer1TypedDict(TypedDict):
507
+ type: RunAgentLoadBalancerType
508
+ models: List[RunAgentLoadBalancerModelsTypedDict]
509
+
510
+
511
+ class RunAgentLoadBalancer1(BaseModel):
512
+ type: RunAgentLoadBalancerType
513
+
514
+ models: List[RunAgentLoadBalancerModels]
515
+
516
+
517
+ RunAgentModelConfigurationLoadBalancerTypedDict = RunAgentLoadBalancer1TypedDict
518
+ r"""Load balancer configuration for the request."""
519
+
520
+
521
+ RunAgentModelConfigurationLoadBalancer = RunAgentLoadBalancer1
522
+ r"""Load balancer configuration for the request."""
523
+
524
+
525
+ class RunAgentModelConfigurationTimeoutTypedDict(TypedDict):
526
+ 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."""
527
+
528
+ call_timeout: float
529
+ r"""Timeout value in milliseconds"""
530
+
531
+
532
+ class RunAgentModelConfigurationTimeout(BaseModel):
533
+ 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."""
534
+
535
+ call_timeout: float
536
+ r"""Timeout value in milliseconds"""
537
+
538
+
391
539
  class RunAgentModelConfigurationParametersTypedDict(TypedDict):
392
540
  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."""
393
541
 
542
+ name: NotRequired[str]
543
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
394
544
  audio: NotRequired[Nullable[RunAgentModelConfigurationAudioTypedDict]]
395
545
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
396
546
  frequency_penalty: NotRequired[Nullable[float]]
@@ -447,11 +597,24 @@ class RunAgentModelConfigurationParametersTypedDict(TypedDict):
447
597
  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\"]."""
448
598
  guardrails: NotRequired[List[RunAgentModelConfigurationGuardrailsTypedDict]]
449
599
  r"""A list of guardrails to apply to the request."""
600
+ fallbacks: NotRequired[List[RunAgentModelConfigurationFallbacksTypedDict]]
601
+ r"""Array of fallback models to use if primary model fails"""
602
+ retry: NotRequired[RunAgentModelConfigurationRetryTypedDict]
603
+ r"""Retry configuration for the request"""
604
+ cache: NotRequired[RunAgentModelConfigurationCacheTypedDict]
605
+ r"""Cache configuration for the request."""
606
+ load_balancer: NotRequired[RunAgentModelConfigurationLoadBalancerTypedDict]
607
+ r"""Load balancer configuration for the request."""
608
+ timeout: NotRequired[RunAgentModelConfigurationTimeoutTypedDict]
609
+ 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."""
450
610
 
451
611
 
452
612
  class RunAgentModelConfigurationParameters(BaseModel):
453
613
  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."""
454
614
 
615
+ name: Optional[str] = None
616
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
617
+
455
618
  audio: OptionalNullable[RunAgentModelConfigurationAudio] = UNSET
456
619
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
457
620
 
@@ -528,10 +691,26 @@ class RunAgentModelConfigurationParameters(BaseModel):
528
691
  guardrails: Optional[List[RunAgentModelConfigurationGuardrails]] = None
529
692
  r"""A list of guardrails to apply to the request."""
530
693
 
694
+ fallbacks: Optional[List[RunAgentModelConfigurationFallbacks]] = None
695
+ r"""Array of fallback models to use if primary model fails"""
696
+
697
+ retry: Optional[RunAgentModelConfigurationRetry] = None
698
+ r"""Retry configuration for the request"""
699
+
700
+ cache: Optional[RunAgentModelConfigurationCache] = None
701
+ r"""Cache configuration for the request."""
702
+
703
+ load_balancer: Optional[RunAgentModelConfigurationLoadBalancer] = None
704
+ r"""Load balancer configuration for the request."""
705
+
706
+ timeout: Optional[RunAgentModelConfigurationTimeout] = None
707
+ 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."""
708
+
531
709
  @model_serializer(mode="wrap")
532
710
  def serialize_model(self, handler):
533
711
  optional_fields = set(
534
712
  [
713
+ "name",
535
714
  "audio",
536
715
  "frequency_penalty",
537
716
  "max_tokens",
@@ -554,6 +733,11 @@ class RunAgentModelConfigurationParameters(BaseModel):
554
733
  "parallel_tool_calls",
555
734
  "modalities",
556
735
  "guardrails",
736
+ "fallbacks",
737
+ "retry",
738
+ "cache",
739
+ "load_balancer",
740
+ "timeout",
557
741
  ]
558
742
  )
559
743
  nullable_fields = set(
@@ -597,7 +781,7 @@ class RunAgentModelConfigurationParameters(BaseModel):
597
781
  return m
598
782
 
599
783
 
600
- class RunAgentModelConfigurationRetryTypedDict(TypedDict):
784
+ class RunAgentModelConfigurationAgentsRetryTypedDict(TypedDict):
601
785
  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."""
602
786
 
603
787
  count: NotRequired[float]
@@ -606,7 +790,7 @@ class RunAgentModelConfigurationRetryTypedDict(TypedDict):
606
790
  r"""HTTP status codes that trigger retry logic"""
607
791
 
608
792
 
609
- class RunAgentModelConfigurationRetry(BaseModel):
793
+ class RunAgentModelConfigurationAgentsRetry(BaseModel):
610
794
  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."""
611
795
 
612
796
  count: Optional[float] = 3
@@ -642,7 +826,7 @@ class RunAgentModelConfiguration2TypedDict(TypedDict):
642
826
  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."""
643
827
  parameters: NotRequired[RunAgentModelConfigurationParametersTypedDict]
644
828
  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."""
645
- retry: NotRequired[RunAgentModelConfigurationRetryTypedDict]
829
+ retry: NotRequired[RunAgentModelConfigurationAgentsRetryTypedDict]
646
830
  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."""
647
831
 
648
832
 
@@ -658,7 +842,7 @@ class RunAgentModelConfiguration2(BaseModel):
658
842
  parameters: Optional[RunAgentModelConfigurationParameters] = None
659
843
  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."""
660
844
 
661
- retry: Optional[RunAgentModelConfigurationRetry] = None
845
+ retry: Optional[RunAgentModelConfigurationAgentsRetry] = None
662
846
  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."""
663
847
 
664
848
  @model_serializer(mode="wrap")
@@ -1050,9 +1234,161 @@ class RunAgentFallbackModelConfigurationGuardrails(BaseModel):
1050
1234
  r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
1051
1235
 
1052
1236
 
1237
+ class RunAgentFallbackModelConfigurationFallbacksTypedDict(TypedDict):
1238
+ model: str
1239
+ r"""Fallback model identifier"""
1240
+
1241
+
1242
+ class RunAgentFallbackModelConfigurationFallbacks(BaseModel):
1243
+ model: str
1244
+ r"""Fallback model identifier"""
1245
+
1246
+
1247
+ class RunAgentFallbackModelConfigurationRetryTypedDict(TypedDict):
1248
+ r"""Retry configuration for the request"""
1249
+
1250
+ count: NotRequired[float]
1251
+ r"""Number of retry attempts (1-5)"""
1252
+ on_codes: NotRequired[List[float]]
1253
+ r"""HTTP status codes that trigger retry logic"""
1254
+
1255
+
1256
+ class RunAgentFallbackModelConfigurationRetry(BaseModel):
1257
+ r"""Retry configuration for the request"""
1258
+
1259
+ count: Optional[float] = 3
1260
+ r"""Number of retry attempts (1-5)"""
1261
+
1262
+ on_codes: Optional[List[float]] = None
1263
+ r"""HTTP status codes that trigger retry logic"""
1264
+
1265
+ @model_serializer(mode="wrap")
1266
+ def serialize_model(self, handler):
1267
+ optional_fields = set(["count", "on_codes"])
1268
+ serialized = handler(self)
1269
+ m = {}
1270
+
1271
+ for n, f in type(self).model_fields.items():
1272
+ k = f.alias or n
1273
+ val = serialized.get(k)
1274
+
1275
+ if val != UNSET_SENTINEL:
1276
+ if val is not None or k not in optional_fields:
1277
+ m[k] = val
1278
+
1279
+ return m
1280
+
1281
+
1282
+ RunAgentFallbackModelConfigurationType = Literal["exact_match",]
1283
+
1284
+
1285
+ class RunAgentFallbackModelConfigurationCacheTypedDict(TypedDict):
1286
+ r"""Cache configuration for the request."""
1287
+
1288
+ type: RunAgentFallbackModelConfigurationType
1289
+ ttl: NotRequired[float]
1290
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1291
+
1292
+
1293
+ class RunAgentFallbackModelConfigurationCache(BaseModel):
1294
+ r"""Cache configuration for the request."""
1295
+
1296
+ type: RunAgentFallbackModelConfigurationType
1297
+
1298
+ ttl: Optional[float] = 1800
1299
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1300
+
1301
+ @model_serializer(mode="wrap")
1302
+ def serialize_model(self, handler):
1303
+ optional_fields = set(["ttl"])
1304
+ serialized = handler(self)
1305
+ m = {}
1306
+
1307
+ for n, f in type(self).model_fields.items():
1308
+ k = f.alias or n
1309
+ val = serialized.get(k)
1310
+
1311
+ if val != UNSET_SENTINEL:
1312
+ if val is not None or k not in optional_fields:
1313
+ m[k] = val
1314
+
1315
+ return m
1316
+
1317
+
1318
+ RunAgentLoadBalancerAgentsType = Literal["weight_based",]
1319
+
1320
+
1321
+ class RunAgentLoadBalancerAgentsModelsTypedDict(TypedDict):
1322
+ model: str
1323
+ r"""Model identifier for load balancing"""
1324
+ weight: NotRequired[float]
1325
+ r"""Weight assigned to this model for load balancing"""
1326
+
1327
+
1328
+ class RunAgentLoadBalancerAgentsModels(BaseModel):
1329
+ model: str
1330
+ r"""Model identifier for load balancing"""
1331
+
1332
+ weight: Optional[float] = 0.5
1333
+ r"""Weight assigned to this model for load balancing"""
1334
+
1335
+ @model_serializer(mode="wrap")
1336
+ def serialize_model(self, handler):
1337
+ optional_fields = set(["weight"])
1338
+ serialized = handler(self)
1339
+ m = {}
1340
+
1341
+ for n, f in type(self).model_fields.items():
1342
+ k = f.alias or n
1343
+ val = serialized.get(k)
1344
+
1345
+ if val != UNSET_SENTINEL:
1346
+ if val is not None or k not in optional_fields:
1347
+ m[k] = val
1348
+
1349
+ return m
1350
+
1351
+
1352
+ class RunAgentLoadBalancerAgents1TypedDict(TypedDict):
1353
+ type: RunAgentLoadBalancerAgentsType
1354
+ models: List[RunAgentLoadBalancerAgentsModelsTypedDict]
1355
+
1356
+
1357
+ class RunAgentLoadBalancerAgents1(BaseModel):
1358
+ type: RunAgentLoadBalancerAgentsType
1359
+
1360
+ models: List[RunAgentLoadBalancerAgentsModels]
1361
+
1362
+
1363
+ RunAgentFallbackModelConfigurationLoadBalancerTypedDict = (
1364
+ RunAgentLoadBalancerAgents1TypedDict
1365
+ )
1366
+ r"""Load balancer configuration for the request."""
1367
+
1368
+
1369
+ RunAgentFallbackModelConfigurationLoadBalancer = RunAgentLoadBalancerAgents1
1370
+ r"""Load balancer configuration for the request."""
1371
+
1372
+
1373
+ class RunAgentFallbackModelConfigurationTimeoutTypedDict(TypedDict):
1374
+ 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."""
1375
+
1376
+ call_timeout: float
1377
+ r"""Timeout value in milliseconds"""
1378
+
1379
+
1380
+ class RunAgentFallbackModelConfigurationTimeout(BaseModel):
1381
+ 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."""
1382
+
1383
+ call_timeout: float
1384
+ r"""Timeout value in milliseconds"""
1385
+
1386
+
1053
1387
  class RunAgentFallbackModelConfigurationParametersTypedDict(TypedDict):
1054
1388
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1055
1389
 
1390
+ name: NotRequired[str]
1391
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
1056
1392
  audio: NotRequired[Nullable[RunAgentFallbackModelConfigurationAudioTypedDict]]
1057
1393
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
1058
1394
  frequency_penalty: NotRequired[Nullable[float]]
@@ -1113,11 +1449,24 @@ class RunAgentFallbackModelConfigurationParametersTypedDict(TypedDict):
1113
1449
  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\"]."""
1114
1450
  guardrails: NotRequired[List[RunAgentFallbackModelConfigurationGuardrailsTypedDict]]
1115
1451
  r"""A list of guardrails to apply to the request."""
1452
+ fallbacks: NotRequired[List[RunAgentFallbackModelConfigurationFallbacksTypedDict]]
1453
+ r"""Array of fallback models to use if primary model fails"""
1454
+ retry: NotRequired[RunAgentFallbackModelConfigurationRetryTypedDict]
1455
+ r"""Retry configuration for the request"""
1456
+ cache: NotRequired[RunAgentFallbackModelConfigurationCacheTypedDict]
1457
+ r"""Cache configuration for the request."""
1458
+ load_balancer: NotRequired[RunAgentFallbackModelConfigurationLoadBalancerTypedDict]
1459
+ r"""Load balancer configuration for the request."""
1460
+ timeout: NotRequired[RunAgentFallbackModelConfigurationTimeoutTypedDict]
1461
+ 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."""
1116
1462
 
1117
1463
 
1118
1464
  class RunAgentFallbackModelConfigurationParameters(BaseModel):
1119
1465
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1120
1466
 
1467
+ name: Optional[str] = None
1468
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
1469
+
1121
1470
  audio: OptionalNullable[RunAgentFallbackModelConfigurationAudio] = UNSET
1122
1471
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
1123
1472
 
@@ -1198,10 +1547,26 @@ class RunAgentFallbackModelConfigurationParameters(BaseModel):
1198
1547
  guardrails: Optional[List[RunAgentFallbackModelConfigurationGuardrails]] = None
1199
1548
  r"""A list of guardrails to apply to the request."""
1200
1549
 
1550
+ fallbacks: Optional[List[RunAgentFallbackModelConfigurationFallbacks]] = None
1551
+ r"""Array of fallback models to use if primary model fails"""
1552
+
1553
+ retry: Optional[RunAgentFallbackModelConfigurationRetry] = None
1554
+ r"""Retry configuration for the request"""
1555
+
1556
+ cache: Optional[RunAgentFallbackModelConfigurationCache] = None
1557
+ r"""Cache configuration for the request."""
1558
+
1559
+ load_balancer: Optional[RunAgentFallbackModelConfigurationLoadBalancer] = None
1560
+ r"""Load balancer configuration for the request."""
1561
+
1562
+ timeout: Optional[RunAgentFallbackModelConfigurationTimeout] = None
1563
+ 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."""
1564
+
1201
1565
  @model_serializer(mode="wrap")
1202
1566
  def serialize_model(self, handler):
1203
1567
  optional_fields = set(
1204
1568
  [
1569
+ "name",
1205
1570
  "audio",
1206
1571
  "frequency_penalty",
1207
1572
  "max_tokens",
@@ -1224,6 +1589,11 @@ class RunAgentFallbackModelConfigurationParameters(BaseModel):
1224
1589
  "parallel_tool_calls",
1225
1590
  "modalities",
1226
1591
  "guardrails",
1592
+ "fallbacks",
1593
+ "retry",
1594
+ "cache",
1595
+ "load_balancer",
1596
+ "timeout",
1227
1597
  ]
1228
1598
  )
1229
1599
  nullable_fields = set(
@@ -1267,7 +1637,7 @@ class RunAgentFallbackModelConfigurationParameters(BaseModel):
1267
1637
  return m
1268
1638
 
1269
1639
 
1270
- class RunAgentFallbackModelConfigurationRetryTypedDict(TypedDict):
1640
+ class RunAgentFallbackModelConfigurationAgentsRetryTypedDict(TypedDict):
1271
1641
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1272
1642
 
1273
1643
  count: NotRequired[float]
@@ -1276,7 +1646,7 @@ class RunAgentFallbackModelConfigurationRetryTypedDict(TypedDict):
1276
1646
  r"""HTTP status codes that trigger retry logic"""
1277
1647
 
1278
1648
 
1279
- class RunAgentFallbackModelConfigurationRetry(BaseModel):
1649
+ class RunAgentFallbackModelConfigurationAgentsRetry(BaseModel):
1280
1650
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1281
1651
 
1282
1652
  count: Optional[float] = 3
@@ -1309,7 +1679,7 @@ class RunAgentFallbackModelConfiguration2TypedDict(TypedDict):
1309
1679
  r"""A fallback model ID string. Must support tool calling."""
1310
1680
  parameters: NotRequired[RunAgentFallbackModelConfigurationParametersTypedDict]
1311
1681
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1312
- retry: NotRequired[RunAgentFallbackModelConfigurationRetryTypedDict]
1682
+ retry: NotRequired[RunAgentFallbackModelConfigurationAgentsRetryTypedDict]
1313
1683
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1314
1684
 
1315
1685
 
@@ -1322,7 +1692,7 @@ class RunAgentFallbackModelConfiguration2(BaseModel):
1322
1692
  parameters: Optional[RunAgentFallbackModelConfigurationParameters] = None
1323
1693
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1324
1694
 
1325
- retry: Optional[RunAgentFallbackModelConfigurationRetry] = None
1695
+ retry: Optional[RunAgentFallbackModelConfigurationAgentsRetry] = None
1326
1696
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1327
1697
 
1328
1698
  @model_serializer(mode="wrap")
@@ -1723,7 +2093,7 @@ class RunAgentAgentToolInputRunTools(BaseModel):
1723
2093
 
1724
2094
  schema_: Annotated[AgentToolInputRunSchema, pydantic.Field(alias="schema")]
1725
2095
 
1726
- id: Optional[str] = "01KFDQW5XYHWR61SGS16YJF3BC"
2096
+ id: Optional[str] = "01KFZBGFPMXP6AK4GBEEHQJY9P"
1727
2097
 
1728
2098
  description: Optional[str] = None
1729
2099