vellum-ai 0.14.45__py3-none-any.whl → 0.14.47__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 (162) hide show
  1. vellum/client/README.md +2 -2
  2. vellum/client/__init__.py +72 -6
  3. vellum/client/core/client_wrapper.py +1 -1
  4. vellum/client/core/file.py +13 -8
  5. vellum/client/core/http_client.py +26 -14
  6. vellum/client/core/pydantic_utilities.py +2 -2
  7. vellum/client/core/request_options.py +3 -0
  8. vellum/client/resources/ad_hoc/client.py +14 -2
  9. vellum/client/resources/container_images/client.py +6 -0
  10. vellum/client/resources/deployments/client.py +12 -0
  11. vellum/client/resources/document_indexes/client.py +18 -0
  12. vellum/client/resources/documents/client.py +6 -0
  13. vellum/client/resources/folder_entities/client.py +6 -0
  14. vellum/client/resources/metric_definitions/client.py +6 -0
  15. vellum/client/resources/prompts/client.py +6 -0
  16. vellum/client/resources/sandboxes/client.py +12 -0
  17. vellum/client/resources/test_suite_runs/client.py +6 -0
  18. vellum/client/resources/test_suites/client.py +2 -2
  19. vellum/client/resources/workflow_deployments/client.py +6 -0
  20. vellum/client/resources/workflow_sandboxes/client.py +6 -0
  21. vellum/client/resources/workflows/client.py +6 -4
  22. vellum/client/resources/workspace_secrets/client.py +6 -0
  23. vellum/client/types/api_request_parent_context.py +0 -6
  24. vellum/client/types/array_input.py +0 -5
  25. vellum/client/types/code_execution_node_array_result.py +0 -5
  26. vellum/client/types/code_execution_node_result.py +0 -5
  27. vellum/client/types/code_execution_node_result_data.py +0 -5
  28. vellum/client/types/code_executor_response.py +0 -5
  29. vellum/client/types/create_test_suite_test_case_request.py +0 -5
  30. vellum/client/types/deployment_history_item.py +0 -5
  31. vellum/client/types/deployment_read.py +0 -5
  32. vellum/client/types/execute_workflow_response.py +0 -5
  33. vellum/client/types/execution_array_vellum_value.py +0 -5
  34. vellum/client/types/external_test_case_execution.py +0 -5
  35. vellum/client/types/external_test_case_execution_request.py +0 -5
  36. vellum/client/types/fulfilled_execute_workflow_workflow_result_event.py +0 -7
  37. vellum/client/types/fulfilled_workflow_node_result_event.py +0 -5
  38. vellum/client/types/initiated_workflow_node_result_event.py +0 -5
  39. vellum/client/types/metadata_filter_config_request.py +0 -5
  40. vellum/client/types/metric_definition_execution.py +0 -5
  41. vellum/client/types/metric_definition_history_item.py +0 -5
  42. vellum/client/types/named_test_case_array_variable_value.py +0 -5
  43. vellum/client/types/named_test_case_array_variable_value_request.py +0 -7
  44. vellum/client/types/node_execution_fulfilled_event.py +0 -11
  45. vellum/client/types/node_execution_initiated_event.py +0 -11
  46. vellum/client/types/node_execution_paused_event.py +0 -11
  47. vellum/client/types/node_execution_rejected_event.py +0 -11
  48. vellum/client/types/node_execution_resumed_event.py +0 -11
  49. vellum/client/types/node_execution_span.py +0 -11
  50. vellum/client/types/node_execution_streaming_event.py +0 -11
  51. vellum/client/types/node_input_compiled_array_value.py +0 -5
  52. vellum/client/types/node_output_compiled_array_value.py +0 -5
  53. vellum/client/types/node_parent_context.py +0 -6
  54. vellum/client/types/paginated_slim_deployment_read_list.py +0 -5
  55. vellum/client/types/paginated_slim_workflow_deployment_list.py +0 -5
  56. vellum/client/types/paginated_test_suite_run_execution_list.py +0 -5
  57. vellum/client/types/paginated_test_suite_test_case_list.py +0 -5
  58. vellum/client/types/prompt_deployment_parent_context.py +0 -6
  59. vellum/client/types/prompt_exec_config.py +0 -6
  60. vellum/client/types/rejected_workflow_node_result_event.py +0 -5
  61. vellum/client/types/replace_test_suite_test_case_request.py +0 -5
  62. vellum/client/types/search_filters_request.py +0 -7
  63. vellum/client/types/search_request_options_request.py +0 -7
  64. vellum/client/types/slim_deployment_read.py +0 -5
  65. vellum/client/types/slim_workflow_deployment.py +0 -5
  66. vellum/client/types/slim_workflow_execution_read.py +0 -12
  67. vellum/client/types/span_link.py +0 -6
  68. vellum/client/types/streaming_workflow_node_result_event.py +0 -5
  69. vellum/client/types/templating_node_array_result.py +0 -5
  70. vellum/client/types/templating_node_result.py +0 -5
  71. vellum/client/types/templating_node_result_data.py +0 -5
  72. vellum/client/types/terminal_node_array_result.py +0 -5
  73. vellum/client/types/terminal_node_result.py +0 -5
  74. vellum/client/types/terminal_node_result_data.py +0 -5
  75. vellum/client/types/test_case_array_variable_value.py +0 -5
  76. vellum/client/types/test_suite_run_execution.py +0 -5
  77. vellum/client/types/test_suite_run_execution_array_output.py +0 -5
  78. vellum/client/types/test_suite_run_execution_metric_result.py +0 -5
  79. vellum/client/types/test_suite_run_external_exec_config.py +0 -5
  80. vellum/client/types/test_suite_run_external_exec_config_data.py +0 -5
  81. vellum/client/types/test_suite_run_external_exec_config_data_request.py +0 -7
  82. vellum/client/types/test_suite_run_external_exec_config_request.py +0 -7
  83. vellum/client/types/test_suite_run_metric_array_output.py +0 -5
  84. vellum/client/types/test_suite_run_read.py +0 -5
  85. vellum/client/types/test_suite_test_case.py +0 -5
  86. vellum/client/types/test_suite_test_case_create_bulk_operation_request.py +0 -7
  87. vellum/client/types/test_suite_test_case_replace_bulk_operation_request.py +0 -7
  88. vellum/client/types/test_suite_test_case_upsert_bulk_operation_request.py +0 -7
  89. vellum/client/types/upsert_test_suite_test_case_request.py +0 -5
  90. vellum/client/types/vellum_value_logical_condition_group_request.py +0 -3
  91. vellum/client/types/vellum_value_logical_condition_request.py +0 -5
  92. vellum/client/types/vellum_variable.py +0 -5
  93. vellum/client/types/workflow_deployment_event_executions_response.py +0 -26
  94. vellum/client/types/workflow_deployment_history_item.py +0 -5
  95. vellum/client/types/workflow_deployment_parent_context.py +0 -6
  96. vellum/client/types/workflow_deployment_read.py +0 -5
  97. vellum/client/types/workflow_deployment_release.py +0 -5
  98. vellum/client/types/workflow_deployment_release_workflow_version.py +0 -5
  99. vellum/client/types/workflow_event_execution_read.py +0 -12
  100. vellum/client/types/workflow_execution_actual.py +0 -5
  101. vellum/client/types/workflow_execution_fulfilled_event.py +0 -11
  102. vellum/client/types/workflow_execution_initiated_event.py +0 -11
  103. vellum/client/types/workflow_execution_node_result_event.py +0 -5
  104. vellum/client/types/workflow_execution_paused_event.py +0 -11
  105. vellum/client/types/workflow_execution_rejected_event.py +0 -11
  106. vellum/client/types/workflow_execution_resumed_event.py +0 -11
  107. vellum/client/types/workflow_execution_snapshotted_event.py +0 -13
  108. vellum/client/types/workflow_execution_span.py +0 -11
  109. vellum/client/types/workflow_execution_streaming_event.py +0 -11
  110. vellum/client/types/workflow_execution_view_online_eval_metric_result.py +0 -7
  111. vellum/client/types/workflow_execution_workflow_result_event.py +0 -5
  112. vellum/client/types/workflow_output_array.py +0 -5
  113. vellum/client/types/workflow_parent_context.py +0 -6
  114. vellum/client/types/workflow_result_event.py +0 -5
  115. vellum/client/types/workflow_result_event_output_data_array.py +0 -5
  116. vellum/client/types/workflow_sandbox_parent_context.py +0 -6
  117. vellum/workflows/nodes/bases/base.py +26 -6
  118. vellum/workflows/nodes/bases/tests/test_base_node.py +30 -0
  119. vellum/workflows/nodes/core/try_node/node.py +3 -6
  120. vellum/workflows/nodes/core/try_node/tests/test_node.py +0 -24
  121. vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +8 -14
  122. vellum/workflows/nodes/displayable/code_execution_node/tests/test_code_execution_node.py +112 -0
  123. vellum/workflows/nodes/displayable/code_execution_node/utils.py +3 -54
  124. vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +5 -6
  125. vellum/workflows/nodes/utils.py +8 -0
  126. vellum/workflows/types/code_execution_node_wrappers.py +69 -0
  127. vellum/workflows/vellum_client.py +19 -7
  128. {vellum_ai-0.14.45.dist-info → vellum_ai-0.14.47.dist-info}/METADATA +1 -1
  129. {vellum_ai-0.14.45.dist-info → vellum_ai-0.14.47.dist-info}/RECORD +162 -161
  130. vellum_cli/config.py +7 -2
  131. vellum_cli/push.py +5 -1
  132. vellum_cli/tests/test_push.py +192 -8
  133. vellum_ee/workflows/display/nodes/base_node_display.py +17 -6
  134. vellum_ee/workflows/display/nodes/get_node_display_class.py +4 -5
  135. vellum_ee/workflows/display/nodes/vellum/api_node.py +11 -0
  136. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +5 -0
  137. vellum_ee/workflows/display/nodes/vellum/error_node.py +22 -16
  138. vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +2 -0
  139. vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +46 -12
  140. vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +2 -0
  141. vellum_ee/workflows/display/nodes/vellum/map_node.py +2 -0
  142. vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +3 -5
  143. vellum_ee/workflows/display/nodes/vellum/search_node.py +8 -0
  144. vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +2 -5
  145. vellum_ee/workflows/display/nodes/vellum/templating_node.py +2 -0
  146. vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +1 -1
  147. vellum_ee/workflows/display/nodes/vellum/tests/test_error_node.py +4 -0
  148. vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_deployment_node.py +4 -3
  149. vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_node.py +36 -2
  150. vellum_ee/workflows/display/nodes/vellum/tests/test_subworkflow_deployment_node.py +5 -4
  151. vellum_ee/workflows/display/nodes/vellum/tests/test_templating_node.py +1 -1
  152. vellum_ee/workflows/display/tests/test_base_workflow_display.py +44 -0
  153. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +2 -4
  154. vellum_ee/workflows/display/types.py +3 -0
  155. vellum_ee/workflows/display/utils/expressions.py +3 -3
  156. vellum_ee/workflows/display/utils/vellum.py +1 -3
  157. vellum_ee/workflows/display/workflows/base_workflow_display.py +10 -0
  158. vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +3 -0
  159. vellum_ee/workflows/display/workflows/tests/test_workflow_display.py +53 -0
  160. {vellum_ai-0.14.45.dist-info → vellum_ai-0.14.47.dist-info}/LICENSE +0 -0
  161. {vellum_ai-0.14.45.dist-info → vellum_ai-0.14.47.dist-info}/WHEEL +0 -0
  162. {vellum_ai-0.14.45.dist-info → vellum_ai-0.14.47.dist-info}/entry_points.txt +0 -0
