orq-ai-sdk 4.2.0rc49__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.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/RECORD +98 -75
  97. {orq_ai_sdk-4.2.0rc49.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.0rc49.dist-info/METADATA +0 -788
  103. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/top_level.txt +0 -0
@@ -453,9 +453,161 @@ class StreamRunAgentModelConfigurationGuardrails(BaseModel):
453
453
  r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
454
454
 
455
455
 
456
+ class StreamRunAgentModelConfigurationFallbacksTypedDict(TypedDict):
457
+ model: str
458
+ r"""Fallback model identifier"""
459
+
460
+
461
+ class StreamRunAgentModelConfigurationFallbacks(BaseModel):
462
+ model: str
463
+ r"""Fallback model identifier"""
464
+
465
+
466
+ class StreamRunAgentModelConfigurationRetryTypedDict(TypedDict):
467
+ r"""Retry configuration for the request"""
468
+
469
+ count: NotRequired[float]
470
+ r"""Number of retry attempts (1-5)"""
471
+ on_codes: NotRequired[List[float]]
472
+ r"""HTTP status codes that trigger retry logic"""
473
+
474
+
475
+ class StreamRunAgentModelConfigurationRetry(BaseModel):
476
+ r"""Retry configuration for the request"""
477
+
478
+ count: Optional[float] = 3
479
+ r"""Number of retry attempts (1-5)"""
480
+
481
+ on_codes: Optional[List[float]] = None
482
+ r"""HTTP status codes that trigger retry logic"""
483
+
484
+ @model_serializer(mode="wrap")
485
+ def serialize_model(self, handler):
486
+ optional_fields = set(["count", "on_codes"])
487
+ serialized = handler(self)
488
+ m = {}
489
+
490
+ for n, f in type(self).model_fields.items():
491
+ k = f.alias or n
492
+ val = serialized.get(k)
493
+
494
+ if val != UNSET_SENTINEL:
495
+ if val is not None or k not in optional_fields:
496
+ m[k] = val
497
+
498
+ return m
499
+
500
+
501
+ StreamRunAgentModelConfigurationType = Literal["exact_match",]
502
+
503
+
504
+ class StreamRunAgentModelConfigurationCacheTypedDict(TypedDict):
505
+ r"""Cache configuration for the request."""
506
+
507
+ type: StreamRunAgentModelConfigurationType
508
+ ttl: NotRequired[float]
509
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
510
+
511
+
512
+ class StreamRunAgentModelConfigurationCache(BaseModel):
513
+ r"""Cache configuration for the request."""
514
+
515
+ type: StreamRunAgentModelConfigurationType
516
+
517
+ ttl: Optional[float] = 1800
518
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
519
+
520
+ @model_serializer(mode="wrap")
521
+ def serialize_model(self, handler):
522
+ optional_fields = set(["ttl"])
523
+ serialized = handler(self)
524
+ m = {}
525
+
526
+ for n, f in type(self).model_fields.items():
527
+ k = f.alias or n
528
+ val = serialized.get(k)
529
+
530
+ if val != UNSET_SENTINEL:
531
+ if val is not None or k not in optional_fields:
532
+ m[k] = val
533
+
534
+ return m
535
+
536
+
537
+ StreamRunAgentLoadBalancerType = Literal["weight_based",]
538
+
539
+
540
+ class StreamRunAgentLoadBalancerModelsTypedDict(TypedDict):
541
+ model: str
542
+ r"""Model identifier for load balancing"""
543
+ weight: NotRequired[float]
544
+ r"""Weight assigned to this model for load balancing"""
545
+
546
+
547
+ class StreamRunAgentLoadBalancerModels(BaseModel):
548
+ model: str
549
+ r"""Model identifier for load balancing"""
550
+
551
+ weight: Optional[float] = 0.5
552
+ r"""Weight assigned to this model for load balancing"""
553
+
554
+ @model_serializer(mode="wrap")
555
+ def serialize_model(self, handler):
556
+ optional_fields = set(["weight"])
557
+ serialized = handler(self)
558
+ m = {}
559
+
560
+ for n, f in type(self).model_fields.items():
561
+ k = f.alias or n
562
+ val = serialized.get(k)
563
+
564
+ if val != UNSET_SENTINEL:
565
+ if val is not None or k not in optional_fields:
566
+ m[k] = val
567
+
568
+ return m
569
+
570
+
571
+ class StreamRunAgentLoadBalancer1TypedDict(TypedDict):
572
+ type: StreamRunAgentLoadBalancerType
573
+ models: List[StreamRunAgentLoadBalancerModelsTypedDict]
574
+
575
+
576
+ class StreamRunAgentLoadBalancer1(BaseModel):
577
+ type: StreamRunAgentLoadBalancerType
578
+
579
+ models: List[StreamRunAgentLoadBalancerModels]
580
+
581
+
582
+ StreamRunAgentModelConfigurationLoadBalancerTypedDict = (
583
+ StreamRunAgentLoadBalancer1TypedDict
584
+ )
585
+ r"""Load balancer configuration for the request."""
586
+
587
+
588
+ StreamRunAgentModelConfigurationLoadBalancer = StreamRunAgentLoadBalancer1
589
+ r"""Load balancer configuration for the request."""
590
+
591
+
592
+ class StreamRunAgentModelConfigurationTimeoutTypedDict(TypedDict):
593
+ 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."""
594
+
595
+ call_timeout: float
596
+ r"""Timeout value in milliseconds"""
597
+
598
+
599
+ class StreamRunAgentModelConfigurationTimeout(BaseModel):
600
+ 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."""
601
+
602
+ call_timeout: float
603
+ r"""Timeout value in milliseconds"""
604
+
605
+
456
606
  class StreamRunAgentModelConfigurationParametersTypedDict(TypedDict):
457
607
  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."""
458
608
 
609
+ name: NotRequired[str]
610
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
459
611
  audio: NotRequired[Nullable[StreamRunAgentModelConfigurationAudioTypedDict]]
460
612
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
461
613
  frequency_penalty: NotRequired[Nullable[float]]
@@ -514,11 +666,24 @@ class StreamRunAgentModelConfigurationParametersTypedDict(TypedDict):
514
666
  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\"]."""
515
667
  guardrails: NotRequired[List[StreamRunAgentModelConfigurationGuardrailsTypedDict]]
516
668
  r"""A list of guardrails to apply to the request."""
669
+ fallbacks: NotRequired[List[StreamRunAgentModelConfigurationFallbacksTypedDict]]
670
+ r"""Array of fallback models to use if primary model fails"""
671
+ retry: NotRequired[StreamRunAgentModelConfigurationRetryTypedDict]
672
+ r"""Retry configuration for the request"""
673
+ cache: NotRequired[StreamRunAgentModelConfigurationCacheTypedDict]
674
+ r"""Cache configuration for the request."""
675
+ load_balancer: NotRequired[StreamRunAgentModelConfigurationLoadBalancerTypedDict]
676
+ r"""Load balancer configuration for the request."""
677
+ timeout: NotRequired[StreamRunAgentModelConfigurationTimeoutTypedDict]
678
+ 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."""
517
679
 
518
680
 
519
681
  class StreamRunAgentModelConfigurationParameters(BaseModel):
520
682
  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."""
521
683
 
684
+ name: Optional[str] = None
685
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
686
+
522
687
  audio: OptionalNullable[StreamRunAgentModelConfigurationAudio] = UNSET
523
688
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
524
689
 
@@ -599,10 +764,26 @@ class StreamRunAgentModelConfigurationParameters(BaseModel):
599
764
  guardrails: Optional[List[StreamRunAgentModelConfigurationGuardrails]] = None
600
765
  r"""A list of guardrails to apply to the request."""
601
766
 
767
+ fallbacks: Optional[List[StreamRunAgentModelConfigurationFallbacks]] = None
768
+ r"""Array of fallback models to use if primary model fails"""
769
+
770
+ retry: Optional[StreamRunAgentModelConfigurationRetry] = None
771
+ r"""Retry configuration for the request"""
772
+
773
+ cache: Optional[StreamRunAgentModelConfigurationCache] = None
774
+ r"""Cache configuration for the request."""
775
+
776
+ load_balancer: Optional[StreamRunAgentModelConfigurationLoadBalancer] = None
777
+ r"""Load balancer configuration for the request."""
778
+
779
+ timeout: Optional[StreamRunAgentModelConfigurationTimeout] = None
780
+ 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."""
781
+
602
782
  @model_serializer(mode="wrap")
603
783
  def serialize_model(self, handler):
604
784
  optional_fields = set(
605
785
  [
786
+ "name",
606
787
  "audio",
607
788
  "frequency_penalty",
608
789
  "max_tokens",
@@ -625,6 +806,11 @@ class StreamRunAgentModelConfigurationParameters(BaseModel):
625
806
  "parallel_tool_calls",
626
807
  "modalities",
627
808
  "guardrails",
809
+ "fallbacks",
810
+ "retry",
811
+ "cache",
812
+ "load_balancer",
813
+ "timeout",
628
814
  ]
629
815
  )
630
816
  nullable_fields = set(
@@ -668,7 +854,7 @@ class StreamRunAgentModelConfigurationParameters(BaseModel):
668
854
  return m
669
855
 
670
856
 
671
- class StreamRunAgentModelConfigurationRetryTypedDict(TypedDict):
857
+ class StreamRunAgentModelConfigurationAgentsRetryTypedDict(TypedDict):
672
858
  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."""
673
859
 
674
860
  count: NotRequired[float]
@@ -677,7 +863,7 @@ class StreamRunAgentModelConfigurationRetryTypedDict(TypedDict):
677
863
  r"""HTTP status codes that trigger retry logic"""
678
864
 
679
865
 
680
- class StreamRunAgentModelConfigurationRetry(BaseModel):
866
+ class StreamRunAgentModelConfigurationAgentsRetry(BaseModel):
681
867
  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."""
682
868
 
683
869
  count: Optional[float] = 3
@@ -713,7 +899,7 @@ class StreamRunAgentModelConfiguration2TypedDict(TypedDict):
713
899
  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."""
714
900
  parameters: NotRequired[StreamRunAgentModelConfigurationParametersTypedDict]
715
901
  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."""
716
- retry: NotRequired[StreamRunAgentModelConfigurationRetryTypedDict]
902
+ retry: NotRequired[StreamRunAgentModelConfigurationAgentsRetryTypedDict]
717
903
  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."""
718
904
 
719
905
 
@@ -729,7 +915,7 @@ class StreamRunAgentModelConfiguration2(BaseModel):
729
915
  parameters: Optional[StreamRunAgentModelConfigurationParameters] = None
730
916
  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."""
731
917
 
732
- retry: Optional[StreamRunAgentModelConfigurationRetry] = None
918
+ retry: Optional[StreamRunAgentModelConfigurationAgentsRetry] = None
733
919
  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."""
734
920
 
735
921
  @model_serializer(mode="wrap")
@@ -1126,9 +1312,161 @@ class StreamRunAgentFallbackModelConfigurationGuardrails(BaseModel):
1126
1312
  r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
1127
1313
 
1128
1314
 
1315
+ class StreamRunAgentFallbackModelConfigurationFallbacksTypedDict(TypedDict):
1316
+ model: str
1317
+ r"""Fallback model identifier"""
1318
+
1319
+
1320
+ class StreamRunAgentFallbackModelConfigurationFallbacks(BaseModel):
1321
+ model: str
1322
+ r"""Fallback model identifier"""
1323
+
1324
+
1325
+ class StreamRunAgentFallbackModelConfigurationRetryTypedDict(TypedDict):
1326
+ r"""Retry configuration for the request"""
1327
+
1328
+ count: NotRequired[float]
1329
+ r"""Number of retry attempts (1-5)"""
1330
+ on_codes: NotRequired[List[float]]
1331
+ r"""HTTP status codes that trigger retry logic"""
1332
+
1333
+
1334
+ class StreamRunAgentFallbackModelConfigurationRetry(BaseModel):
1335
+ r"""Retry configuration for the request"""
1336
+
1337
+ count: Optional[float] = 3
1338
+ r"""Number of retry attempts (1-5)"""
1339
+
1340
+ on_codes: Optional[List[float]] = None
1341
+ r"""HTTP status codes that trigger retry logic"""
1342
+
1343
+ @model_serializer(mode="wrap")
1344
+ def serialize_model(self, handler):
1345
+ optional_fields = set(["count", "on_codes"])
1346
+ serialized = handler(self)
1347
+ m = {}
1348
+
1349
+ for n, f in type(self).model_fields.items():
1350
+ k = f.alias or n
1351
+ val = serialized.get(k)
1352
+
1353
+ if val != UNSET_SENTINEL:
1354
+ if val is not None or k not in optional_fields:
1355
+ m[k] = val
1356
+
1357
+ return m
1358
+
1359
+
1360
+ StreamRunAgentFallbackModelConfigurationType = Literal["exact_match",]
1361
+
1362
+
1363
+ class StreamRunAgentFallbackModelConfigurationCacheTypedDict(TypedDict):
1364
+ r"""Cache configuration for the request."""
1365
+
1366
+ type: StreamRunAgentFallbackModelConfigurationType
1367
+ ttl: NotRequired[float]
1368
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1369
+
1370
+
1371
+ class StreamRunAgentFallbackModelConfigurationCache(BaseModel):
1372
+ r"""Cache configuration for the request."""
1373
+
1374
+ type: StreamRunAgentFallbackModelConfigurationType
1375
+
1376
+ ttl: Optional[float] = 1800
1377
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1378
+
1379
+ @model_serializer(mode="wrap")
1380
+ def serialize_model(self, handler):
1381
+ optional_fields = set(["ttl"])
1382
+ serialized = handler(self)
1383
+ m = {}
1384
+
1385
+ for n, f in type(self).model_fields.items():
1386
+ k = f.alias or n
1387
+ val = serialized.get(k)
1388
+
1389
+ if val != UNSET_SENTINEL:
1390
+ if val is not None or k not in optional_fields:
1391
+ m[k] = val
1392
+
1393
+ return m
1394
+
1395
+
1396
+ StreamRunAgentLoadBalancerAgentsType = Literal["weight_based",]
1397
+
1398
+
1399
+ class StreamRunAgentLoadBalancerAgentsModelsTypedDict(TypedDict):
1400
+ model: str
1401
+ r"""Model identifier for load balancing"""
1402
+ weight: NotRequired[float]
1403
+ r"""Weight assigned to this model for load balancing"""
1404
+
1405
+
1406
+ class StreamRunAgentLoadBalancerAgentsModels(BaseModel):
1407
+ model: str
1408
+ r"""Model identifier for load balancing"""
1409
+
1410
+ weight: Optional[float] = 0.5
1411
+ r"""Weight assigned to this model for load balancing"""
1412
+
1413
+ @model_serializer(mode="wrap")
1414
+ def serialize_model(self, handler):
1415
+ optional_fields = set(["weight"])
1416
+ serialized = handler(self)
1417
+ m = {}
1418
+
1419
+ for n, f in type(self).model_fields.items():
1420
+ k = f.alias or n
1421
+ val = serialized.get(k)
1422
+
1423
+ if val != UNSET_SENTINEL:
1424
+ if val is not None or k not in optional_fields:
1425
+ m[k] = val
1426
+
1427
+ return m
1428
+
1429
+
1430
+ class StreamRunAgentLoadBalancerAgents1TypedDict(TypedDict):
1431
+ type: StreamRunAgentLoadBalancerAgentsType
1432
+ models: List[StreamRunAgentLoadBalancerAgentsModelsTypedDict]
1433
+
1434
+
1435
+ class StreamRunAgentLoadBalancerAgents1(BaseModel):
1436
+ type: StreamRunAgentLoadBalancerAgentsType
1437
+
1438
+ models: List[StreamRunAgentLoadBalancerAgentsModels]
1439
+
1440
+
1441
+ StreamRunAgentFallbackModelConfigurationLoadBalancerTypedDict = (
1442
+ StreamRunAgentLoadBalancerAgents1TypedDict
1443
+ )
1444
+ r"""Load balancer configuration for the request."""
1445
+
1446
+
1447
+ StreamRunAgentFallbackModelConfigurationLoadBalancer = StreamRunAgentLoadBalancerAgents1
1448
+ r"""Load balancer configuration for the request."""
1449
+
1450
+
1451
+ class StreamRunAgentFallbackModelConfigurationTimeoutTypedDict(TypedDict):
1452
+ 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."""
1453
+
1454
+ call_timeout: float
1455
+ r"""Timeout value in milliseconds"""
1456
+
1457
+
1458
+ class StreamRunAgentFallbackModelConfigurationTimeout(BaseModel):
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."""
1460
+
1461
+ call_timeout: float
1462
+ r"""Timeout value in milliseconds"""
1463
+
1464
+
1129
1465
  class StreamRunAgentFallbackModelConfigurationParametersTypedDict(TypedDict):
1130
1466
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1131
1467
 
1468
+ name: NotRequired[str]
1469
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
1132
1470
  audio: NotRequired[Nullable[StreamRunAgentFallbackModelConfigurationAudioTypedDict]]
1133
1471
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
1134
1472
  frequency_penalty: NotRequired[Nullable[float]]
@@ -1195,11 +1533,28 @@ class StreamRunAgentFallbackModelConfigurationParametersTypedDict(TypedDict):
1195
1533
  List[StreamRunAgentFallbackModelConfigurationGuardrailsTypedDict]
1196
1534
  ]