vellum/client/README.md CHANGED
@@ -132,10 +132,10 @@ for chunk in response:
132
132
  ### Retries
133
133
 
134
134
  The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
135
- as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
135
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
136
136
  retry limit (default: 2).
137
137
 
138
- A request is deemed retriable when any of the following HTTP status codes is returned:
138
+ A request is deemed retryable when any of the following HTTP status codes is returned:
139
139
 
140
140
  - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
141
141
  - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
vellum/client/__init__.py CHANGED
@@ -219,6 +219,9 @@ class Vellum:
219
219
  object_=bearer_token, annotation=ExecuteApiRequestBearerToken, direction="write"
220
220
  ),
221
221
  },
222
+ headers={
223
+ "content-type": "application/json",
224
+ },
222
225
  request_options=request_options,
223
226
  omit=OMIT,
224
227
  )
@@ -307,6 +310,9 @@ class Vellum:
307
310
  ),
308
311
  "output_type": output_type,
309
312
  },
313
+ headers={
314
+ "content-type": "application/json",
315
+ },
310
316
  request_options=request_options,
311
317
  omit=OMIT,
312
318
  )
@@ -425,6 +431,9 @@ class Vellum:
425
431
  "expand_raw": expand_raw,
426
432
  "metadata": metadata,
427
433
  },