1197
1535
  r"""A list of guardrails to apply to the request."""
1536
+ fallbacks: NotRequired[
1537
+ List[StreamRunAgentFallbackModelConfigurationFallbacksTypedDict]
1538
+ ]
1539
+ r"""Array of fallback models to use if primary model fails"""
1540
+ retry: NotRequired[StreamRunAgentFallbackModelConfigurationRetryTypedDict]
1541
+ r"""Retry configuration for the request"""
1542
+ cache: NotRequired[StreamRunAgentFallbackModelConfigurationCacheTypedDict]
1543
+ r"""Cache configuration for the request."""
1544
+ load_balancer: NotRequired[
1545
+ StreamRunAgentFallbackModelConfigurationLoadBalancerTypedDict
1546
+ ]
1547
+ r"""Load balancer configuration for the request."""
1548
+ timeout: NotRequired[StreamRunAgentFallbackModelConfigurationTimeoutTypedDict]
1549
+ 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."""
1198
1550
 
1199
1551
 
1200
1552
  class StreamRunAgentFallbackModelConfigurationParameters(BaseModel):
1201
1553
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1202
1554
 
1555
+ name: Optional[str] = None
1556
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
1557
+
1203
1558
  audio: OptionalNullable[StreamRunAgentFallbackModelConfigurationAudio] = UNSET
1204
1559
  r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
1205
1560
 
@@ -1286,10 +1641,26 @@ class StreamRunAgentFallbackModelConfigurationParameters(BaseModel):
1286
1641
  )
1287
1642
  r"""A list of guardrails to apply to the request."""
1288
1643
 
1644
+ fallbacks: Optional[List[StreamRunAgentFallbackModelConfigurationFallbacks]] = None
1645
+ r"""Array of fallback models to use if primary model fails"""
1646
+
1647
+ retry: Optional[StreamRunAgentFallbackModelConfigurationRetry] = None
1648
+ r"""Retry configuration for the request"""
1649
+
1650
+ cache: Optional[StreamRunAgentFallbackModelConfigurationCache] = None
1651
+ r"""Cache configuration for the request."""
1652
+
1653
+ load_balancer: Optional[StreamRunAgentFallbackModelConfigurationLoadBalancer] = None
1654
+ r"""Load balancer configuration for the request."""
1655
+
1656
+ timeout: Optional[StreamRunAgentFallbackModelConfigurationTimeout] = None
1657
+ 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."""
1658
+
1289
1659
  @model_serializer(mode="wrap")