434
+ headers={
435
+ "content-type": "application/json",
436
+ },
428
437
  request_options=request_options,
429
438
  omit=OMIT,
430
439
  )
@@ -575,6 +584,9 @@ class Vellum:
575
584
  "expand_raw": expand_raw,
576
585
  "metadata": metadata,
577
586
  },
587
+ headers={
588
+ "content-type": "application/json",
589
+ },
578
590
  request_options=request_options,
579
591
  omit=OMIT,
580
592
  ) as _response:
@@ -591,7 +603,7 @@ class Vellum:
591
603
  object_=json.loads(_text),
592
604
  ),
593
605
  )
594
- except:
606
+ except Exception:
595
607
  pass
596
608
  return
597
609
  _response.read()
@@ -719,6 +731,9 @@ class Vellum:
719
731
  "external_id": external_id,
720
732
  "metadata": metadata,
721
733
  },
734
+ headers={
735
+ "content-type": "application/json",
736
+ },
722
737
  request_options=request_options,
723
738
  omit=OMIT,
724
739
  )
@@ -852,6 +867,9 @@ class Vellum:
852
867
  "event_types": event_types,
853
868
  "metadata": metadata,
854
869
  },
870
+ headers={
871
+ "content-type": "application/json",
872
+ },
855
873
  request_options=request_options,
856
874
  omit=OMIT,
857
875
  ) as _response:
@@ -868,7 +886,7 @@ class Vellum:
868
886
  object_=json.loads(_text),
869
887
  ),
870
888
  )
871
- except:
889
+ except Exception:
872
890
  pass
873
891
  return
874
892
  _response.read()
@@ -973,6 +991,9 @@ class Vellum:
973
991
  object_=options, annotation=GenerateOptionsRequest, direction="write"
974
992
  ),
975
993
  },
994
+ headers={
995
+ "content-type": "application/json",
996
+ },
976
997
  request_options=request_options,
977
998
  omit=OMIT,
978
999
  )
@@ -1098,6 +1119,9 @@ class Vellum:
1098
1119
  object_=options, annotation=GenerateOptionsRequest, direction="write"
1099
1120
  ),
1100
1121
  },
1122
+ headers={
1123
+ "content-type": "application/json",
1124
+ },
1101
1125
  request_options=request_options,
1102
1126
  omit=OMIT,
1103
1127
  ) as _response:
@@ -1114,7 +1138,7 @@ class Vellum:
1114
1138
  object_=json.loads(_text),
1115
1139
  ),
1116
1140
  )
1117
- except:
1141
+ except Exception:
1118
1142
  pass
1119
1143
  return
1120
1144
  _response.read()
@@ -1225,6 +1249,9 @@ class Vellum:
1225
1249
  ),
1226
1250
  "document_index": document_index,
1227
1251
  },
1252
+ headers={
1253
+ "content-type": "application/json",
1254
+ },
1228
1255
  request_options=request_options,
1229
1256
  omit=OMIT,
1230
1257
  )
@@ -1323,6 +1350,9 @@ class Vellum:
1323
1350
  object_=actuals, annotation=typing.Sequence[SubmitCompletionActualRequest], direction="write"
1324
1351
  ),
1325
1352
  },
1353
+ headers={
1354
+ "content-type": "application/json",
1355
+ },
1326
1356
  request_options=request_options,
1327
1357
  omit=OMIT,
1328
1358
  )
@@ -1417,6 +1447,9 @@ class Vellum:
1417
1447
  "execution_id": execution_id,
1418
1448
  "external_id": external_id,
1419
1449
  },
1450
+ headers={
1451
+ "content-type": "application/json",
1452
+ },
1420
1453
  request_options=request_options,
1421
1454
  omit=OMIT,
1422
1455
  )
@@ -1570,6 +1603,9 @@ class AsyncVellum:
1570
1603
  object_=bearer_token, annotation=ExecuteApiRequestBearerToken, direction="write"
1571
1604
  ),
1572
1605
  },
1606
+ headers={
1607
+ "content-type": "application/json",
1608
+ },
1573
1609
  request_options=request_options,
1574
1610
  omit=OMIT,
1575
1611
  )
@@ -1666,6 +1702,9 @@ class AsyncVellum:
1666
1702
  ),
1667
1703
  "output_type": output_type,
1668
1704
  },
1705
+ headers={
1706
+ "content-type": "application/json",
1707
+ },
1669
1708
  request_options=request_options,
1670
1709
  omit=OMIT,
1671
1710
  )
@@ -1792,6 +1831,9 @@ class AsyncVellum:
1792
1831
  "expand_raw": expand_raw,
1793
1832
  "metadata": metadata,
1794
1833
  },
1834
+ headers={
1835
+ "content-type": "application/json",
1836
+ },
1795
1837
  request_options=request_options,
1796
1838
  omit=OMIT,
1797
1839
  )
@@ -1950,6 +1992,9 @@ class AsyncVellum:
1950
1992
  "expand_raw": expand_raw,
1951
1993
  "metadata": metadata,
1952
1994
  },
1995
+ headers={
1996
+ "content-type": "application/json",
1997
+ },
1953
1998
  request_options=request_options,