1290
1660
  def serialize_model(self, handler):
1291
1661
  optional_fields = set(
1292
1662
  [
1663
+ "name",
1293
1664
  "audio",
1294
1665
  "frequency_penalty",
1295
1666
  "max_tokens",
@@ -1312,6 +1683,11 @@ class StreamRunAgentFallbackModelConfigurationParameters(BaseModel):
1312
1683
  "parallel_tool_calls",
1313
1684
  "modalities",
1314
1685
  "guardrails",
1686
+ "fallbacks",
1687
+ "retry",
1688
+ "cache",
1689
+ "load_balancer",
1690
+ "timeout",
1315
1691
  ]
1316
1692
  )
1317
1693
  nullable_fields = set(
@@ -1355,7 +1731,7 @@ class StreamRunAgentFallbackModelConfigurationParameters(BaseModel):
1355
1731
  return m
1356
1732
 
1357
1733
 
1358
- class StreamRunAgentFallbackModelConfigurationRetryTypedDict(TypedDict):
1734
+ class StreamRunAgentFallbackModelConfigurationAgentsRetryTypedDict(TypedDict):
1359
1735
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1360
1736
 
1361
1737
  count: NotRequired[float]
@@ -1364,7 +1740,7 @@ class StreamRunAgentFallbackModelConfigurationRetryTypedDict(TypedDict):
1364
1740
  r"""HTTP status codes that trigger retry logic"""
1365
1741
 
1366
1742
 
1367
- class StreamRunAgentFallbackModelConfigurationRetry(BaseModel):
1743
+ class StreamRunAgentFallbackModelConfigurationAgentsRetry(BaseModel):
1368
1744
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1369
1745
 
1370
1746
  count: Optional[float] = 3
@@ -1397,7 +1773,7 @@ class StreamRunAgentFallbackModelConfiguration2TypedDict(TypedDict):
1397
1773
  r"""A fallback model ID string. Must support tool calling."""
1398
1774
  parameters: NotRequired[StreamRunAgentFallbackModelConfigurationParametersTypedDict]
1399
1775
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1400
- retry: NotRequired[StreamRunAgentFallbackModelConfigurationRetryTypedDict]
1776
+ retry: NotRequired[StreamRunAgentFallbackModelConfigurationAgentsRetryTypedDict]
1401
1777
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1402
1778
 
1403
1779
 
@@ -1410,7 +1786,7 @@ class StreamRunAgentFallbackModelConfiguration2(BaseModel):
1410
1786
  parameters: Optional[StreamRunAgentFallbackModelConfigurationParameters] = None
1411
1787
  r"""Optional model parameters specific to this fallback model. Overrides primary model parameters if this fallback is used."""
1412
1788
 
1413
- retry: Optional[StreamRunAgentFallbackModelConfigurationRetry] = None
1789
+ retry: Optional[StreamRunAgentFallbackModelConfigurationAgentsRetry] = None
1414
1790
  r"""Retry configuration for this fallback model. Allows customizing retry count (1-5) and HTTP status codes that trigger retries."""
1415
1791
 
1416
1792
  @model_serializer(mode="wrap")
@@ -1817,7 +2193,7 @@ class AgentToolInputRunTools(BaseModel):
1817
2193
  StreamRunAgentAgentToolInputRunAgentsSchema, pydantic.Field(alias="schema")
1818
2194
  ]
1819
2195
 
1820
- id: Optional[str] = "01KFDS3B4M4G6T640KKK1HCZ86"
2196
+ id: Optional[str] = "01KFZBGFS9022CF1ZMBD0ZJPC8"
1821
2197
 
1822
2198
  description: Optional[str] = None
1823
2199