1954
1999
  omit=OMIT,
1955
2000
  ) as _response:
@@ -1966,7 +2011,7 @@ class AsyncVellum:
1966
2011
  object_=json.loads(_text),
1967
2012
  ),
1968
2013
  )
1969
- except:
2014
+ except Exception:
1970
2015
  pass
1971
2016
  return
1972
2017
  await _response.aread()
@@ -2102,6 +2147,9 @@ class AsyncVellum:
2102
2147
  "external_id": external_id,
2103
2148
  "metadata": metadata,
2104
2149
  },
2150
+ headers={
2151
+ "content-type": "application/json",
2152
+ },
2105
2153
  request_options=request_options,
2106
2154
  omit=OMIT,
2107
2155
  )
@@ -2243,6 +2291,9 @@ class AsyncVellum:
2243
2291
  "event_types": event_types,
2244
2292
  "metadata": metadata,
2245
2293
  },
2294
+ headers={
2295
+ "content-type": "application/json",
2296
+ },
2246
2297
  request_options=request_options,
2247
2298
  omit=OMIT,
2248
2299
  ) as _response:
@@ -2259,7 +2310,7 @@ class AsyncVellum:
2259
2310
  object_=json.loads(_text),
2260
2311
  ),
2261
2312
  )
2262
- except:
2313
+ except Exception:
2263
2314
  pass
2264
2315
  return
2265
2316
  await _response.aread()
@@ -2372,6 +2423,9 @@ class AsyncVellum:
2372
2423
  object_=options, annotation=GenerateOptionsRequest, direction="write"
2373
2424
  ),
2374
2425
  },
2426
+ headers={
2427
+ "content-type": "application/json",
2428
+ },
2375
2429
  request_options=request_options,
2376
2430
  omit=OMIT,
2377
2431
  )
@@ -2505,6 +2559,9 @@ class AsyncVellum:
2505
2559
  object_=options, annotation=GenerateOptionsRequest, direction="write"
2506
2560
  ),
2507
2561
  },
2562
+ headers={
2563
+ "content-type": "application/json",
2564
+ },
2508
2565
  request_options=request_options,
2509
2566
  omit=OMIT,
2510
2567
  ) as _response:
@@ -2521,7 +2578,7 @@ class AsyncVellum:
2521
2578
  object_=json.loads(_text),
2522
2579
  ),
2523
2580
  )
2524
- except:
2581
+ except Exception:
2525
2582
  pass
2526
2583
  return
2527
2584
  await _response.aread()
@@ -2640,6 +2697,9 @@ class AsyncVellum:
2640
2697
  ),
2641
2698
  "document_index": document_index,
2642
2699
  },
2700
+ headers={
2701
+ "content-type": "application/json",
2702
+ },
2643
2703
  request_options=request_options,
2644
2704
  omit=OMIT,
2645
2705
  )
@@ -2746,6 +2806,9 @@ class AsyncVellum:
2746
2806
  object_=actuals, annotation=typing.Sequence[SubmitCompletionActualRequest], direction="write"
2747
2807
  ),
2748
2808
  },
2809
+ headers={
2810
+ "content-type": "application/json",
2811
+ },
2749
2812
  request_options=request_options,
2750
2813
  omit=OMIT,
2751
2814
  )
@@ -2848,6 +2911,9 @@ class AsyncVellum:
2848
2911
  "execution_id": execution_id,
2849
2912
  "external_id": external_id,
2850
2913
  },
2914
+ headers={
2915
+ "content-type": "application/json",
2916
+ },
2851
2917
  request_options=request_options,
2852
2918
  omit=OMIT,
2853
2919
  )
@@ -18,7 +18,7 @@ class BaseClientWrapper:
18
18
  headers: typing.Dict[str, str] = {
19
19
  "X-Fern-Language": "Python",
20
20
  "X-Fern-SDK-Name": "vellum-ai",
21
- "X-Fern-SDK-Version": "0.14.45",
21
+ "X-Fern-SDK-Version": "0.14.47",
22
22
  }
23
23
  headers["X-API-KEY"] = self.api_key
24
24
  return headers
@@ -43,20 +43,25 @@ def convert_file_dict_to_httpx_tuples(
43
43
  return httpx_tuples
44
44
 
45
45
 
46
- def with_content_type(*, file: File, content_type: str) -> File:
47
- """ """
46
+ def with_content_type(*, file: File, default_content_type: str) -> File:
47
+ """
48
+ This function resolves to the file's content type, if provided, and defaults
49
+ to the default_content_type value if not.
50
+ """
48
51
  if isinstance(file, tuple):
49
52
  if len(file) == 2:
50
53
  filename, content = cast(Tuple[Optional[str], FileContent], file) # type: ignore
51
- return (filename, content, content_type)
54
+ return (filename, content, default_content_type)
52
55
  elif len(file) == 3:
53
- filename, content, _ = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore
54
- return (filename, content, content_type)
56
+ filename, content, file_content_type = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore
57
+ out_content_type = file_content_type or default_content_type
58
+ return (filename, content, out_content_type)
55
59
  elif len(file) == 4:
56
- filename, content, _, headers = cast( # type: ignore
60
+ filename, content, file_content_type, headers = cast( # type: ignore
57
61
  Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], file
58
62
  )
59
- return (filename, content, content_type, headers)
63
+ out_content_type = file_content_type or default_content_type
64
+ return (filename, content, out_content_type, headers)
60
65
  else:
61
66
  raise ValueError(f"Unexpected tuple length: {len(file)}")
62
- return (None, file, content_type)
67
+ return (None, file, default_content_type)
@@ -85,8 +85,8 @@ def _retry_timeout(response: httpx.Response, retries: int) -> float:
85
85
 
86
86
 
87
87
  def _should_retry(response: httpx.Response) -> bool:
88
- retriable_400s = [429, 408, 409]
89
- return response.status_code >= 500 or response.status_code in retriable_400s
88
+ retryable_400s = [429, 408, 409]
89
+ return response.status_code >= 500 or response.status_code in retryable_400s
90
90
 
91
91
 
92
92
  def remove_omit_from_dict(
@@ -183,7 +183,7 @@ class HttpClient:
183
183
  files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
184
184
  headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
185
185
  request_options: typing.Optional[RequestOptions] = None,
186
- retries: int = 0,
186
+ retries: int = 2,
187
187
  omit: typing.Optional[typing.Any] = None,
188
188
  ) -> httpx.Response:
189
189
  base_url = self.get_base_url(base_url)
@@ -227,9 +227,11 @@ class HttpClient:
227
227
  json=json_body,
228
228
  data=data_body,
229
229
  content=content,
230
- files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
231
- if (files is not None and files is not omit)
232
- else None,
230
+ files=(
231
+ convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
232
+ if (files is not None and files is not omit)
233
+ else None
234
+ ),
233
235
  timeout=timeout,
234
236
  )
235
237
 
@@ -267,7 +269,7 @@ class HttpClient:
267
269
  files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
268
270
  headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
269
271
  request_options: typing.Optional[RequestOptions] = None,
270
- retries: int = 0,
272
+ retries: int = 2,
271
273
  omit: typing.Optional[typing.Any] = None,
272
274
  ) -> typing.Iterator[httpx.Response]:
273
275
  base_url = self.get_base_url(base_url)
@@ -311,9 +313,11 @@ class HttpClient:
311
313
  json=json_body,
312
314
  data=data_body,
313
315
  content=content,
314
- files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
315
- if (files is not None and files is not omit)
316
- else None,
316
+ files=(
317
+ convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
318
+ if (files is not None and files is not omit)
319
+ else None
320
+ ),
317
321
  timeout=timeout,
318
322
  ) as stream:
319
323
  yield stream
@@ -355,7 +359,7 @@ class AsyncHttpClient:
355
359
  files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
356
360
  headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
357
361
  request_options: typing.Optional[RequestOptions] = None,
358
- retries: int = 0,
362
+ retries: int = 2,
359
363
  omit: typing.Optional[typing.Any] = None,
360
364
  ) -> httpx.Response:
361
365
  base_url = self.get_base_url(base_url)
@@ -400,7 +404,11 @@ class AsyncHttpClient:
400
404
  json=json_body,
401
405
  data=data_body,
402
406
  content=content,
403
- files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
407
+ files=(
408
+ convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
409
+ if files is not None
410
+ else None
411
+ ),
404
412
  timeout=timeout,
405
413
  )
406
414
 
@@ -437,7 +445,7 @@ class AsyncHttpClient:
437
445
  files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
438
446
  headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
439
447
  request_options: typing.Optional[RequestOptions] = None,
440
- retries: int = 0,
448
+ retries: int = 2,
441
449
  omit: typing.Optional[typing.Any] = None,
442
450
  ) -> typing.AsyncIterator[httpx.Response]:
443
451
  base_url = self.get_base_url(base_url)
@@ -481,7 +489,11 @@ class AsyncHttpClient:
481
489
  json=json_body,
482
490
  data=data_body,
483
491
  content=content,
484
- files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
492
+ files=(
493
+ convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
494
+ if files is not None
495
+ else None
496
+ ),
485
497
  timeout=timeout,
486
498
  ) as stream:
487
499
  yield stream
@@ -82,7 +82,7 @@ def to_jsonable_with_fallback(
82
82
  class UniversalBaseModel(pydantic.BaseModel):
83
83
  if IS_PYDANTIC_V2:
84
84
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
85
- # Allow fields begining with `model_` to be used in the model
85
+ # Allow fields beginning with `model_` to be used in the model
86
86
  protected_namespaces=(),
87
87
  ) # type: ignore # Pydantic v2
88
88
 
@@ -131,7 +131,7 @@ class UniversalBaseModel(pydantic.BaseModel):
131
131
  Override the default dict method to `exclude_unset` by default. This function patches
132
132
  `exclude_unset` to work include fields within non-None default values.
133
133
  """
134
- # Note: the logic here is multi-plexed given the levers exposed in Pydantic V1 vs V2
134
+ # Note: the logic here is multiplexed given the levers exposed in Pydantic V1 vs V2
135
135
  # Pydantic V1's .dict can be extremely slow, so we do not want to call it twice.
136
136
  #
137
137
  # We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models
@@ -23,6 +23,8 @@ class RequestOptions(typing.TypedDict, total=False):
23
23
  - additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict
24
24
 
25
25
  - additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict
26
+
27
+ - chunk_size: int. The size, in bytes, to process each chunk of data being streamed back within the response. This equates to leveraging `chunk_size` within `requests` or `httpx`, and is only leveraged for file downloads.
26
28
  """
27
29
 
28
30
  timeout_in_seconds: NotRequired[int]
@@ -30,3 +32,4 @@ class RequestOptions(typing.TypedDict, total=False):
30
32
  additional_headers: NotRequired[typing.Dict[str, typing.Any]]
31
33
  additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]]
32
34
  additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]]
35
+ chunk_size: NotRequired[int]
@@ -133,6 +133,9 @@ class AdHocClient:
133
133
  object_=expand_meta, annotation=AdHocExpandMeta, direction="write"
134
134
  ),
135
135
  },
136
+ headers={
137
+ "content-type": "application/json",
138
+ },
136
139
  request_options=request_options,
137
140
  omit=OMIT,
138
141
  )
@@ -286,6 +289,9 @@ class AdHocClient:
286
289
  object_=expand_meta, annotation=AdHocExpandMeta, direction="write"
287
290
  ),
288
291
  },
292
+ headers={
293
+ "content-type": "application/json",
294
+ },
289
295
  request_options=request_options,
290
296
  omit=OMIT,
291
297
  ) as _response:
@@ -302,7 +308,7 @@ class AdHocClient:
302
308
  object_=json.loads(_text),
303
309
  ),
304
310
  )
305
- except:
311
+ except Exception:
306
312
  pass
307
313
  return
308
314
  _response.read()
@@ -458,6 +464,9 @@ class AsyncAdHocClient:
458
464
  object_=expand_meta, annotation=AdHocExpandMeta, direction="write"
459
465
  ),
460
466
  },
467
+ headers={
468
+ "content-type": "application/json",
469
+ },
461
470
  request_options=request_options,
462
471
  omit=OMIT,
463
472
  )
@@ -619,6 +628,9 @@ class AsyncAdHocClient:
619
628
  object_=expand_meta, annotation=AdHocExpandMeta, direction="write"
620
629
  ),
621
630
  },
631
+ headers={
632
+ "content-type": "application/json",
633
+ },
622
634
  request_options=request_options,
623
635
  omit=OMIT,
624
636
  ) as _response:
@@ -635,7 +647,7 @@ class AsyncAdHocClient:
635
647
  object_=json.loads(_text),
636
648
  ),
637
649
  )
638
- except:
650
+ except Exception:
639
651
  pass
640
652
  return
641
653
  await _response.aread()
@@ -220,6 +220,9 @@ class ContainerImagesClient:
220
220
  "sha": sha,
221
221
  "tags": tags,
222
222
  },
223
+ headers={
224
+ "content-type": "application/json",
225
+ },
223
226
  request_options=request_options,
224
227
  omit=OMIT,
225
228
  )
@@ -476,6 +479,9 @@ class AsyncContainerImagesClient:
476
479
  "sha": sha,
477
480
  "tags": tags,
478
481
  },
482
+ headers={
483
+ "content-type": "application/json",
484
+ },
479
485
  request_options=request_options,
480
486
  omit=OMIT,
481
487
  )
@@ -380,6 +380,9 @@ class DeploymentsClient:
380
380
  json={
381
381
  "history_item_id": history_item_id,
382
382
  },
383
+ headers={
384
+ "content-type": "application/json",
385
+ },
383
386
  request_options=request_options,
384
387
  omit=OMIT,
385
388
  )
@@ -474,6 +477,9 @@ class DeploymentsClient:
474
477
  object_=expand_meta, annotation=CompilePromptDeploymentExpandMetaRequest, direction="write"
475
478
  ),
476
479
  },
480
+ headers={
481
+ "content-type": "application/json",
482
+ },
477
483
  request_options=request_options,
478
484
  omit=OMIT,
479
485
  )
@@ -932,6 +938,9 @@ class AsyncDeploymentsClient:
932
938
  json={
933
939
  "history_item_id": history_item_id,
934
940
  },
941
+ headers={
942
+ "content-type": "application/json",
943
+ },
935
944
  request_options=request_options,
936
945
  omit=OMIT,
937
946
  )
@@ -1034,6 +1043,9 @@ class AsyncDeploymentsClient:
1034
1043
  object_=expand_meta, annotation=CompilePromptDeploymentExpandMetaRequest, direction="write"
1035
1044
  ),
1036
1045
  },
1046
+ headers={
1047
+ "content-type": "application/json",
1048
+ },
1037
1049
  request_options=request_options,
1038
1050
  omit=OMIT,
1039
1051
  )
@@ -187,6 +187,9 @@ class DocumentIndexesClient:
187
187
  ),
188
188
  "copy_documents_from_index_id": copy_documents_from_index_id,
189
189
  },
190
+ headers={
191
+ "content-type": "application/json",
192
+ },
190
193
  request_options=request_options,
191
194
  omit=OMIT,
192
195
  )
@@ -305,6 +308,9 @@ class DocumentIndexesClient:
305
308
  "label": label,
306
309
  "status": status,
307
310
  },
311
+ headers={
312
+ "content-type": "application/json",
313
+ },
308
314
  request_options=request_options,
309
315
  omit=OMIT,
310
316
  )
@@ -415,6 +421,9 @@ class DocumentIndexesClient:
415
421
  "label": label,
416
422
  "status": status,
417
423
  },
424
+ headers={
425
+ "content-type": "application/json",
426
+ },
418
427
  request_options=request_options,
419
428
  omit=OMIT,
420
429
  )
@@ -711,6 +720,9 @@ class AsyncDocumentIndexesClient:
711
720
  ),
712
721
  "copy_documents_from_index_id": copy_documents_from_index_id,
713
722
  },
723
+ headers={
724
+ "content-type": "application/json",
725
+ },
714
726
  request_options=request_options,
715
727
  omit=OMIT,
716
728
  )
@@ -845,6 +857,9 @@ class AsyncDocumentIndexesClient:
845
857
  "label": label,
846
858
  "status": status,
847
859
  },
860
+ headers={
861
+ "content-type": "application/json",
862
+ },
848
863
  request_options=request_options,
849
864
  omit=OMIT,
850
865
  )
@@ -971,6 +986,9 @@ class AsyncDocumentIndexesClient:
971
986
  "label": label,
972
987
  "status": status,
973
988
  },
989
+ headers={
990
+ "content-type": "application/json",
991
+ },
974
992
  request_options=request_options,
975
993
  omit=OMIT,
976
994
  )
@@ -241,6 +241,9 @@ class DocumentsClient:
241
241
  "status": status,
242
242
  "metadata": metadata,
243
243
  },
244
+ headers={
245
+ "content-type": "application/json",
246
+ },
244
247
  request_options=request_options,
245
248
  omit=OMIT,
246
249
  )
@@ -627,6 +630,9 @@ class AsyncDocumentsClient:
627
630
  "status": status,
628
631
  "metadata": metadata,
629
632
  },
633
+ headers={
634
+ "content-type": "application/json",
635
+ },
630
636
  request_options=request_options,
631
637
  omit=OMIT,
632
638
  )
@@ -152,6 +152,9 @@ class FolderEntitiesClient:
152
152
  json={
153
153
  "entity_id": entity_id,
154
154
  },
155
+ headers={
156
+ "content-type": "application/json",
157
+ },
155
158
  request_options=request_options,
156
159
  omit=OMIT,
157
160
  )
@@ -317,6 +320,9 @@ class AsyncFolderEntitiesClient:
317
320
  json={
318
321
  "entity_id": entity_id,
319
322
  },
323
+ headers={
324
+ "content-type": "application/json",
325
+ },
320
326
  request_options=request_options,
321
327
  omit=OMIT,
322
328
  )