vellum-ai 0.7.3__py3-none-any.whl → 0.7.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (483) hide show
  1. vellum/__init__.py +142 -94
  2. vellum/client.py +1051 -1097
  3. vellum/core/__init__.py +4 -1
  4. vellum/core/client_wrapper.py +7 -3
  5. vellum/core/http_client.py +365 -20
  6. vellum/core/jsonable_encoder.py +3 -0
  7. vellum/core/pydantic_utilities.py +16 -0
  8. vellum/core/query_encoder.py +33 -0
  9. vellum/core/remove_none_from_dict.py +2 -2
  10. vellum/core/request_options.py +2 -2
  11. vellum/resources/__init__.py +2 -0
  12. vellum/resources/deployments/client.py +349 -377
  13. vellum/resources/document_indexes/client.py +542 -610
  14. vellum/resources/documents/client.py +327 -399
  15. vellum/resources/folder_entities/client.py +56 -72
  16. vellum/{types/map_enum.py → resources/ml_models/__init__.py} +0 -3
  17. vellum/resources/ml_models/client.py +837 -0
  18. vellum/resources/sandboxes/client.py +204 -242
  19. vellum/resources/test_suite_runs/client.py +183 -213
  20. vellum/resources/test_suites/client.py +307 -311
  21. vellum/resources/workflow_deployments/client.py +230 -268
  22. vellum/resources/workflow_sandboxes/client.py +82 -96
  23. vellum/terraform/_jsii/vellum-ai_vellum@0.0.0.jsii.tgz +0 -0
  24. vellum/terraform/data_vellum_document_index/__init__.py +10 -10
  25. vellum/terraform/document_index/__init__.py +17 -17
  26. vellum/terraform/provider/__init__.py +57 -12
  27. vellum/terraform/versions.json +1 -1
  28. vellum/types/__init__.py +148 -96
  29. vellum/types/api_node_result.py +7 -3
  30. vellum/types/api_node_result_data.py +7 -3
  31. vellum/types/array_chat_message_content.py +7 -3
  32. vellum/types/array_chat_message_content_item.py +53 -12
  33. vellum/types/array_chat_message_content_item_request.py +53 -12
  34. vellum/types/array_chat_message_content_request.py +7 -3
  35. vellum/types/array_parameter_config.py +50 -0
  36. vellum/types/array_parameter_config_request.py +50 -0
  37. vellum/types/array_variable_value_item.py +102 -24
  38. vellum/types/array_vellum_value_item.py +102 -24
  39. vellum/types/array_vellum_value_item_request.py +102 -24
  40. vellum/types/basic_vectorizer_intfloat_multilingual_e_5_large.py +7 -3
  41. vellum/types/basic_vectorizer_intfloat_multilingual_e_5_large_request.py +7 -3
  42. vellum/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1.py +7 -3
  43. vellum/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1_request.py +7 -3
  44. vellum/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1.py +7 -3
  45. vellum/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1_request.py +7 -3
  46. vellum/types/boolean_parameter_config.py +35 -0
  47. vellum/types/boolean_parameter_config_request.py +35 -0
  48. vellum/types/chat_history_input_request.py +7 -3
  49. vellum/types/chat_message.py +7 -3
  50. vellum/types/chat_message_content.py +70 -16
  51. vellum/types/chat_message_content_request.py +70 -16
  52. vellum/types/chat_message_request.py +7 -3
  53. vellum/types/code_execution_node_array_result.py +7 -3
  54. vellum/types/code_execution_node_chat_history_result.py +7 -3
  55. vellum/types/code_execution_node_error_result.py +7 -3
  56. vellum/types/code_execution_node_function_call_result.py +7 -3
  57. vellum/types/code_execution_node_json_result.py +7 -3
  58. vellum/types/code_execution_node_number_result.py +7 -3
  59. vellum/types/code_execution_node_result.py +7 -3
  60. vellum/types/code_execution_node_result_data.py +7 -3
  61. vellum/types/code_execution_node_result_output.py +144 -32
  62. vellum/types/code_execution_node_search_results_result.py +7 -3
  63. vellum/types/code_execution_node_string_result.py +7 -3
  64. vellum/types/compile_prompt_deployment_expand_meta_request.py +7 -3
  65. vellum/types/compile_prompt_meta.py +7 -3
  66. vellum/types/conditional_node_result.py +7 -3
  67. vellum/types/conditional_node_result_data.py +7 -3
  68. vellum/types/const_parameter_config.py +35 -0
  69. vellum/types/const_parameter_config_request.py +35 -0
  70. vellum/types/create_test_suite_test_case_request.py +7 -3
  71. vellum/types/deployment_provider_payload_response.py +7 -3
  72. vellum/types/deployment_read.py +12 -3
  73. vellum/types/deployment_release_tag_deployment_history_item.py +7 -3
  74. vellum/types/deployment_release_tag_read.py +7 -3
  75. vellum/types/document_document_to_document_index.py +7 -3
  76. vellum/types/document_index_chunking.py +54 -12
  77. vellum/types/document_index_chunking_request.py +54 -12
  78. vellum/types/document_index_indexing_config.py +7 -3
  79. vellum/types/document_index_indexing_config_request.py +7 -3
  80. vellum/types/document_index_read.py +7 -3
  81. vellum/types/document_read.py +7 -3
  82. vellum/types/enriched_normalized_completion.py +7 -3
  83. vellum/types/error_variable_value.py +7 -3
  84. vellum/types/error_vellum_value.py +7 -3
  85. vellum/types/error_vellum_value_request.py +7 -3
  86. vellum/types/execute_prompt_event.py +82 -16
  87. vellum/types/execute_prompt_response.py +44 -8
  88. vellum/types/execute_workflow_response.py +7 -3
  89. vellum/types/execute_workflow_workflow_result_event.py +41 -8
  90. vellum/types/execution_array_vellum_value.py +7 -3
  91. vellum/types/execution_chat_history_vellum_value.py +7 -3
  92. vellum/types/execution_error_vellum_value.py +7 -3
  93. vellum/types/execution_function_call_vellum_value.py +7 -3
  94. vellum/types/execution_json_vellum_value.py +7 -3
  95. vellum/types/execution_number_vellum_value.py +7 -3
  96. vellum/types/execution_search_results_vellum_value.py +7 -3
  97. vellum/types/execution_string_vellum_value.py +7 -3
  98. vellum/types/execution_vellum_value.py +152 -32
  99. vellum/types/external_test_case_execution.py +7 -3
  100. vellum/types/external_test_case_execution_request.py +7 -3
  101. vellum/types/fulfilled_execute_prompt_event.py +7 -3
  102. vellum/types/fulfilled_execute_prompt_response.py +7 -3
  103. vellum/types/fulfilled_execute_workflow_workflow_result_event.py +7 -3
  104. vellum/types/fulfilled_prompt_execution_meta.py +7 -3
  105. vellum/types/fulfilled_workflow_node_result_event.py +7 -3
  106. vellum/types/function_call.py +7 -3
  107. vellum/types/function_call_chat_message_content.py +7 -3
  108. vellum/types/function_call_chat_message_content_request.py +7 -3
  109. vellum/types/function_call_chat_message_content_value.py +7 -3
  110. vellum/types/function_call_chat_message_content_value_request.py +7 -3
  111. vellum/types/function_call_request.py +7 -3
  112. vellum/types/function_call_variable_value.py +7 -3
  113. vellum/types/function_call_vellum_value.py +7 -3
  114. vellum/types/function_call_vellum_value_request.py +7 -3
  115. vellum/types/generate_options_request.py +7 -3
  116. vellum/types/generate_request.py +7 -3
  117. vellum/types/generate_result.py +7 -3
  118. vellum/types/generate_result_data.py +7 -3
  119. vellum/types/generate_result_error.py +7 -3
  120. vellum/types/generate_stream_response.py +7 -3
  121. vellum/types/generate_stream_result.py +7 -3
  122. vellum/types/generate_stream_result_data.py +7 -3
  123. vellum/types/hkunlp_instructor_xl_vectorizer.py +7 -3
  124. vellum/types/hkunlp_instructor_xl_vectorizer_request.py +7 -3
  125. vellum/types/hosted_by_enum.py +26 -0
  126. vellum/types/hugging_face_tokenizer_config.py +34 -0
  127. vellum/types/hugging_face_tokenizer_config_request.py +34 -0
  128. vellum/types/image_chat_message_content.py +7 -3
  129. vellum/types/image_chat_message_content_request.py +7 -3
  130. vellum/types/image_variable_value.py +7 -3
  131. vellum/types/image_vellum_value.py +7 -3
  132. vellum/types/image_vellum_value_request.py +7 -3
  133. vellum/types/indexing_config_vectorizer.py +117 -36
  134. vellum/types/indexing_config_vectorizer_request.py +117 -36
  135. vellum/types/initiated_execute_prompt_event.py +7 -3
  136. vellum/types/initiated_prompt_execution_meta.py +7 -3
  137. vellum/types/initiated_workflow_node_result_event.py +7 -3
  138. vellum/types/instructor_vectorizer_config.py +7 -3
  139. vellum/types/instructor_vectorizer_config_request.py +7 -3
  140. vellum/types/integer_parameter_config.py +39 -0
  141. vellum/types/integer_parameter_config_request.py +39 -0
  142. vellum/types/json_input_request.py +7 -3
  143. vellum/types/json_variable_value.py +7 -3
  144. vellum/types/json_vellum_value.py +7 -3
  145. vellum/types/json_vellum_value_request.py +7 -3
  146. vellum/types/map_node_result.py +7 -3
  147. vellum/types/map_node_result_data.py +7 -3
  148. vellum/types/merge_node_result.py +7 -3
  149. vellum/types/merge_node_result_data.py +7 -3
  150. vellum/types/metadata_filter_config_request.py +7 -3
  151. vellum/types/metadata_filter_rule_request.py +7 -3
  152. vellum/types/metric_node_result.py +7 -3
  153. vellum/types/{execute_workflow_stream_error_response.py → ml_model_build_config.py} +9 -8
  154. vellum/types/{execute_prompt_api_error_response.py → ml_model_build_config_request.py} +9 -8
  155. vellum/types/ml_model_developer.py +27 -0
  156. vellum/types/ml_model_developer_enum_value_label.py +31 -0
  157. vellum/types/ml_model_display_config_labelled.py +33 -0
  158. vellum/types/ml_model_display_config_request.py +33 -0
  159. vellum/types/ml_model_display_tag.py +7 -0
  160. vellum/types/ml_model_display_tag_enum_value_label.py +31 -0
  161. vellum/types/ml_model_exec_config.py +40 -0
  162. vellum/types/ml_model_exec_config_request.py +40 -0
  163. vellum/types/ml_model_family.py +29 -0
  164. vellum/types/ml_model_family_enum_value_label.py +31 -0
  165. vellum/types/ml_model_feature.py +18 -0
  166. vellum/types/ml_model_parameter_config.py +42 -0
  167. vellum/types/ml_model_parameter_config_request.py +42 -0
  168. vellum/types/ml_model_read.py +108 -0
  169. vellum/types/ml_model_request_authorization_config.py +30 -0
  170. vellum/types/ml_model_request_authorization_config_request.py +30 -0
  171. vellum/types/ml_model_request_authorization_config_type_enum.py +5 -0
  172. vellum/types/ml_model_request_config.py +32 -0
  173. vellum/types/ml_model_request_config_request.py +32 -0
  174. vellum/types/ml_model_response_config.py +31 -0
  175. vellum/types/ml_model_response_config_request.py +31 -0
  176. vellum/types/ml_model_tokenizer_config.py +59 -0
  177. vellum/types/ml_model_tokenizer_config_request.py +61 -0
  178. vellum/types/ml_model_usage.py +7 -3
  179. vellum/types/named_scenario_input_chat_history_variable_value_request.py +7 -3
  180. vellum/types/named_scenario_input_request.py +38 -8
  181. vellum/types/named_scenario_input_string_variable_value_request.py +7 -3
  182. vellum/types/named_test_case_array_variable_value.py +7 -3
  183. vellum/types/named_test_case_array_variable_value_request.py +7 -3
  184. vellum/types/named_test_case_chat_history_variable_value.py +7 -3
  185. vellum/types/named_test_case_chat_history_variable_value_request.py +7 -3
  186. vellum/types/named_test_case_error_variable_value.py +7 -3
  187. vellum/types/named_test_case_error_variable_value_request.py +7 -3
  188. vellum/types/named_test_case_function_call_variable_value.py +7 -3
  189. vellum/types/named_test_case_function_call_variable_value_request.py +7 -3
  190. vellum/types/named_test_case_json_variable_value.py +7 -3
  191. vellum/types/named_test_case_json_variable_value_request.py +7 -3
  192. vellum/types/named_test_case_number_variable_value.py +7 -3
  193. vellum/types/named_test_case_number_variable_value_request.py +7 -3
  194. vellum/types/named_test_case_search_results_variable_value.py +7 -3
  195. vellum/types/named_test_case_search_results_variable_value_request.py +7 -3
  196. vellum/types/named_test_case_string_variable_value.py +7 -3
  197. vellum/types/named_test_case_string_variable_value_request.py +7 -3
  198. vellum/types/named_test_case_variable_value.py +144 -32
  199. vellum/types/named_test_case_variable_value_request.py +144 -32
  200. vellum/types/node_input_compiled_array_value.py +7 -3
  201. vellum/types/node_input_compiled_chat_history_value.py +7 -3
  202. vellum/types/node_input_compiled_error_value.py +7 -3
  203. vellum/types/node_input_compiled_function_call.py +7 -3
  204. vellum/types/node_input_compiled_json_value.py +7 -3
  205. vellum/types/node_input_compiled_number_value.py +7 -3
  206. vellum/types/node_input_compiled_search_results_value.py +7 -3
  207. vellum/types/node_input_compiled_string_value.py +7 -3
  208. vellum/types/node_input_variable_compiled_value.py +152 -32
  209. vellum/types/node_output_compiled_array_value.py +7 -3
  210. vellum/types/node_output_compiled_chat_history_value.py +7 -3
  211. vellum/types/node_output_compiled_error_value.py +7 -3
  212. vellum/types/node_output_compiled_function_call_value.py +7 -3
  213. vellum/types/node_output_compiled_json_value.py +7 -3
  214. vellum/types/node_output_compiled_number_value.py +7 -3
  215. vellum/types/node_output_compiled_search_results_value.py +7 -3
  216. vellum/types/node_output_compiled_string_value.py +7 -3
  217. vellum/types/node_output_compiled_value.py +153 -32
  218. vellum/types/normalized_log_probs.py +7 -3
  219. vellum/types/normalized_token_log_probs.py +7 -3
  220. vellum/types/number_parameter_config.py +40 -0
  221. vellum/types/number_parameter_config_request.py +40 -0
  222. vellum/types/number_variable_value.py +7 -3
  223. vellum/types/number_vellum_value.py +7 -3
  224. vellum/types/number_vellum_value_request.py +7 -3
  225. vellum/types/object_parameter_config.py +49 -0
  226. vellum/types/object_parameter_config_request.py +49 -0
  227. vellum/types/one_of_parameter_config.py +44 -0
  228. vellum/types/one_of_parameter_config_request.py +44 -0
  229. vellum/types/open_ai_vectorizer_config.py +7 -3
  230. vellum/types/open_ai_vectorizer_config_request.py +7 -3
  231. vellum/types/open_ai_vectorizer_text_embedding_3_large.py +7 -3
  232. vellum/types/open_ai_vectorizer_text_embedding_3_large_request.py +7 -3
  233. vellum/types/open_ai_vectorizer_text_embedding_3_small.py +7 -3
  234. vellum/types/open_ai_vectorizer_text_embedding_3_small_request.py +7 -3
  235. vellum/types/open_ai_vectorizer_text_embedding_ada_002.py +7 -3
  236. vellum/types/open_ai_vectorizer_text_embedding_ada_002_request.py +7 -3
  237. vellum/types/paginated_document_index_read_list.py +7 -3
  238. vellum/types/paginated_ml_model_read_list.py +33 -0
  239. vellum/types/paginated_slim_deployment_read_list.py +7 -3
  240. vellum/types/paginated_slim_document_list.py +7 -3
  241. vellum/types/paginated_slim_workflow_deployment_list.py +7 -3
  242. vellum/types/paginated_test_suite_run_execution_list.py +7 -3
  243. vellum/types/paginated_test_suite_test_case_list.py +7 -3
  244. vellum/types/parameter_config.py +251 -0
  245. vellum/types/parameter_config_request.py +251 -0
  246. vellum/types/pdf_search_result_meta_source.py +7 -3
  247. vellum/types/pdf_search_result_meta_source_request.py +7 -3
  248. vellum/types/prompt_deployment_expand_meta_request_request.py +7 -3
  249. vellum/types/prompt_deployment_input_request.py +55 -12
  250. vellum/types/prompt_execution_meta.py +7 -3
  251. vellum/types/prompt_node_execution_meta.py +7 -3
  252. vellum/types/prompt_node_result.py +7 -3
  253. vellum/types/prompt_node_result_data.py +7 -3
  254. vellum/types/prompt_output.py +69 -16
  255. vellum/types/raw_prompt_execution_overrides_request.py +7 -3
  256. vellum/types/reducto_chunker_config.py +7 -3
  257. vellum/types/reducto_chunker_config_request.py +7 -3
  258. vellum/types/reducto_chunking.py +7 -3
  259. vellum/types/reducto_chunking_request.py +7 -3
  260. vellum/types/rejected_execute_prompt_event.py +7 -3
  261. vellum/types/rejected_execute_prompt_response.py +7 -3
  262. vellum/types/rejected_execute_workflow_workflow_result_event.py +7 -3
  263. vellum/types/rejected_prompt_execution_meta.py +7 -3
  264. vellum/types/rejected_workflow_node_result_event.py +7 -3
  265. vellum/types/replace_test_suite_test_case_request.py +7 -3
  266. vellum/types/sandbox_scenario.py +7 -3
  267. vellum/types/scenario_input.py +38 -8
  268. vellum/types/scenario_input_chat_history_variable_value.py +7 -3
  269. vellum/types/scenario_input_string_variable_value.py +7 -3
  270. vellum/types/search_filters_request.py +7 -3
  271. vellum/types/search_node_result.py +7 -3
  272. vellum/types/search_node_result_data.py +7 -3
  273. vellum/types/search_request_options_request.py +7 -3
  274. vellum/types/search_response.py +7 -3
  275. vellum/types/search_result.py +7 -3
  276. vellum/types/search_result_document.py +7 -3
  277. vellum/types/search_result_document_request.py +7 -3
  278. vellum/types/search_result_merging_request.py +7 -3
  279. vellum/types/search_result_meta.py +7 -3
  280. vellum/types/search_result_meta_request.py +7 -3
  281. vellum/types/search_result_meta_source.py +21 -5
  282. vellum/types/search_result_meta_source_request.py +21 -5
  283. vellum/types/search_result_request.py +7 -3
  284. vellum/types/search_weights_request.py +7 -3
  285. vellum/types/sentence_chunker_config.py +7 -3
  286. vellum/types/sentence_chunker_config_request.py +7 -3
  287. vellum/types/sentence_chunking.py +7 -3
  288. vellum/types/sentence_chunking_request.py +7 -3
  289. vellum/types/slim_deployment_read.py +11 -3
  290. vellum/types/slim_document.py +7 -3
  291. vellum/types/slim_workflow_deployment.py +12 -3
  292. vellum/types/streaming_execute_prompt_event.py +7 -3
  293. vellum/types/streaming_prompt_execution_meta.py +7 -3
  294. vellum/types/streaming_workflow_node_result_event.py +7 -3
  295. vellum/types/string_chat_message_content.py +7 -3
  296. vellum/types/string_chat_message_content_request.py +7 -3
  297. vellum/types/string_input_request.py +7 -3
  298. vellum/types/string_parameter_config.py +39 -0
  299. vellum/types/string_parameter_config_request.py +39 -0
  300. vellum/types/string_variable_value.py +7 -3
  301. vellum/types/string_vellum_value.py +7 -3
  302. vellum/types/string_vellum_value_request.py +7 -3
  303. vellum/types/submit_completion_actual_request.py +7 -3
  304. vellum/types/submit_workflow_execution_actual_request.py +67 -12
  305. vellum/types/subworkflow_node_result.py +7 -3
  306. vellum/types/subworkflow_node_result_data.py +7 -3
  307. vellum/types/templating_node_array_result.py +7 -3
  308. vellum/types/templating_node_chat_history_result.py +7 -3
  309. vellum/types/templating_node_error_result.py +7 -3
  310. vellum/types/templating_node_function_call_result.py +7 -3
  311. vellum/types/templating_node_json_result.py +7 -3
  312. vellum/types/templating_node_number_result.py +7 -3
  313. vellum/types/templating_node_result.py +7 -3
  314. vellum/types/templating_node_result_data.py +7 -3
  315. vellum/types/templating_node_result_output.py +144 -32
  316. vellum/types/templating_node_search_results_result.py +7 -3
  317. vellum/types/templating_node_string_result.py +7 -3
  318. vellum/types/terminal_node_array_result.py +7 -3
  319. vellum/types/terminal_node_chat_history_result.py +7 -3
  320. vellum/types/terminal_node_error_result.py +7 -3
  321. vellum/types/terminal_node_function_call_result.py +7 -3
  322. vellum/types/terminal_node_json_result.py +7 -3
  323. vellum/types/terminal_node_number_result.py +7 -3
  324. vellum/types/terminal_node_result.py +7 -3
  325. vellum/types/terminal_node_result_data.py +7 -3
  326. vellum/types/terminal_node_result_output.py +152 -32
  327. vellum/types/terminal_node_search_results_result.py +7 -3
  328. vellum/types/terminal_node_string_result.py +7 -3
  329. vellum/types/test_case_array_variable_value.py +7 -3
  330. vellum/types/test_case_chat_history_variable_value.py +7 -3
  331. vellum/types/test_case_error_variable_value.py +7 -3
  332. vellum/types/test_case_function_call_variable_value.py +7 -3
  333. vellum/types/test_case_json_variable_value.py +8 -4
  334. vellum/types/test_case_number_variable_value.py +7 -3
  335. vellum/types/test_case_search_results_variable_value.py +7 -3
  336. vellum/types/test_case_string_variable_value.py +7 -3
  337. vellum/types/test_case_variable_value.py +152 -32
  338. vellum/types/test_suite_run_deployment_release_tag_exec_config.py +7 -3
  339. vellum/types/test_suite_run_deployment_release_tag_exec_config_data.py +7 -3
  340. vellum/types/test_suite_run_deployment_release_tag_exec_config_data_request.py +7 -3
  341. vellum/types/test_suite_run_deployment_release_tag_exec_config_request.py +7 -3
  342. vellum/types/test_suite_run_exec_config.py +57 -12
  343. vellum/types/test_suite_run_exec_config_request.py +61 -12
  344. vellum/types/test_suite_run_execution.py +7 -3
  345. vellum/types/test_suite_run_execution_array_output.py +7 -3
  346. vellum/types/test_suite_run_execution_chat_history_output.py +7 -3
  347. vellum/types/test_suite_run_execution_error_output.py +7 -3
  348. vellum/types/test_suite_run_execution_function_call_output.py +7 -3
  349. vellum/types/test_suite_run_execution_json_output.py +7 -3
  350. vellum/types/test_suite_run_execution_metric_definition.py +7 -3
  351. vellum/types/test_suite_run_execution_metric_result.py +7 -3
  352. vellum/types/test_suite_run_execution_number_output.py +7 -3
  353. vellum/types/test_suite_run_execution_output.py +152 -32
  354. vellum/types/test_suite_run_execution_search_results_output.py +7 -3
  355. vellum/types/test_suite_run_execution_string_output.py +7 -3
  356. vellum/types/test_suite_run_external_exec_config.py +7 -3
  357. vellum/types/test_suite_run_external_exec_config_data.py +7 -3
  358. vellum/types/test_suite_run_external_exec_config_data_request.py +7 -3
  359. vellum/types/test_suite_run_external_exec_config_request.py +7 -3
  360. vellum/types/test_suite_run_metric_error_output.py +7 -3
  361. vellum/types/test_suite_run_metric_number_output.py +7 -3
  362. vellum/types/test_suite_run_metric_output.py +55 -12
  363. vellum/types/test_suite_run_metric_string_output.py +7 -3
  364. vellum/types/test_suite_run_read.py +7 -3
  365. vellum/types/test_suite_run_test_suite.py +7 -3
  366. vellum/types/test_suite_run_workflow_release_tag_exec_config.py +7 -3
  367. vellum/types/test_suite_run_workflow_release_tag_exec_config_data.py +7 -3
  368. vellum/types/test_suite_run_workflow_release_tag_exec_config_data_request.py +7 -3
  369. vellum/types/test_suite_run_workflow_release_tag_exec_config_request.py +7 -3
  370. vellum/types/test_suite_test_case.py +7 -3
  371. vellum/types/test_suite_test_case_bulk_operation_request.py +75 -16
  372. vellum/types/test_suite_test_case_bulk_result.py +74 -16
  373. vellum/types/test_suite_test_case_create_bulk_operation_request.py +7 -3
  374. vellum/types/test_suite_test_case_created_bulk_result.py +7 -3
  375. vellum/types/test_suite_test_case_created_bulk_result_data.py +7 -3
  376. vellum/types/test_suite_test_case_delete_bulk_operation_data_request.py +7 -3
  377. vellum/types/test_suite_test_case_delete_bulk_operation_request.py +7 -3
  378. vellum/types/test_suite_test_case_deleted_bulk_result.py +7 -3
  379. vellum/types/test_suite_test_case_deleted_bulk_result_data.py +7 -3
  380. vellum/types/test_suite_test_case_rejected_bulk_result.py +7 -3
  381. vellum/types/test_suite_test_case_replace_bulk_operation_request.py +7 -3
  382. vellum/types/test_suite_test_case_replaced_bulk_result.py +7 -3
  383. vellum/types/test_suite_test_case_replaced_bulk_result_data.py +7 -3
  384. vellum/types/test_suite_test_case_upsert_bulk_operation_request.py +7 -3
  385. vellum/types/{execute_workflow_error_response.py → tik_token_tokenizer_config.py} +11 -6
  386. vellum/types/{generate_error_response.py → tik_token_tokenizer_config_request.py} +11 -6
  387. vellum/types/token_overlapping_window_chunker_config.py +7 -3
  388. vellum/types/token_overlapping_window_chunker_config_request.py +7 -3
  389. vellum/types/token_overlapping_window_chunking.py +7 -3
  390. vellum/types/token_overlapping_window_chunking_request.py +7 -3
  391. vellum/types/upload_document_response.py +7 -3
  392. vellum/types/upsert_test_suite_test_case_request.py +7 -3
  393. vellum/types/vellum_error.py +7 -3
  394. vellum/types/vellum_error_request.py +7 -3
  395. vellum/types/vellum_image.py +7 -3
  396. vellum/types/vellum_image_request.py +7 -3
  397. vellum/types/vellum_variable.py +7 -3
  398. vellum/types/visibility_enum.py +5 -0
  399. vellum/types/workflow_deployment_read.py +12 -3
  400. vellum/types/workflow_event_error.py +7 -3
  401. vellum/types/workflow_execution_actual_chat_history_request.py +7 -3
  402. vellum/types/workflow_execution_actual_json_request.py +7 -3
  403. vellum/types/workflow_execution_actual_string_request.py +7 -3
  404. vellum/types/workflow_execution_node_result_event.py +7 -3
  405. vellum/types/workflow_execution_workflow_result_event.py +7 -3
  406. vellum/types/workflow_expand_meta_request.py +7 -3
  407. vellum/types/workflow_node_result_data.py +189 -45
  408. vellum/types/workflow_node_result_event.py +101 -20
  409. vellum/types/workflow_output.py +171 -36
  410. vellum/types/workflow_output_array.py +7 -3
  411. vellum/types/workflow_output_chat_history.py +7 -3
  412. vellum/types/workflow_output_error.py +7 -3
  413. vellum/types/workflow_output_function_call.py +7 -3
  414. vellum/types/workflow_output_image.py +7 -3
  415. vellum/types/workflow_output_json.py +7 -3
  416. vellum/types/workflow_output_number.py +7 -3
  417. vellum/types/workflow_output_search_results.py +7 -3
  418. vellum/types/workflow_output_string.py +7 -3
  419. vellum/types/workflow_release_tag_read.py +7 -3
  420. vellum/types/workflow_release_tag_workflow_deployment_history_item.py +7 -3
  421. vellum/types/workflow_request_chat_history_input_request.py +7 -3
  422. vellum/types/workflow_request_input_request.py +72 -16
  423. vellum/types/workflow_request_json_input_request.py +7 -3
  424. vellum/types/workflow_request_number_input_request.py +7 -3
  425. vellum/types/workflow_request_string_input_request.py +7 -3
  426. vellum/types/workflow_result_event.py +7 -3
  427. vellum/types/workflow_result_event_output_data.py +178 -33
  428. vellum/types/workflow_result_event_output_data_array.py +7 -3
  429. vellum/types/workflow_result_event_output_data_chat_history.py +7 -3
  430. vellum/types/workflow_result_event_output_data_error.py +7 -3
  431. vellum/types/workflow_result_event_output_data_function_call.py +7 -3
  432. vellum/types/workflow_result_event_output_data_json.py +7 -3
  433. vellum/types/workflow_result_event_output_data_number.py +7 -3
  434. vellum/types/workflow_result_event_output_data_search_results.py +7 -3
  435. vellum/types/workflow_result_event_output_data_string.py +7 -3
  436. vellum/types/workflow_stream_event.py +43 -8
  437. {vellum_ai-0.7.3.dist-info → vellum_ai-0.7.5.dist-info}/METADATA +13 -1
  438. vellum_ai-0.7.5.dist-info/RECORD +502 -0
  439. vellum/types/array_enum.py +0 -5
  440. vellum/types/chat_history_enum.py +0 -5
  441. vellum/types/create_enum.py +0 -5
  442. vellum/types/created_enum.py +0 -5
  443. vellum/types/delete_enum.py +0 -5
  444. vellum/types/deleted_enum.py +0 -5
  445. vellum/types/error_enum.py +0 -5
  446. vellum/types/function_call_enum.py +0 -5
  447. vellum/types/hkunlp_instructor_xl_enum.py +0 -5
  448. vellum/types/image_enum.py +0 -5
  449. vellum/types/initiated_enum.py +0 -5
  450. vellum/types/intfloat_multilingual_e_5_large_enum.py +0 -5
  451. vellum/types/json_enum.py +0 -5
  452. vellum/types/merge_enum.py +0 -5
  453. vellum/types/metric_enum.py +0 -5
  454. vellum/types/number_enum.py +0 -5
  455. vellum/types/pdf_enum.py +0 -5
  456. vellum/types/reducto_chunker_enum.py +0 -5
  457. vellum/types/rejected_enum.py +0 -5
  458. vellum/types/replace_enum.py +0 -5
  459. vellum/types/replaced_enum.py +0 -5
  460. vellum/types/search_error_response.py +0 -28
  461. vellum/types/search_results_enum.py +0 -5
  462. vellum/types/sentence_chunker_enum.py +0 -5
  463. vellum/types/sentence_transformers_multi_qa_mpnet_base_cos_v_1_enum.py +0 -5
  464. vellum/types/sentence_transformers_multi_qa_mpnet_base_dot_v_1_enum.py +0 -5
  465. vellum/types/streaming_enum.py +0 -5
  466. vellum/types/string_enum.py +0 -5
  467. vellum/types/submit_completion_actuals_error_response.py +0 -25
  468. vellum/types/subworkflow_enum.py +0 -5
  469. vellum/types/test_suite_run_deployment_release_tag_exec_config_type_enum.py +0 -5
  470. vellum/types/test_suite_run_external_exec_config_type_enum.py +0 -5
  471. vellum/types/test_suite_run_metric_error_output_type_enum.py +0 -5
  472. vellum/types/test_suite_run_metric_number_output_type_enum.py +0 -5
  473. vellum/types/test_suite_run_metric_string_output_type_enum.py +0 -5
  474. vellum/types/test_suite_run_workflow_release_tag_exec_config_type_enum.py +0 -5
  475. vellum/types/text_embedding_3_large_enum.py +0 -5
  476. vellum/types/text_embedding_3_small_enum.py +0 -5
  477. vellum/types/text_embedding_ada_002_enum.py +0 -5
  478. vellum/types/token_overlapping_window_chunker_enum.py +0 -5
  479. vellum/types/upload_document_error_response.py +0 -25
  480. vellum/types/upsert_enum.py +0 -5
  481. vellum_ai-0.7.3.dist-info/RECORD +0 -496
  482. {vellum_ai-0.7.3.dist-info → vellum_ai-0.7.5.dist-info}/LICENSE +0 -0
  483. {vellum_ai-0.7.3.dist-info → vellum_ai-0.7.5.dist-info}/WHEEL +0 -0
vellum/client.py CHANGED
@@ -2,16 +2,13 @@
2
2
 
3
3
  import json
4
4
  import typing
5
- import urllib.parse
6
5
  from json.decoder import JSONDecodeError
7
6
 
8
7
  import httpx
9
8
 
10
9
  from .core.api_error import ApiError
11
10
  from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
12
- from .core.jsonable_encoder import jsonable_encoder
13
11
  from .core.pydantic_utilities import pydantic_v1
14
- from .core.remove_none_from_dict import remove_none_from_dict
15
12
  from .core.request_options import RequestOptions
16
13
  from .environment import VellumEnvironment
17
14
  from .errors.bad_request_error import BadRequestError
@@ -22,6 +19,7 @@ from .resources.deployments.client import AsyncDeploymentsClient, DeploymentsCli
22
19
  from .resources.document_indexes.client import AsyncDocumentIndexesClient, DocumentIndexesClient
23
20
  from .resources.documents.client import AsyncDocumentsClient, DocumentsClient
24
21
  from .resources.folder_entities.client import AsyncFolderEntitiesClient, FolderEntitiesClient
22
+ from .resources.ml_models.client import AsyncMlModelsClient, MlModelsClient
25
23
  from .resources.sandboxes.client import AsyncSandboxesClient, SandboxesClient
26
24
  from .resources.test_suite_runs.client import AsyncTestSuiteRunsClient, TestSuiteRunsClient
27
25
  from .resources.test_suites.client import AsyncTestSuitesClient, TestSuitesClient
@@ -52,21 +50,31 @@ OMIT = typing.cast(typing.Any, ...)
52
50
 
53
51
  class Vellum:
54
52
  """
55
- Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
53
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
56
54
 
57
- Parameters:
58
- - environment: VellumEnvironment. The environment to use for requests from the client. from .environment import VellumEnvironment
55
+ Parameters
56
+ ----------
57
+ environment : VellumEnvironment
58
+ The environment to use for requests from the client. from .environment import VellumEnvironment
59
59
 
60
- Defaults to VellumEnvironment.PRODUCTION
61
60
 
62
- - api_key: str.
63
61
 
64
- - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
62
+ Defaults to VellumEnvironment.PRODUCTION
65
63
 
66
- - follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
67
64
 
68
- - httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
69
- ---
65
+
66
+ api_key : str
67
+ timeout : typing.Optional[float]
68
+ The timeout to be used, in seconds, for requests. By default there is no timeout set, unless a custom httpx client is used, in which case this default is not enforced.
69
+
70
+ follow_redirects : typing.Optional[bool]
71
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
72
+
73
+ httpx_client : typing.Optional[httpx.Client]
74
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
75
+
76
+ Examples
77
+ --------
70
78
  from vellum.client import Vellum
71
79
 
72
80
  client = Vellum(
@@ -81,7 +89,7 @@ class Vellum:
81
89
  api_key: str,
82
90
  timeout: typing.Optional[float] = None,
83
91
  follow_redirects: typing.Optional[bool] = True,
84
- httpx_client: typing.Optional[httpx.Client] = None,
92
+ httpx_client: typing.Optional[httpx.Client] = None
85
93
  ):
86
94
  _defaulted_timeout = timeout if timeout is not None else None if httpx_client is None else None
87
95
  self._client_wrapper = SyncClientWrapper(
@@ -98,6 +106,7 @@ class Vellum:
98
106
  self.document_indexes = DocumentIndexesClient(client_wrapper=self._client_wrapper)
99
107
  self.documents = DocumentsClient(client_wrapper=self._client_wrapper)
100
108
  self.folder_entities = FolderEntitiesClient(client_wrapper=self._client_wrapper)
109
+ self.ml_models = MlModelsClient(client_wrapper=self._client_wrapper)
101
110
  self.sandboxes = SandboxesClient(client_wrapper=self._client_wrapper)
102
111
  self.test_suite_runs = TestSuiteRunsClient(client_wrapper=self._client_wrapper)
103
112
  self.test_suites = TestSuitesClient(client_wrapper=self._client_wrapper)
@@ -116,32 +125,50 @@ class Vellum:
116
125
  raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest] = OMIT,
117
126
  expand_raw: typing.Optional[typing.Sequence[str]] = OMIT,
118
127
  metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
119
- request_options: typing.Optional[RequestOptions] = None,
128
+ request_options: typing.Optional[RequestOptions] = None
120
129
  ) -> ExecutePromptResponse:
121
130
  """
122
131
  Executes a deployed Prompt and returns the result.
123
132
 
124
- Parameters:
125
- - inputs: typing.Sequence[PromptDeploymentInputRequest]. A list consisting of the Prompt Deployment's input variables and their values.
133
+ Parameters
134
+ ----------
135
+ inputs : typing.Sequence[PromptDeploymentInputRequest]
136
+ A list consisting of the Prompt Deployment's input variables and their values.
137
+
138
+ prompt_deployment_id : typing.Optional[str]
139
+ The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
140
+
141
+ prompt_deployment_name : typing.Optional[str]
142
+ The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
143
+
144
+ release_tag : typing.Optional[str]
145
+ Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
126
146
 
127
- - prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
147
+ external_id : typing.Optional[str]
148
+ Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
128
149
 
129
- - prompt_deployment_name: typing.Optional[str]. The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
150
+ expand_meta : typing.Optional[PromptDeploymentExpandMetaRequestRequest]
151
+ An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
130
152
 
131
- - release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
153
+ raw_overrides : typing.Optional[RawPromptExecutionOverridesRequest]
154
+ Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
132
155
 
133
- - external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
156
+ expand_raw : typing.Optional[typing.Sequence[str]]
157
+ A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
134
158
 
135
- - expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest]. An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
159
+ metadata : typing.Optional[typing.Dict[str, typing.Any]]
160
+ Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
136
161
 
137
- - raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest]. Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
162
+ request_options : typing.Optional[RequestOptions]
163
+ Request-specific configuration.
138
164
 
139
- - expand_raw: typing.Optional[typing.Sequence[str]]. A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
165
+ Returns
166
+ -------
167
+ ExecutePromptResponse
140
168
 
141
- - metadata: typing.Optional[typing.Dict[str, typing.Any]]. Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
142
169
 
143
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
144
- ---
170
+ Examples
171
+ --------
145
172
  from vellum import (
146
173
  PromptDeploymentExpandMetaRequestRequest,
147
174
  PromptDeploymentInputRequest_String,
@@ -180,60 +207,35 @@ class Vellum:
180
207
  metadata={"string": {"key": "value"}},
181
208
  )
182
209
  """
183
- _request: typing.Dict[str, typing.Any] = {"inputs": inputs}
184
- if prompt_deployment_id is not OMIT:
185
- _request["prompt_deployment_id"] = prompt_deployment_id
186
- if prompt_deployment_name is not OMIT:
187
- _request["prompt_deployment_name"] = prompt_deployment_name
188
- if release_tag is not OMIT:
189
- _request["release_tag"] = release_tag
190
- if external_id is not OMIT:
191
- _request["external_id"] = external_id
192
- if expand_meta is not OMIT:
193
- _request["expand_meta"] = expand_meta
194
- if raw_overrides is not OMIT:
195
- _request["raw_overrides"] = raw_overrides
196
- if expand_raw is not OMIT:
197
- _request["expand_raw"] = expand_raw
198
- if metadata is not OMIT:
199
- _request["metadata"] = metadata
200
210
  _response = self._client_wrapper.httpx_client.request(
211
+ "v1/execute-prompt",
212
+ base_url=self._client_wrapper.get_environment().predict,
201
213
  method="POST",
202
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt"),
203
- params=jsonable_encoder(
204
- request_options.get("additional_query_parameters") if request_options is not None else None
205
- ),
206
- json=jsonable_encoder(_request)
207
- if request_options is None or request_options.get("additional_body_parameters") is None
208
- else {
209
- **jsonable_encoder(_request),
210
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
214
+ json={
215
+ "inputs": inputs,
216
+ "prompt_deployment_id": prompt_deployment_id,
217
+ "prompt_deployment_name": prompt_deployment_name,
218
+ "release_tag": release_tag,
219
+ "external_id": external_id,
220
+ "expand_meta": expand_meta,
221
+ "raw_overrides": raw_overrides,
222
+ "expand_raw": expand_raw,
223
+ "metadata": metadata,
211
224
  },
212
- headers=jsonable_encoder(
213
- remove_none_from_dict(
214
- {
215
- **self._client_wrapper.get_headers(),
216
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
217
- }
218
- )
219
- ),
220
- timeout=request_options.get("timeout_in_seconds")
221
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
222
- else self._client_wrapper.get_timeout(),
223
- retries=0,
224
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
225
+ request_options=request_options,
226
+ omit=OMIT,
225
227
  )
226
- if 200 <= _response.status_code < 300:
227
- return pydantic_v1.parse_obj_as(ExecutePromptResponse, _response.json()) # type: ignore
228
- if _response.status_code == 400:
229
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
230
- if _response.status_code == 403:
231
- raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
232
- if _response.status_code == 404:
233
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
234
- if _response.status_code == 500:
235
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
236
228
  try:
229
+ if 200 <= _response.status_code < 300:
230
+ return pydantic_v1.parse_obj_as(ExecutePromptResponse, _response.json()) # type: ignore
231
+ if _response.status_code == 400:
232
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
233
+ if _response.status_code == 403:
234
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
235
+ if _response.status_code == 404:
236
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
237
+ if _response.status_code == 500:
238
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
237
239
  _response_json = _response.json()
238
240
  except JSONDecodeError:
239
241
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -251,32 +253,50 @@ class Vellum:
251
253
  raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest] = OMIT,
252
254
  expand_raw: typing.Optional[typing.Sequence[str]] = OMIT,
253
255
  metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
254
- request_options: typing.Optional[RequestOptions] = None,
256
+ request_options: typing.Optional[RequestOptions] = None
255
257
  ) -> typing.Iterator[ExecutePromptEvent]:
256
258
  """
257
259
  Executes a deployed Prompt and streams back the results.
258
260
 
259
- Parameters:
260
- - inputs: typing.Sequence[PromptDeploymentInputRequest]. A list consisting of the Prompt Deployment's input variables and their values.
261
+ Parameters
262
+ ----------
263
+ inputs : typing.Sequence[PromptDeploymentInputRequest]
264
+ A list consisting of the Prompt Deployment's input variables and their values.
265
+
266
+ prompt_deployment_id : typing.Optional[str]
267
+ The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
268
+
269
+ prompt_deployment_name : typing.Optional[str]
270
+ The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
261
271
 
262
- - prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
272
+ release_tag : typing.Optional[str]
273
+ Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
263
274
 
264
- - prompt_deployment_name: typing.Optional[str]. The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
275
+ external_id : typing.Optional[str]
276
+ Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
265
277
 
266
- - release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
278
+ expand_meta : typing.Optional[PromptDeploymentExpandMetaRequestRequest]
279
+ An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
267
280
 
268
- - external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
281
+ raw_overrides : typing.Optional[RawPromptExecutionOverridesRequest]
282
+ Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
269
283
 
270
- - expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest]. An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
284
+ expand_raw : typing.Optional[typing.Sequence[str]]
285
+ A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
271
286
 
272
- - raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest]. Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
287
+ metadata : typing.Optional[typing.Dict[str, typing.Any]]
288
+ Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
273
289
 
274
- - expand_raw: typing.Optional[typing.Sequence[str]]. A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
290
+ request_options : typing.Optional[RequestOptions]
291
+ Request-specific configuration.
275
292
 
276
- - metadata: typing.Optional[typing.Dict[str, typing.Any]]. Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
293
+ Yields
294
+ ------
295
+ typing.Iterator[ExecutePromptEvent]
277
296
 
278
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
279
- ---
297
+
298
+ Examples
299
+ --------
280
300
  from vellum import (
281
301
  PromptDeploymentExpandMetaRequestRequest,
282
302
  PromptDeploymentInputRequest_String,
@@ -287,7 +307,7 @@ class Vellum:
287
307
  client = Vellum(
288
308
  api_key="YOUR_API_KEY",
289
309
  )
290
- client.execute_prompt_stream(
310
+ response = client.execute_prompt_stream(
291
311
  inputs=[
292
312
  PromptDeploymentInputRequest_String(
293
313
  name="string",
@@ -314,66 +334,46 @@ class Vellum:
314
334
  expand_raw=["string"],
315
335
  metadata={"string": {"key": "value"}},
316
336
  )
337
+ for chunk in response:
338
+ yield chunk
317
339
  """
318
- _request: typing.Dict[str, typing.Any] = {"inputs": inputs}
319
- if prompt_deployment_id is not OMIT:
320
- _request["prompt_deployment_id"] = prompt_deployment_id
321
- if prompt_deployment_name is not OMIT:
322
- _request["prompt_deployment_name"] = prompt_deployment_name
323
- if release_tag is not OMIT:
324
- _request["release_tag"] = release_tag
325
- if external_id is not OMIT:
326
- _request["external_id"] = external_id
327
- if expand_meta is not OMIT:
328
- _request["expand_meta"] = expand_meta
329
- if raw_overrides is not OMIT:
330
- _request["raw_overrides"] = raw_overrides
331
- if expand_raw is not OMIT:
332
- _request["expand_raw"] = expand_raw
333
- if metadata is not OMIT:
334
- _request["metadata"] = metadata
335
340
  with self._client_wrapper.httpx_client.stream(
341
+ "v1/execute-prompt-stream",
342
+ base_url=self._client_wrapper.get_environment().predict,
336
343
  method="POST",
337
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt-stream"),
338
- params=jsonable_encoder(
339
- request_options.get("additional_query_parameters") if request_options is not None else None
340
- ),
341
- json=jsonable_encoder(_request)
342
- if request_options is None or request_options.get("additional_body_parameters") is None
343
- else {
344
- **jsonable_encoder(_request),
345
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
344
+ json={
345
+ "inputs": inputs,
346
+ "prompt_deployment_id": prompt_deployment_id,
347
+ "prompt_deployment_name": prompt_deployment_name,
348
+ "release_tag": release_tag,
349
+ "external_id": external_id,
350
+ "expand_meta": expand_meta,
351
+ "raw_overrides": raw_overrides,
352
+ "expand_raw": expand_raw,
353
+ "metadata": metadata,
346
354
  },
347
- headers=jsonable_encoder(
348
- remove_none_from_dict(
349
- {
350
- **self._client_wrapper.get_headers(),
351
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
352
- }
353
- )
354
- ),
355
- timeout=request_options.get("timeout_in_seconds")
356
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
357
- else self._client_wrapper.get_timeout(),
358
- retries=0,
359
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
355
+ request_options=request_options,
356
+ omit=OMIT,
360
357
  ) as _response:
361
- if 200 <= _response.status_code < 300:
362
- for _text in _response.iter_lines():
363
- if len(_text) == 0:
364
- continue
365
- yield pydantic_v1.parse_obj_as(ExecutePromptEvent, json.loads(_text)) # type: ignore
366
- return
367
- _response.read()
368
- if _response.status_code == 400:
369
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
370
- if _response.status_code == 403:
371
- raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
372
- if _response.status_code == 404:
373
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
374
- if _response.status_code == 500:
375
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
376
358
  try:
359
+ if 200 <= _response.status_code < 300:
360
+ for _text in _response.iter_lines():
361
+ try:
362
+ if len(_text) == 0:
363
+ continue
364
+ yield pydantic_v1.parse_obj_as(ExecutePromptEvent, json.loads(_text)) # type: ignore
365
+ except:
366
+ pass
367
+ return
368
+ _response.read()
369
+ if _response.status_code == 400:
370
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
371
+ if _response.status_code == 403:
372
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
373
+ if _response.status_code == 404:
374
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
375
+ if _response.status_code == 500:
376
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
377
377
  _response_json = _response.json()
378
378
  except JSONDecodeError:
379
379
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -388,26 +388,41 @@ class Vellum:
388
388
  workflow_deployment_name: typing.Optional[str] = OMIT,
389
389
  release_tag: typing.Optional[str] = OMIT,
390
390
  external_id: typing.Optional[str] = OMIT,
391
- request_options: typing.Optional[RequestOptions] = None,
391
+ request_options: typing.Optional[RequestOptions] = None
392
392
  ) -> ExecuteWorkflowResponse:
393
393
  """
394
394
  Executes a deployed Workflow and returns its outputs.
395
395
 
396
- Parameters:
397
- - inputs: typing.Sequence[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's Deployment with their corresponding values.
396
+ Parameters
397
+ ----------
398
+ inputs : typing.Sequence[WorkflowRequestInputRequest]
399
+ The list of inputs defined in the Workflow's Deployment with their corresponding values.
400
+
401
+ expand_meta : typing.Optional[WorkflowExpandMetaRequest]
402
+ An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
403
+
404
+ workflow_deployment_id : typing.Optional[str]
405
+ The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
406
+
407
+ workflow_deployment_name : typing.Optional[str]
408
+ The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
398
409
 
399
- - expand_meta: typing.Optional[WorkflowExpandMetaRequest]. An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
410
+ release_tag : typing.Optional[str]
411
+ Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
400
412
 
401
- - workflow_deployment_id: typing.Optional[str]. The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
413
+ external_id : typing.Optional[str]
414
+ Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
402
415
 
403
- - workflow_deployment_name: typing.Optional[str]. The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
416
+ request_options : typing.Optional[RequestOptions]
417
+ Request-specific configuration.
404
418
 
405
- - release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
419
+ Returns
420
+ -------
421
+ ExecuteWorkflowResponse
406
422
 
407
- - external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
408
423
 
409
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
410
- ---
424
+ Examples
425
+ --------
411
426
  from vellum import WorkflowExpandMetaRequest, WorkflowRequestInputRequest_String
412
427
  from vellum.client import Vellum
413
428
 
@@ -430,52 +445,30 @@ class Vellum:
430
445
  external_id="string",
431
446
  )
432
447
  """
433
- _request: typing.Dict[str, typing.Any] = {"inputs": inputs}
434
- if expand_meta is not OMIT:
435
- _request["expand_meta"] = expand_meta
436
- if workflow_deployment_id is not OMIT:
437
- _request["workflow_deployment_id"] = workflow_deployment_id
438
- if workflow_deployment_name is not OMIT:
439
- _request["workflow_deployment_name"] = workflow_deployment_name
440
- if release_tag is not OMIT:
441
- _request["release_tag"] = release_tag
442
- if external_id is not OMIT:
443
- _request["external_id"] = external_id
444
448
  _response = self._client_wrapper.httpx_client.request(
449
+ "v1/execute-workflow",
450
+ base_url=self._client_wrapper.get_environment().predict,
445
451
  method="POST",
446
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow"),
447
- params=jsonable_encoder(
448
- request_options.get("additional_query_parameters") if request_options is not None else None
449
- ),
450
- json=jsonable_encoder(_request)
451
- if request_options is None or request_options.get("additional_body_parameters") is None
452
- else {
453
- **jsonable_encoder(_request),
454
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
452
+ json={
453
+ "inputs": inputs,
454
+ "expand_meta": expand_meta,
455
+ "workflow_deployment_id": workflow_deployment_id,
456
+ "workflow_deployment_name": workflow_deployment_name,
457
+ "release_tag": release_tag,
458
+ "external_id": external_id,
455
459
  },
456
- headers=jsonable_encoder(
457
- remove_none_from_dict(
458
- {
459
- **self._client_wrapper.get_headers(),
460
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
461
- }
462
- )
463
- ),
464
- timeout=request_options.get("timeout_in_seconds")
465
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
466
- else self._client_wrapper.get_timeout(),
467
- retries=0,
468
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
460
+ request_options=request_options,
461
+ omit=OMIT,
469
462
  )
470
- if 200 <= _response.status_code < 300:
471
- return pydantic_v1.parse_obj_as(ExecuteWorkflowResponse, _response.json()) # type: ignore
472
- if _response.status_code == 400:
473
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
474
- if _response.status_code == 404:
475
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
476
- if _response.status_code == 500:
477
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
478
463
  try:
464
+ if 200 <= _response.status_code < 300:
465
+ return pydantic_v1.parse_obj_as(ExecuteWorkflowResponse, _response.json()) # type: ignore
466
+ if _response.status_code == 400:
467
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
468
+ if _response.status_code == 404:
469
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
470
+ if _response.status_code == 500:
471
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
479
472
  _response_json = _response.json()
480
473
  except JSONDecodeError:
481
474
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -491,35 +484,51 @@ class Vellum:
491
484
  release_tag: typing.Optional[str] = OMIT,
492
485
  external_id: typing.Optional[str] = OMIT,
493
486
  event_types: typing.Optional[typing.Sequence[WorkflowExecutionEventType]] = OMIT,
494
- request_options: typing.Optional[RequestOptions] = None,
487
+ request_options: typing.Optional[RequestOptions] = None
495
488
  ) -> typing.Iterator[WorkflowStreamEvent]:
496
489
  """
497
490
  Executes a deployed Workflow and streams back its results.
498
491
 
499
- Parameters:
500
- - inputs: typing.Sequence[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's Deployment with their corresponding values.
492
+ Parameters
493
+ ----------
494
+ inputs : typing.Sequence[WorkflowRequestInputRequest]
495
+ The list of inputs defined in the Workflow's Deployment with their corresponding values.
501
496
 
502
- - expand_meta: typing.Optional[WorkflowExpandMetaRequest]. An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
497
+ expand_meta : typing.Optional[WorkflowExpandMetaRequest]
498
+ An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
503
499
 
504
- - workflow_deployment_id: typing.Optional[str]. The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
500
+ workflow_deployment_id : typing.Optional[str]
501
+ The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
505
502
 
506
- - workflow_deployment_name: typing.Optional[str]. The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
503
+ workflow_deployment_name : typing.Optional[str]
504
+ The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
507
505
 
508
- - release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
506
+ release_tag : typing.Optional[str]
507
+ Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
509
508
 
510
- - external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
509
+ external_id : typing.Optional[str]
510
+ Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
511
511
 
512
- - event_types: typing.Optional[typing.Sequence[WorkflowExecutionEventType]]. Optionally specify which events you want to receive. Defaults to only WORKFLOW events. Note that the schema of non-WORKFLOW events is unstable and should be used with caution.
512
+ event_types : typing.Optional[typing.Sequence[WorkflowExecutionEventType]]
513
+ Optionally specify which events you want to receive. Defaults to only WORKFLOW events. Note that the schema of non-WORKFLOW events is unstable and should be used with caution.
513
514
 
514
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
515
- ---
515
+ request_options : typing.Optional[RequestOptions]
516
+ Request-specific configuration.
517
+
518
+ Yields
519
+ ------
520
+ typing.Iterator[WorkflowStreamEvent]
521
+
522
+
523
+ Examples
524
+ --------
516
525
  from vellum import WorkflowExpandMetaRequest, WorkflowRequestInputRequest_String
517
526
  from vellum.client import Vellum
518
527
 
519
528
  client = Vellum(
520
529
  api_key="YOUR_API_KEY",
521
530
  )
522
- client.execute_workflow_stream(
531
+ response = client.execute_workflow_stream(
523
532
  inputs=[
524
533
  WorkflowRequestInputRequest_String(
525
534
  name="string",
@@ -535,62 +544,42 @@ class Vellum:
535
544
  external_id="string",
536
545
  event_types=["NODE"],
537
546
  )
547
+ for chunk in response:
548
+ yield chunk
538
549
  """
539
- _request: typing.Dict[str, typing.Any] = {"inputs": inputs}
540
- if expand_meta is not OMIT:
541
- _request["expand_meta"] = expand_meta
542
- if workflow_deployment_id is not OMIT:
543
- _request["workflow_deployment_id"] = workflow_deployment_id
544
- if workflow_deployment_name is not OMIT:
545
- _request["workflow_deployment_name"] = workflow_deployment_name
546
- if release_tag is not OMIT:
547
- _request["release_tag"] = release_tag
548
- if external_id is not OMIT:
549
- _request["external_id"] = external_id
550
- if event_types is not OMIT:
551
- _request["event_types"] = event_types
552
550
  with self._client_wrapper.httpx_client.stream(
551
+ "v1/execute-workflow-stream",
552
+ base_url=self._client_wrapper.get_environment().predict,
553
553
  method="POST",
554
- url=urllib.parse.urljoin(
555
- f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow-stream"
556
- ),
557
- params=jsonable_encoder(
558
- request_options.get("additional_query_parameters") if request_options is not None else None
559
- ),
560
- json=jsonable_encoder(_request)
561
- if request_options is None or request_options.get("additional_body_parameters") is None
562
- else {
563
- **jsonable_encoder(_request),
564
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
554
+ json={
555
+ "inputs": inputs,
556
+ "expand_meta": expand_meta,
557
+ "workflow_deployment_id": workflow_deployment_id,
558
+ "workflow_deployment_name": workflow_deployment_name,
559
+ "release_tag": release_tag,
560
+ "external_id": external_id,
561
+ "event_types": event_types,
565
562
  },
566
- headers=jsonable_encoder(
567
- remove_none_from_dict(
568
- {
569
- **self._client_wrapper.get_headers(),
570
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
571
- }
572
- )
573
- ),
574
- timeout=request_options.get("timeout_in_seconds")
575
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
576
- else self._client_wrapper.get_timeout(),
577
- retries=0,
578
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
563
+ request_options=request_options,
564
+ omit=OMIT,
579
565
  ) as _response:
580
- if 200 <= _response.status_code < 300:
581
- for _text in _response.iter_lines():
582
- if len(_text) == 0:
583
- continue
584
- yield pydantic_v1.parse_obj_as(WorkflowStreamEvent, json.loads(_text)) # type: ignore
585
- return
586
- _response.read()
587
- if _response.status_code == 400:
588
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
589
- if _response.status_code == 404:
590
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
591
- if _response.status_code == 500:
592
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
593
566
  try:
567
+ if 200 <= _response.status_code < 300:
568
+ for _text in _response.iter_lines():
569
+ try:
570
+ if len(_text) == 0:
571
+ continue
572
+ yield pydantic_v1.parse_obj_as(WorkflowStreamEvent, json.loads(_text)) # type: ignore
573
+ except:
574
+ pass
575
+ return
576
+ _response.read()
577
+ if _response.status_code == 400:
578
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
579
+ if _response.status_code == 404:
580
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
581
+ if _response.status_code == 500:
582
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
594
583
  _response_json = _response.json()
595
584
  except JSONDecodeError:
596
585
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -599,11 +588,11 @@ class Vellum:
599
588
  def generate(
600
589
  self,
601
590
  *,
591
+ requests: typing.Sequence[GenerateRequest],
602
592
  deployment_id: typing.Optional[str] = OMIT,
603
593
  deployment_name: typing.Optional[str] = OMIT,
604
- requests: typing.Sequence[GenerateRequest],
605
594
  options: typing.Optional[GenerateOptionsRequest] = OMIT,
606
- request_options: typing.Optional[RequestOptions] = None,
595
+ request_options: typing.Optional[RequestOptions] = None
607
596
  ) -> GenerateResponse:
608
597
  """
609
598
  Generate a completion using a previously defined deployment.
@@ -611,17 +600,30 @@ class Vellum:
611
600
  Important: This endpoint is DEPRECATED and has been superseded by
612
601
  [execute-prompt](/api-reference/api-reference/execute-prompt).
613
602
 
614
- Parameters:
615
- - deployment_id: typing.Optional[str]. The ID of the deployment. Must provide either this or deployment_name.
603
+ Parameters
604
+ ----------
605
+ requests : typing.Sequence[GenerateRequest]
606
+ The generation request to make. Bulk requests are no longer supported, this field must be an array of length 1.
607
+
608
+ deployment_id : typing.Optional[str]
609
+ The ID of the deployment. Must provide either this or deployment_name.
610
+
611
+ deployment_name : typing.Optional[str]
612
+ The name of the deployment. Must provide either this or deployment_id.
613
+
614
+ options : typing.Optional[GenerateOptionsRequest]
615
+ Additional configuration that can be used to control what's included in the response.
616
616
 
617
- - deployment_name: typing.Optional[str]. The name of the deployment. Must provide either this or deployment_id.
617
+ request_options : typing.Optional[RequestOptions]
618
+ Request-specific configuration.
618
619
 
619
- - requests: typing.Sequence[GenerateRequest]. The generation request to make. Bulk requests are no longer supported, this field must be an array of length 1.
620
+ Returns
621
+ -------
622
+ GenerateResponse
620
623
 
621
- - options: typing.Optional[GenerateOptionsRequest]. Additional configuration that can be used to control what's included in the response.
622
624
 
623
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
624
- ---
625
+ Examples
626
+ --------
625
627
  from vellum import GenerateRequest
626
628
  from vellum.client import Vellum
627
629
 
@@ -631,55 +633,35 @@ class Vellum:
631
633
  client.generate(
632
634
  requests=[
633
635
  GenerateRequest(
634
- input_values={},
636
+ input_values={"key": "value"},
635
637
  )
636
638
  ],
637
639
  )
638
640
  """
639
- _request: typing.Dict[str, typing.Any] = {"requests": requests}
640
- if deployment_id is not OMIT:
641
- _request["deployment_id"] = deployment_id
642
- if deployment_name is not OMIT:
643
- _request["deployment_name"] = deployment_name
644
- if options is not OMIT:
645
- _request["options"] = options
646
641
  _response = self._client_wrapper.httpx_client.request(
642
+ "v1/generate",
643
+ base_url=self._client_wrapper.get_environment().predict,
647
644
  method="POST",
648
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate"),
649
- params=jsonable_encoder(
650
- request_options.get("additional_query_parameters") if request_options is not None else None
651
- ),
652
- json=jsonable_encoder(_request)
653
- if request_options is None or request_options.get("additional_body_parameters") is None
654
- else {
655
- **jsonable_encoder(_request),
656
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
645
+ json={
646
+ "deployment_id": deployment_id,
647
+ "deployment_name": deployment_name,
648
+ "requests": requests,
649
+ "options": options,
657
650
  },
658
- headers=jsonable_encoder(
659
- remove_none_from_dict(
660
- {
661
- **self._client_wrapper.get_headers(),
662
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
663
- }
664
- )
665
- ),
666
- timeout=request_options.get("timeout_in_seconds")
667
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
668
- else self._client_wrapper.get_timeout(),
669
- retries=0,
670
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
651
+ request_options=request_options,
652
+ omit=OMIT,
671
653
  )
672
- if 200 <= _response.status_code < 300:
673
- return pydantic_v1.parse_obj_as(GenerateResponse, _response.json()) # type: ignore
674
- if _response.status_code == 400:
675
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
676
- if _response.status_code == 403:
677
- raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
678
- if _response.status_code == 404:
679
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
680
- if _response.status_code == 500:
681
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
682
654
  try:
655
+ if 200 <= _response.status_code < 300:
656
+ return pydantic_v1.parse_obj_as(GenerateResponse, _response.json()) # type: ignore
657
+ if _response.status_code == 400:
658
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
659
+ if _response.status_code == 403:
660
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
661
+ if _response.status_code == 404:
662
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
663
+ if _response.status_code == 500:
664
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
683
665
  _response_json = _response.json()
684
666
  except JSONDecodeError:
685
667
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -688,11 +670,11 @@ class Vellum:
688
670
  def generate_stream(
689
671
  self,
690
672
  *,
673
+ requests: typing.Sequence[GenerateRequest],
691
674
  deployment_id: typing.Optional[str] = OMIT,
692
675
  deployment_name: typing.Optional[str] = OMIT,
693
- requests: typing.Sequence[GenerateRequest],
694
676
  options: typing.Optional[GenerateOptionsRequest] = OMIT,
695
- request_options: typing.Optional[RequestOptions] = None,
677
+ request_options: typing.Optional[RequestOptions] = None
696
678
  ) -> typing.Iterator[GenerateStreamResponse]:
697
679
  """
698
680
  Generate a stream of completions using a previously defined deployment.
@@ -700,17 +682,30 @@ class Vellum:
700
682
  Important: This endpoint is DEPRECATED and has been superseded by
701
683
  [execute-prompt-stream](/api-reference/api-reference/execute-prompt-stream).
702
684
 
703
- Parameters:
704
- - deployment_id: typing.Optional[str]. The ID of the deployment. Must provide either this or deployment_name.
685
+ Parameters
686
+ ----------
687
+ requests : typing.Sequence[GenerateRequest]
688
+ The generation request to make. Bulk requests are no longer supported, this field must be an array of length 1.
689
+
690
+ deployment_id : typing.Optional[str]
691
+ The ID of the deployment. Must provide either this or deployment_name.
692
+
693
+ deployment_name : typing.Optional[str]
694
+ The name of the deployment. Must provide either this or deployment_id.
695
+
696
+ options : typing.Optional[GenerateOptionsRequest]
697
+ Additional configuration that can be used to control what's included in the response.
705
698
 
706
- - deployment_name: typing.Optional[str]. The name of the deployment. Must provide either this or deployment_id.
699
+ request_options : typing.Optional[RequestOptions]
700
+ Request-specific configuration.
707
701
 
708
- - requests: typing.Sequence[GenerateRequest]. The generation request to make. Bulk requests are no longer supported, this field must be an array of length 1.
702
+ Yields
703
+ ------
704
+ typing.Iterator[GenerateStreamResponse]
709
705
 
710
- - options: typing.Optional[GenerateOptionsRequest]. Additional configuration that can be used to control what's included in the response.
711
706
 
712
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
713
- ---
707
+ Examples
708
+ --------
714
709
  from vellum import (
715
710
  ChatMessageContentRequest_String,
716
711
  ChatMessageRequest,
@@ -722,7 +717,7 @@ class Vellum:
722
717
  client = Vellum(
723
718
  api_key="YOUR_API_KEY",
724
719
  )
725
- client.generate_stream(
720
+ response = client.generate_stream(
726
721
  deployment_id="string",
727
722
  deployment_name="string",
728
723
  requests=[
@@ -743,56 +738,41 @@ class Vellum:
743
738
  logprobs="ALL",
744
739
  ),
745
740
  )
741
+ for chunk in response:
742
+ yield chunk
746
743
  """
747
- _request: typing.Dict[str, typing.Any] = {"requests": requests}
748
- if deployment_id is not OMIT:
749
- _request["deployment_id"] = deployment_id
750
- if deployment_name is not OMIT:
751
- _request["deployment_name"] = deployment_name
752
- if options is not OMIT:
753
- _request["options"] = options
754
744
  with self._client_wrapper.httpx_client.stream(
745
+ "v1/generate-stream",
746
+ base_url=self._client_wrapper.get_environment().predict,
755
747
  method="POST",
756
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate-stream"),
757
- params=jsonable_encoder(
758
- request_options.get("additional_query_parameters") if request_options is not None else None
759
- ),
760
- json=jsonable_encoder(_request)
761
- if request_options is None or request_options.get("additional_body_parameters") is None
762
- else {
763
- **jsonable_encoder(_request),
764
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
748
+ json={
749
+ "deployment_id": deployment_id,
750
+ "deployment_name": deployment_name,
751
+ "requests": requests,
752
+ "options": options,
765
753
  },
766
- headers=jsonable_encoder(
767
- remove_none_from_dict(
768
- {
769
- **self._client_wrapper.get_headers(),
770
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
771
- }
772
- )
773
- ),
774
- timeout=request_options.get("timeout_in_seconds")
775
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
776
- else self._client_wrapper.get_timeout(),
777
- retries=0,
778
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
754
+ request_options=request_options,
755
+ omit=OMIT,
779
756
  ) as _response:
780
- if 200 <= _response.status_code < 300:
781
- for _text in _response.iter_lines():
782
- if len(_text) == 0:
783
- continue
784
- yield pydantic_v1.parse_obj_as(GenerateStreamResponse, json.loads(_text)) # type: ignore
785
- return
786
- _response.read()
787
- if _response.status_code == 400:
788
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
789
- if _response.status_code == 403:
790
- raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
791
- if _response.status_code == 404:
792
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
793
- if _response.status_code == 500:
794
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
795
757
  try:
758
+ if 200 <= _response.status_code < 300:
759
+ for _text in _response.iter_lines():
760
+ try:
761
+ if len(_text) == 0:
762
+ continue
763
+ yield pydantic_v1.parse_obj_as(GenerateStreamResponse, json.loads(_text)) # type: ignore
764
+ except:
765
+ pass
766
+ return
767
+ _response.read()
768
+ if _response.status_code == 400:
769
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
770
+ if _response.status_code == 403:
771
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
772
+ if _response.status_code == 404:
773
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
774
+ if _response.status_code == 500:
775
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
796
776
  _response_json = _response.json()
797
777
  except JSONDecodeError:
798
778
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -801,26 +781,39 @@ class Vellum:
801
781
  def search(
802
782
  self,
803
783
  *,
784
+ query: str,
804
785
  index_id: typing.Optional[str] = OMIT,
805
786
  index_name: typing.Optional[str] = OMIT,
806
- query: str,
807
787
  options: typing.Optional[SearchRequestOptionsRequest] = OMIT,
808
- request_options: typing.Optional[RequestOptions] = None,
788
+ request_options: typing.Optional[RequestOptions] = None
809
789
  ) -> SearchResponse:
810
790
  """
811
791
  Perform a search against a document index.
812
792
 
813
- Parameters:
814
- - index_id: typing.Optional[str]. The ID of the index to search against. Must provide either this or index_name.
793
+ Parameters
794
+ ----------
795
+ query : str
796
+ The query to search for.
797
+
798
+ index_id : typing.Optional[str]
799
+ The ID of the index to search against. Must provide either this or index_name.
815
800
 
816
- - index_name: typing.Optional[str]. The name of the index to search against. Must provide either this or index_id.
801
+ index_name : typing.Optional[str]
802
+ The name of the index to search against. Must provide either this or index_id.
817
803
 
818
- - query: str. The query to search for.
804
+ options : typing.Optional[SearchRequestOptionsRequest]
805
+ Configuration options for the search.
819
806
 
820
- - options: typing.Optional[SearchRequestOptionsRequest]. Configuration options for the search.
807
+ request_options : typing.Optional[RequestOptions]
808
+ Request-specific configuration.
821
809
 
822
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
823
- ---
810
+ Returns
811
+ -------
812
+ SearchResponse
813
+
814
+
815
+ Examples
816
+ --------
824
817
  from vellum.client import Vellum
825
818
 
826
819
  client = Vellum(
@@ -830,48 +823,23 @@ class Vellum:
830
823
  query="query",
831
824
  )
832
825
  """
833
- _request: typing.Dict[str, typing.Any] = {"query": query}
834
- if index_id is not OMIT:
835
- _request["index_id"] = index_id
836
- if index_name is not OMIT:
837
- _request["index_name"] = index_name
838
- if options is not OMIT:
839
- _request["options"] = options
840
826
  _response = self._client_wrapper.httpx_client.request(
827
+ "v1/search",
828
+ base_url=self._client_wrapper.get_environment().predict,
841
829
  method="POST",
842
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/search"),
843
- params=jsonable_encoder(
844
- request_options.get("additional_query_parameters") if request_options is not None else None
845
- ),
846
- json=jsonable_encoder(_request)
847
- if request_options is None or request_options.get("additional_body_parameters") is None
848
- else {
849
- **jsonable_encoder(_request),
850
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
851
- },
852
- headers=jsonable_encoder(
853
- remove_none_from_dict(
854
- {
855
- **self._client_wrapper.get_headers(),
856
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
857
- }
858
- )
859
- ),
860
- timeout=request_options.get("timeout_in_seconds")
861
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
862
- else self._client_wrapper.get_timeout(),
863
- retries=0,
864
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
830
+ json={"index_id": index_id, "index_name": index_name, "query": query, "options": options},
831
+ request_options=request_options,
832
+ omit=OMIT,
865
833
  )
866
- if 200 <= _response.status_code < 300:
867
- return pydantic_v1.parse_obj_as(SearchResponse, _response.json()) # type: ignore
868
- if _response.status_code == 400:
869
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
870
- if _response.status_code == 404:
871
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
872
- if _response.status_code == 500:
873
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
874
834
  try:
835
+ if 200 <= _response.status_code < 300:
836
+ return pydantic_v1.parse_obj_as(SearchResponse, _response.json()) # type: ignore
837
+ if _response.status_code == 400:
838
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
839
+ if _response.status_code == 404:
840
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
841
+ if _response.status_code == 500:
842
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
875
843
  _response_json = _response.json()
876
844
  except JSONDecodeError:
877
845
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -880,23 +848,34 @@ class Vellum:
880
848
  def submit_completion_actuals(
881
849
  self,
882
850
  *,
851
+ actuals: typing.Sequence[SubmitCompletionActualRequest],
883
852
  deployment_id: typing.Optional[str] = OMIT,
884
853
  deployment_name: typing.Optional[str] = OMIT,
885
- actuals: typing.Sequence[SubmitCompletionActualRequest],
886
- request_options: typing.Optional[RequestOptions] = None,
854
+ request_options: typing.Optional[RequestOptions] = None
887
855
  ) -> None:
888
856
  """
889
857
  Used to submit feedback regarding the quality of previously generated completions.
890
858
 
891
- Parameters:
892
- - deployment_id: typing.Optional[str]. The ID of the deployment. Must provide either this or deployment_name.
859
+ Parameters
860
+ ----------
861
+ actuals : typing.Sequence[SubmitCompletionActualRequest]
862
+ Feedback regarding the quality of previously generated completions
863
+
864
+ deployment_id : typing.Optional[str]
865
+ The ID of the deployment. Must provide either this or deployment_name.
866
+
867
+ deployment_name : typing.Optional[str]
868
+ The name of the deployment. Must provide either this or deployment_id.
893
869
 
894
- - deployment_name: typing.Optional[str]. The name of the deployment. Must provide either this or deployment_id.
870
+ request_options : typing.Optional[RequestOptions]
871
+ Request-specific configuration.
895
872
 
896
- - actuals: typing.Sequence[SubmitCompletionActualRequest]. Feedback regarding the quality of previously generated completions
873
+ Returns
874
+ -------
875
+ None
897
876
 
898
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
899
- ---
877
+ Examples
878
+ --------
900
879
  from vellum import SubmitCompletionActualRequest
901
880
  from vellum.client import Vellum
902
881
 
@@ -907,48 +886,23 @@ class Vellum:
907
886
  actuals=[SubmitCompletionActualRequest()],
908
887
  )
909
888
  """
910
- _request: typing.Dict[str, typing.Any] = {"actuals": actuals}
911
- if deployment_id is not OMIT:
912
- _request["deployment_id"] = deployment_id
913
- if deployment_name is not OMIT:
914
- _request["deployment_name"] = deployment_name
915
889
  _response = self._client_wrapper.httpx_client.request(
890
+ "v1/submit-completion-actuals",
891
+ base_url=self._client_wrapper.get_environment().predict,
916
892
  method="POST",
917
- url=urllib.parse.urljoin(
918
- f"{self._client_wrapper.get_environment().predict}/", "v1/submit-completion-actuals"
919
- ),
920
- params=jsonable_encoder(
921
- request_options.get("additional_query_parameters") if request_options is not None else None
922
- ),
923
- json=jsonable_encoder(_request)
924
- if request_options is None or request_options.get("additional_body_parameters") is None
925
- else {
926
- **jsonable_encoder(_request),
927
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
928
- },
929
- headers=jsonable_encoder(
930
- remove_none_from_dict(
931
- {
932
- **self._client_wrapper.get_headers(),
933
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
934
- }
935
- )
936
- ),
937
- timeout=request_options.get("timeout_in_seconds")
938
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
939
- else self._client_wrapper.get_timeout(),
940
- retries=0,
941
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
893
+ json={"deployment_id": deployment_id, "deployment_name": deployment_name, "actuals": actuals},
894
+ request_options=request_options,
895
+ omit=OMIT,
942
896
  )
943
- if 200 <= _response.status_code < 300:
944
- return
945
- if _response.status_code == 400:
946
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
947
- if _response.status_code == 404:
948
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
949
- if _response.status_code == 500:
950
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
951
897
  try:
898
+ if 200 <= _response.status_code < 300:
899
+ return
900
+ if _response.status_code == 400:
901
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
902
+ if _response.status_code == 404:
903
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
904
+ if _response.status_code == 500:
905
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
952
906
  _response_json = _response.json()
953
907
  except JSONDecodeError:
954
908
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -960,22 +914,33 @@ class Vellum:
960
914
  actuals: typing.Sequence[SubmitWorkflowExecutionActualRequest],
961
915
  execution_id: typing.Optional[str] = OMIT,
962
916
  external_id: typing.Optional[str] = OMIT,
963
- request_options: typing.Optional[RequestOptions] = None,
917
+ request_options: typing.Optional[RequestOptions] = None
964
918
  ) -> None:
965
919
  """
966
920
  Used to submit feedback regarding the quality of previous workflow execution and its outputs.
967
921
 
968
922
  **Note:** Uses a base url of `https://predict.vellum.ai`.
969
923
 
970
- Parameters:
971
- - actuals: typing.Sequence[SubmitWorkflowExecutionActualRequest]. Feedback regarding the quality of an output on a previously executed workflow.
924
+ Parameters
925
+ ----------
926
+ actuals : typing.Sequence[SubmitWorkflowExecutionActualRequest]
927
+ Feedback regarding the quality of an output on a previously executed workflow.
972
928
 
973
- - execution_id: typing.Optional[str]. The Vellum-generated ID of a previously executed workflow. Must provide either this or external_id.
929
+ execution_id : typing.Optional[str]
930
+ The Vellum-generated ID of a previously executed workflow. Must provide either this or external_id.
974
931
 
975
- - external_id: typing.Optional[str]. The external ID that was originally provided by when executing the workflow, if applicable, that you'd now like to submit actuals for. Must provide either this or execution_id.
932
+ external_id : typing.Optional[str]
933
+ The external ID that was originally provided by when executing the workflow, if applicable, that you'd now like to submit actuals for. Must provide either this or execution_id.
976
934
 
977
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
978
- ---
935
+ request_options : typing.Optional[RequestOptions]
936
+ Request-specific configuration.
937
+
938
+ Returns
939
+ -------
940
+ None
941
+
942
+ Examples
943
+ --------
979
944
  from vellum.client import Vellum
980
945
 
981
946
  client = Vellum(
@@ -985,42 +950,17 @@ class Vellum:
985
950
  actuals=[],
986
951
  )
987
952
  """
988
- _request: typing.Dict[str, typing.Any] = {"actuals": actuals}
989
- if execution_id is not OMIT:
990
- _request["execution_id"] = execution_id
991
- if external_id is not OMIT:
992
- _request["external_id"] = external_id
993
953
  _response = self._client_wrapper.httpx_client.request(
954
+ "v1/submit-workflow-execution-actuals",
955
+ base_url=self._client_wrapper.get_environment().predict,
994
956
  method="POST",
995
- url=urllib.parse.urljoin(
996
- f"{self._client_wrapper.get_environment().predict}/", "v1/submit-workflow-execution-actuals"
997
- ),
998
- params=jsonable_encoder(
999
- request_options.get("additional_query_parameters") if request_options is not None else None
1000
- ),
1001
- json=jsonable_encoder(_request)
1002
- if request_options is None or request_options.get("additional_body_parameters") is None
1003
- else {
1004
- **jsonable_encoder(_request),
1005
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1006
- },
1007
- headers=jsonable_encoder(
1008
- remove_none_from_dict(
1009
- {
1010
- **self._client_wrapper.get_headers(),
1011
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1012
- }
1013
- )
1014
- ),
1015
- timeout=request_options.get("timeout_in_seconds")
1016
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1017
- else self._client_wrapper.get_timeout(),
1018
- retries=0,
1019
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
957
+ json={"actuals": actuals, "execution_id": execution_id, "external_id": external_id},
958
+ request_options=request_options,
959
+ omit=OMIT,
1020
960
  )
1021
- if 200 <= _response.status_code < 300:
1022
- return
1023
961
  try:
962
+ if 200 <= _response.status_code < 300:
963
+ return
1024
964
  _response_json = _response.json()
1025
965
  except JSONDecodeError:
1026
966
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1029,21 +969,31 @@ class Vellum:
1029
969
 
1030
970
  class AsyncVellum:
1031
971
  """
1032
- Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
972
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
973
+
974
+ Parameters
975
+ ----------
976
+ environment : VellumEnvironment
977
+ The environment to use for requests from the client. from .environment import VellumEnvironment
1033
978
 
1034
- Parameters:
1035
- - environment: VellumEnvironment. The environment to use for requests from the client. from .environment import VellumEnvironment
1036
979
 
1037
- Defaults to VellumEnvironment.PRODUCTION
1038
980
 
1039
- - api_key: str.
981
+ Defaults to VellumEnvironment.PRODUCTION
1040
982
 
1041
- - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
1042
983
 
1043
- - follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
1044
984
 
1045
- - httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
1046
- ---
985
+ api_key : str
986
+ timeout : typing.Optional[float]
987
+ The timeout to be used, in seconds, for requests. By default there is no timeout set, unless a custom httpx client is used, in which case this default is not enforced.
988
+
989
+ follow_redirects : typing.Optional[bool]
990
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
991
+
992
+ httpx_client : typing.Optional[httpx.AsyncClient]
993
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
994
+
995
+ Examples
996
+ --------
1047
997
  from vellum.client import AsyncVellum
1048
998
 
1049
999
  client = AsyncVellum(
@@ -1058,7 +1008,7 @@ class AsyncVellum:
1058
1008
  api_key: str,
1059
1009
  timeout: typing.Optional[float] = None,
1060
1010
  follow_redirects: typing.Optional[bool] = True,
1061
- httpx_client: typing.Optional[httpx.AsyncClient] = None,
1011
+ httpx_client: typing.Optional[httpx.AsyncClient] = None
1062
1012
  ):
1063
1013
  _defaulted_timeout = timeout if timeout is not None else None if httpx_client is None else None
1064
1014
  self._client_wrapper = AsyncClientWrapper(
@@ -1075,6 +1025,7 @@ class AsyncVellum:
1075
1025
  self.document_indexes = AsyncDocumentIndexesClient(client_wrapper=self._client_wrapper)
1076
1026
  self.documents = AsyncDocumentsClient(client_wrapper=self._client_wrapper)
1077
1027
  self.folder_entities = AsyncFolderEntitiesClient(client_wrapper=self._client_wrapper)
1028
+ self.ml_models = AsyncMlModelsClient(client_wrapper=self._client_wrapper)
1078
1029
  self.sandboxes = AsyncSandboxesClient(client_wrapper=self._client_wrapper)
1079
1030
  self.test_suite_runs = AsyncTestSuiteRunsClient(client_wrapper=self._client_wrapper)
1080
1031
  self.test_suites = AsyncTestSuitesClient(client_wrapper=self._client_wrapper)
@@ -1093,32 +1044,52 @@ class AsyncVellum:
1093
1044
  raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest] = OMIT,
1094
1045
  expand_raw: typing.Optional[typing.Sequence[str]] = OMIT,
1095
1046
  metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
1096
- request_options: typing.Optional[RequestOptions] = None,
1047
+ request_options: typing.Optional[RequestOptions] = None
1097
1048
  ) -> ExecutePromptResponse:
1098
1049
  """
1099
1050
  Executes a deployed Prompt and returns the result.
1100
1051
 
1101
- Parameters:
1102
- - inputs: typing.Sequence[PromptDeploymentInputRequest]. A list consisting of the Prompt Deployment's input variables and their values.
1052
+ Parameters
1053
+ ----------
1054
+ inputs : typing.Sequence[PromptDeploymentInputRequest]
1055
+ A list consisting of the Prompt Deployment's input variables and their values.
1056
+
1057
+ prompt_deployment_id : typing.Optional[str]
1058
+ The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
1059
+
1060
+ prompt_deployment_name : typing.Optional[str]
1061
+ The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
1062
+
1063
+ release_tag : typing.Optional[str]
1064
+ Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
1065
+
1066
+ external_id : typing.Optional[str]
1067
+ Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
1103
1068
 
1104
- - prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
1069
+ expand_meta : typing.Optional[PromptDeploymentExpandMetaRequestRequest]
1070
+ An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
1105
1071
 
1106
- - prompt_deployment_name: typing.Optional[str]. The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
1072
+ raw_overrides : typing.Optional[RawPromptExecutionOverridesRequest]
1073
+ Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
1107
1074
 
1108
- - release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
1075
+ expand_raw : typing.Optional[typing.Sequence[str]]
1076
+ A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
1109
1077
 
1110
- - external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
1078
+ metadata : typing.Optional[typing.Dict[str, typing.Any]]
1079
+ Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
1111
1080
 
1112
- - expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest]. An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
1081
+ request_options : typing.Optional[RequestOptions]
1082
+ Request-specific configuration.
1113
1083
 
1114
- - raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest]. Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
1084
+ Returns
1085
+ -------
1086
+ ExecutePromptResponse
1115
1087
 
1116
- - expand_raw: typing.Optional[typing.Sequence[str]]. A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
1117
1088
 
1118
- - metadata: typing.Optional[typing.Dict[str, typing.Any]]. Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
1089
+ Examples
1090
+ --------
1091
+ import asyncio
1119
1092
 
1120
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
1121
- ---
1122
1093
  from vellum import (
1123
1094
  PromptDeploymentExpandMetaRequestRequest,
1124
1095
  PromptDeploymentInputRequest_String,
@@ -1129,88 +1100,69 @@ class AsyncVellum:
1129
1100
  client = AsyncVellum(
1130
1101
  api_key="YOUR_API_KEY",
1131
1102
  )
1132
- await client.execute_prompt(
1133
- inputs=[
1134
- PromptDeploymentInputRequest_String(
1135
- name="string",
1136
- value="string",
1137
- )
1138
- ],
1139
- prompt_deployment_id="string",
1140
- prompt_deployment_name="string",
1141
- release_tag="string",
1142
- external_id="string",
1143
- expand_meta=PromptDeploymentExpandMetaRequestRequest(
1144
- model_name=True,
1145
- usage=True,
1146
- finish_reason=True,
1147
- latency=True,
1148
- deployment_release_tag=True,
1149
- prompt_version_id=True,
1150
- ),
1151
- raw_overrides=RawPromptExecutionOverridesRequest(
1152
- body={"string": {"key": "value"}},
1153
- headers={"string": {"key": "value"}},
1154
- url="string",
1155
- ),
1156
- expand_raw=["string"],
1157
- metadata={"string": {"key": "value"}},
1158
- )
1103
+
1104
+
1105
+ async def main() -> None:
1106
+ await client.execute_prompt(
1107
+ inputs=[
1108
+ PromptDeploymentInputRequest_String(
1109
+ name="string",
1110
+ value="string",
1111
+ )
1112
+ ],
1113
+ prompt_deployment_id="string",
1114
+ prompt_deployment_name="string",
1115
+ release_tag="string",
1116
+ external_id="string",
1117
+ expand_meta=PromptDeploymentExpandMetaRequestRequest(
1118
+ model_name=True,
1119
+ usage=True,
1120
+ finish_reason=True,
1121
+ latency=True,
1122
+ deployment_release_tag=True,
1123
+ prompt_version_id=True,
1124
+ ),
1125
+ raw_overrides=RawPromptExecutionOverridesRequest(
1126
+ body={"string": {"key": "value"}},
1127
+ headers={"string": {"key": "value"}},
1128
+ url="string",
1129
+ ),
1130
+ expand_raw=["string"],
1131
+ metadata={"string": {"key": "value"}},
1132
+ )
1133
+
1134
+
1135
+ asyncio.run(main())
1159
1136
  """
1160
- _request: typing.Dict[str, typing.Any] = {"inputs": inputs}
1161
- if prompt_deployment_id is not OMIT:
1162
- _request["prompt_deployment_id"] = prompt_deployment_id
1163
- if prompt_deployment_name is not OMIT:
1164
- _request["prompt_deployment_name"] = prompt_deployment_name
1165
- if release_tag is not OMIT:
1166
- _request["release_tag"] = release_tag
1167
- if external_id is not OMIT:
1168
- _request["external_id"] = external_id
1169
- if expand_meta is not OMIT:
1170
- _request["expand_meta"] = expand_meta
1171
- if raw_overrides is not OMIT:
1172
- _request["raw_overrides"] = raw_overrides
1173
- if expand_raw is not OMIT:
1174
- _request["expand_raw"] = expand_raw
1175
- if metadata is not OMIT:
1176
- _request["metadata"] = metadata
1177
1137
  _response = await self._client_wrapper.httpx_client.request(
1138
+ "v1/execute-prompt",
1139
+ base_url=self._client_wrapper.get_environment().predict,
1178
1140
  method="POST",
1179
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt"),
1180
- params=jsonable_encoder(
1181
- request_options.get("additional_query_parameters") if request_options is not None else None
1182
- ),
1183
- json=jsonable_encoder(_request)
1184
- if request_options is None or request_options.get("additional_body_parameters") is None
1185
- else {
1186
- **jsonable_encoder(_request),
1187
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1141
+ json={
1142
+ "inputs": inputs,
1143
+ "prompt_deployment_id": prompt_deployment_id,
1144
+ "prompt_deployment_name": prompt_deployment_name,
1145
+ "release_tag": release_tag,
1146
+ "external_id": external_id,
1147
+ "expand_meta": expand_meta,
1148
+ "raw_overrides": raw_overrides,
1149
+ "expand_raw": expand_raw,
1150
+ "metadata": metadata,
1188
1151
  },
1189
- headers=jsonable_encoder(
1190
- remove_none_from_dict(
1191
- {
1192
- **self._client_wrapper.get_headers(),
1193
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1194
- }
1195
- )
1196
- ),
1197
- timeout=request_options.get("timeout_in_seconds")
1198
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1199
- else self._client_wrapper.get_timeout(),
1200
- retries=0,
1201
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
1152
+ request_options=request_options,
1153
+ omit=OMIT,
1202
1154
  )
1203
- if 200 <= _response.status_code < 300:
1204
- return pydantic_v1.parse_obj_as(ExecutePromptResponse, _response.json()) # type: ignore
1205
- if _response.status_code == 400:
1206
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1207
- if _response.status_code == 403:
1208
- raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1209
- if _response.status_code == 404:
1210
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1211
- if _response.status_code == 500:
1212
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1213
1155
  try:
1156
+ if 200 <= _response.status_code < 300:
1157
+ return pydantic_v1.parse_obj_as(ExecutePromptResponse, _response.json()) # type: ignore
1158
+ if _response.status_code == 400:
1159
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1160
+ if _response.status_code == 403:
1161
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1162
+ if _response.status_code == 404:
1163
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1164
+ if _response.status_code == 500:
1165
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1214
1166
  _response_json = _response.json()
1215
1167
  except JSONDecodeError:
1216
1168
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1228,32 +1180,52 @@ class AsyncVellum:
1228
1180
  raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest] = OMIT,
1229
1181
  expand_raw: typing.Optional[typing.Sequence[str]] = OMIT,
1230
1182
  metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
1231
- request_options: typing.Optional[RequestOptions] = None,
1183
+ request_options: typing.Optional[RequestOptions] = None
1232
1184
  ) -> typing.AsyncIterator[ExecutePromptEvent]:
1233
1185
  """
1234
1186
  Executes a deployed Prompt and streams back the results.
1235
1187
 
1236
- Parameters:
1237
- - inputs: typing.Sequence[PromptDeploymentInputRequest]. A list consisting of the Prompt Deployment's input variables and their values.
1188
+ Parameters
1189
+ ----------
1190
+ inputs : typing.Sequence[PromptDeploymentInputRequest]
1191
+ A list consisting of the Prompt Deployment's input variables and their values.
1238
1192
 
1239
- - prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
1193
+ prompt_deployment_id : typing.Optional[str]
1194
+ The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
1240
1195
 
1241
- - prompt_deployment_name: typing.Optional[str]. The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
1196
+ prompt_deployment_name : typing.Optional[str]
1197
+ The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
1242
1198
 
1243
- - release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
1199
+ release_tag : typing.Optional[str]
1200
+ Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
1244
1201
 
1245
- - external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
1202
+ external_id : typing.Optional[str]
1203
+ Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
1246
1204
 
1247
- - expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest]. An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
1205
+ expand_meta : typing.Optional[PromptDeploymentExpandMetaRequestRequest]
1206
+ An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
1248
1207
 
1249
- - raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest]. Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
1208
+ raw_overrides : typing.Optional[RawPromptExecutionOverridesRequest]
1209
+ Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
1250
1210
 
1251
- - expand_raw: typing.Optional[typing.Sequence[str]]. A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
1211
+ expand_raw : typing.Optional[typing.Sequence[str]]
1212
+ A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
1252
1213
 
1253
- - metadata: typing.Optional[typing.Dict[str, typing.Any]]. Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
1214
+ metadata : typing.Optional[typing.Dict[str, typing.Any]]
1215
+ Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
1216
+
1217
+ request_options : typing.Optional[RequestOptions]
1218
+ Request-specific configuration.
1219
+
1220
+ Yields
1221
+ ------
1222
+ typing.AsyncIterator[ExecutePromptEvent]
1223
+
1224
+
1225
+ Examples
1226
+ --------
1227
+ import asyncio
1254
1228
 
1255
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
1256
- ---
1257
1229
  from vellum import (
1258
1230
  PromptDeploymentExpandMetaRequestRequest,
1259
1231
  PromptDeploymentInputRequest_String,
@@ -1264,93 +1236,79 @@ class AsyncVellum:
1264
1236
  client = AsyncVellum(
1265
1237
  api_key="YOUR_API_KEY",
1266
1238
  )
1267
- await client.execute_prompt_stream(
1268
- inputs=[
1269
- PromptDeploymentInputRequest_String(
1270
- name="string",
1271
- value="string",
1272
- )
1273
- ],
1274
- prompt_deployment_id="string",
1275
- prompt_deployment_name="string",
1276
- release_tag="string",
1277
- external_id="string",
1278
- expand_meta=PromptDeploymentExpandMetaRequestRequest(
1279
- model_name=True,
1280
- usage=True,
1281
- finish_reason=True,
1282
- latency=True,
1283
- deployment_release_tag=True,
1284
- prompt_version_id=True,
1285
- ),
1286
- raw_overrides=RawPromptExecutionOverridesRequest(
1287
- body={"string": {"key": "value"}},
1288
- headers={"string": {"key": "value"}},
1289
- url="string",
1290
- ),
1291
- expand_raw=["string"],
1292
- metadata={"string": {"key": "value"}},
1293
- )
1239
+
1240
+
1241
+ async def main() -> None:
1242
+ response = await client.execute_prompt_stream(
1243
+ inputs=[
1244
+ PromptDeploymentInputRequest_String(
1245
+ name="string",
1246
+ value="string",
1247
+ )
1248
+ ],
1249
+ prompt_deployment_id="string",
1250
+ prompt_deployment_name="string",
1251
+ release_tag="string",
1252
+ external_id="string",
1253
+ expand_meta=PromptDeploymentExpandMetaRequestRequest(
1254
+ model_name=True,
1255
+ usage=True,
1256
+ finish_reason=True,
1257
+ latency=True,
1258
+ deployment_release_tag=True,
1259
+ prompt_version_id=True,
1260
+ ),
1261
+ raw_overrides=RawPromptExecutionOverridesRequest(
1262
+ body={"string": {"key": "value"}},
1263
+ headers={"string": {"key": "value"}},
1264
+ url="string",
1265
+ ),
1266
+ expand_raw=["string"],
1267
+ metadata={"string": {"key": "value"}},
1268
+ )
1269
+ async for chunk in response:
1270
+ yield chunk
1271
+
1272
+
1273
+ asyncio.run(main())
1294
1274
  """
1295
- _request: typing.Dict[str, typing.Any] = {"inputs": inputs}
1296
- if prompt_deployment_id is not OMIT:
1297
- _request["prompt_deployment_id"] = prompt_deployment_id
1298
- if prompt_deployment_name is not OMIT:
1299
- _request["prompt_deployment_name"] = prompt_deployment_name
1300
- if release_tag is not OMIT:
1301
- _request["release_tag"] = release_tag
1302
- if external_id is not OMIT:
1303
- _request["external_id"] = external_id
1304
- if expand_meta is not OMIT:
1305
- _request["expand_meta"] = expand_meta
1306
- if raw_overrides is not OMIT:
1307
- _request["raw_overrides"] = raw_overrides
1308
- if expand_raw is not OMIT:
1309
- _request["expand_raw"] = expand_raw
1310
- if metadata is not OMIT:
1311
- _request["metadata"] = metadata
1312
1275
  async with self._client_wrapper.httpx_client.stream(
1276
+ "v1/execute-prompt-stream",
1277
+ base_url=self._client_wrapper.get_environment().predict,
1313
1278
  method="POST",
1314
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt-stream"),
1315
- params=jsonable_encoder(
1316
- request_options.get("additional_query_parameters") if request_options is not None else None
1317
- ),
1318
- json=jsonable_encoder(_request)
1319
- if request_options is None or request_options.get("additional_body_parameters") is None
1320
- else {
1321
- **jsonable_encoder(_request),
1322
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1279
+ json={
1280
+ "inputs": inputs,
1281
+ "prompt_deployment_id": prompt_deployment_id,
1282
+ "prompt_deployment_name": prompt_deployment_name,
1283
+ "release_tag": release_tag,
1284
+ "external_id": external_id,
1285
+ "expand_meta": expand_meta,
1286
+ "raw_overrides": raw_overrides,
1287
+ "expand_raw": expand_raw,
1288
+ "metadata": metadata,
1323
1289
  },
1324
- headers=jsonable_encoder(
1325
- remove_none_from_dict(
1326
- {
1327
- **self._client_wrapper.get_headers(),
1328
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1329
- }
1330
- )
1331
- ),
1332
- timeout=request_options.get("timeout_in_seconds")
1333
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1334
- else self._client_wrapper.get_timeout(),
1335
- retries=0,
1336
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
1290
+ request_options=request_options,
1291
+ omit=OMIT,
1337
1292
  ) as _response:
1338
- if 200 <= _response.status_code < 300:
1339
- async for _text in _response.aiter_lines():
1340
- if len(_text) == 0:
1341
- continue
1342
- yield pydantic_v1.parse_obj_as(ExecutePromptEvent, json.loads(_text)) # type: ignore
1343
- return
1344
- await _response.aread()
1345
- if _response.status_code == 400:
1346
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1347
- if _response.status_code == 403:
1348
- raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1349
- if _response.status_code == 404:
1350
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1351
- if _response.status_code == 500:
1352
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1353
1293
  try:
1294
+ if 200 <= _response.status_code < 300:
1295
+ async for _text in _response.aiter_lines():
1296
+ try:
1297
+ if len(_text) == 0:
1298
+ continue
1299
+ yield pydantic_v1.parse_obj_as(ExecutePromptEvent, json.loads(_text)) # type: ignore
1300
+ except:
1301
+ pass
1302
+ return
1303
+ await _response.aread()
1304
+ if _response.status_code == 400:
1305
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1306
+ if _response.status_code == 403:
1307
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1308
+ if _response.status_code == 404:
1309
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1310
+ if _response.status_code == 500:
1311
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1354
1312
  _response_json = _response.json()
1355
1313
  except JSONDecodeError:
1356
1314
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1365,94 +1323,95 @@ class AsyncVellum:
1365
1323
  workflow_deployment_name: typing.Optional[str] = OMIT,
1366
1324
  release_tag: typing.Optional[str] = OMIT,
1367
1325
  external_id: typing.Optional[str] = OMIT,
1368
- request_options: typing.Optional[RequestOptions] = None,
1326
+ request_options: typing.Optional[RequestOptions] = None
1369
1327
  ) -> ExecuteWorkflowResponse:
1370
1328
  """
1371
1329
  Executes a deployed Workflow and returns its outputs.
1372
1330
 
1373
- Parameters:
1374
- - inputs: typing.Sequence[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's Deployment with their corresponding values.
1331
+ Parameters
1332
+ ----------
1333
+ inputs : typing.Sequence[WorkflowRequestInputRequest]
1334
+ The list of inputs defined in the Workflow's Deployment with their corresponding values.
1335
+
1336
+ expand_meta : typing.Optional[WorkflowExpandMetaRequest]
1337
+ An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
1338
+
1339
+ workflow_deployment_id : typing.Optional[str]
1340
+ The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
1375
1341
 
1376
- - expand_meta: typing.Optional[WorkflowExpandMetaRequest]. An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
1342
+ workflow_deployment_name : typing.Optional[str]
1343
+ The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
1377
1344
 
1378
- - workflow_deployment_id: typing.Optional[str]. The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
1345
+ release_tag : typing.Optional[str]
1346
+ Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
1379
1347
 
1380
- - workflow_deployment_name: typing.Optional[str]. The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
1348
+ external_id : typing.Optional[str]
1349
+ Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
1381
1350
 
1382
- - release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
1351
+ request_options : typing.Optional[RequestOptions]
1352
+ Request-specific configuration.
1383
1353
 
1384
- - external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
1354
+ Returns
1355
+ -------
1356
+ ExecuteWorkflowResponse
1357
+
1358
+
1359
+ Examples
1360
+ --------
1361
+ import asyncio
1385
1362
 
1386
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
1387
- ---
1388
1363
  from vellum import WorkflowExpandMetaRequest, WorkflowRequestInputRequest_String
1389
1364
  from vellum.client import AsyncVellum
1390
1365
 
1391
1366
  client = AsyncVellum(
1392
1367
  api_key="YOUR_API_KEY",
1393
1368
  )
1394
- await client.execute_workflow(
1395
- inputs=[
1396
- WorkflowRequestInputRequest_String(
1397
- name="string",
1398
- value="string",
1399
- )
1400
- ],
1401
- expand_meta=WorkflowExpandMetaRequest(
1402
- usage=True,
1403
- ),
1404
- workflow_deployment_id="string",
1405
- workflow_deployment_name="string",
1406
- release_tag="string",
1407
- external_id="string",
1408
- )
1369
+
1370
+
1371
+ async def main() -> None:
1372
+ await client.execute_workflow(
1373
+ inputs=[
1374
+ WorkflowRequestInputRequest_String(
1375
+ name="string",
1376
+ value="string",
1377
+ )
1378
+ ],
1379
+ expand_meta=WorkflowExpandMetaRequest(
1380
+ usage=True,
1381
+ ),
1382
+ workflow_deployment_id="string",
1383
+ workflow_deployment_name="string",
1384
+ release_tag="string",
1385
+ external_id="string",
1386
+ )
1387
+
1388
+
1389
+ asyncio.run(main())
1409
1390
  """
1410
- _request: typing.Dict[str, typing.Any] = {"inputs": inputs}
1411
- if expand_meta is not OMIT:
1412
- _request["expand_meta"] = expand_meta
1413
- if workflow_deployment_id is not OMIT:
1414
- _request["workflow_deployment_id"] = workflow_deployment_id
1415
- if workflow_deployment_name is not OMIT:
1416
- _request["workflow_deployment_name"] = workflow_deployment_name
1417
- if release_tag is not OMIT:
1418
- _request["release_tag"] = release_tag
1419
- if external_id is not OMIT:
1420
- _request["external_id"] = external_id
1421
1391
  _response = await self._client_wrapper.httpx_client.request(
1392
+ "v1/execute-workflow",
1393
+ base_url=self._client_wrapper.get_environment().predict,
1422
1394
  method="POST",
1423
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow"),
1424
- params=jsonable_encoder(
1425
- request_options.get("additional_query_parameters") if request_options is not None else None
1426
- ),
1427
- json=jsonable_encoder(_request)
1428
- if request_options is None or request_options.get("additional_body_parameters") is None
1429
- else {
1430
- **jsonable_encoder(_request),
1431
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1395
+ json={
1396
+ "inputs": inputs,
1397
+ "expand_meta": expand_meta,
1398
+ "workflow_deployment_id": workflow_deployment_id,
1399
+ "workflow_deployment_name": workflow_deployment_name,
1400
+ "release_tag": release_tag,
1401
+ "external_id": external_id,
1432
1402
  },
1433
- headers=jsonable_encoder(
1434
- remove_none_from_dict(
1435
- {
1436
- **self._client_wrapper.get_headers(),
1437
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1438
- }
1439
- )
1440
- ),
1441
- timeout=request_options.get("timeout_in_seconds")
1442
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1443
- else self._client_wrapper.get_timeout(),
1444
- retries=0,
1445
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
1403
+ request_options=request_options,
1404
+ omit=OMIT,
1446
1405
  )
1447
- if 200 <= _response.status_code < 300:
1448
- return pydantic_v1.parse_obj_as(ExecuteWorkflowResponse, _response.json()) # type: ignore
1449
- if _response.status_code == 400:
1450
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1451
- if _response.status_code == 404:
1452
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1453
- if _response.status_code == 500:
1454
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1455
1406
  try:
1407
+ if 200 <= _response.status_code < 300:
1408
+ return pydantic_v1.parse_obj_as(ExecuteWorkflowResponse, _response.json()) # type: ignore
1409
+ if _response.status_code == 400:
1410
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1411
+ if _response.status_code == 404:
1412
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1413
+ if _response.status_code == 500:
1414
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1456
1415
  _response_json = _response.json()
1457
1416
  except JSONDecodeError:
1458
1417
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1468,106 +1427,110 @@ class AsyncVellum:
1468
1427
  release_tag: typing.Optional[str] = OMIT,
1469
1428
  external_id: typing.Optional[str] = OMIT,
1470
1429
  event_types: typing.Optional[typing.Sequence[WorkflowExecutionEventType]] = OMIT,
1471
- request_options: typing.Optional[RequestOptions] = None,
1430
+ request_options: typing.Optional[RequestOptions] = None
1472
1431
  ) -> typing.AsyncIterator[WorkflowStreamEvent]:
1473
1432
  """
1474
1433
  Executes a deployed Workflow and streams back its results.
1475
1434
 
1476
- Parameters:
1477
- - inputs: typing.Sequence[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's Deployment with their corresponding values.
1435
+ Parameters
1436
+ ----------
1437
+ inputs : typing.Sequence[WorkflowRequestInputRequest]
1438
+ The list of inputs defined in the Workflow's Deployment with their corresponding values.
1439
+
1440
+ expand_meta : typing.Optional[WorkflowExpandMetaRequest]
1441
+ An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
1442
+
1443
+ workflow_deployment_id : typing.Optional[str]
1444
+ The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
1478
1445
 
1479
- - expand_meta: typing.Optional[WorkflowExpandMetaRequest]. An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
1446
+ workflow_deployment_name : typing.Optional[str]
1447
+ The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
1480
1448
 
1481
- - workflow_deployment_id: typing.Optional[str]. The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
1449
+ release_tag : typing.Optional[str]
1450
+ Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
1482
1451
 
1483
- - workflow_deployment_name: typing.Optional[str]. The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
1452
+ external_id : typing.Optional[str]
1453
+ Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
1484
1454
 
1485
- - release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
1455
+ event_types : typing.Optional[typing.Sequence[WorkflowExecutionEventType]]
1456
+ Optionally specify which events you want to receive. Defaults to only WORKFLOW events. Note that the schema of non-WORKFLOW events is unstable and should be used with caution.
1486
1457
 
1487
- - external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
1458
+ request_options : typing.Optional[RequestOptions]
1459
+ Request-specific configuration.
1488
1460
 
1489
- - event_types: typing.Optional[typing.Sequence[WorkflowExecutionEventType]]. Optionally specify which events you want to receive. Defaults to only WORKFLOW events. Note that the schema of non-WORKFLOW events is unstable and should be used with caution.
1461
+ Yields
1462
+ ------
1463
+ typing.AsyncIterator[WorkflowStreamEvent]
1464
+
1465
+
1466
+ Examples
1467
+ --------
1468
+ import asyncio
1490
1469
 
1491
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
1492
- ---
1493
1470
  from vellum import WorkflowExpandMetaRequest, WorkflowRequestInputRequest_String
1494
1471
  from vellum.client import AsyncVellum
1495
1472
 
1496
1473
  client = AsyncVellum(
1497
1474
  api_key="YOUR_API_KEY",
1498
1475
  )
1499
- await client.execute_workflow_stream(
1500
- inputs=[
1501
- WorkflowRequestInputRequest_String(
1502
- name="string",
1503
- value="string",
1504
- )
1505
- ],
1506
- expand_meta=WorkflowExpandMetaRequest(
1507
- usage=True,
1508
- ),
1509
- workflow_deployment_id="string",
1510
- workflow_deployment_name="string",
1511
- release_tag="string",
1512
- external_id="string",
1513
- event_types=["NODE"],
1514
- )
1476
+
1477
+
1478
+ async def main() -> None:
1479
+ response = await client.execute_workflow_stream(
1480
+ inputs=[
1481
+ WorkflowRequestInputRequest_String(
1482
+ name="string",
1483
+ value="string",
1484
+ )
1485
+ ],
1486
+ expand_meta=WorkflowExpandMetaRequest(
1487
+ usage=True,
1488
+ ),
1489
+ workflow_deployment_id="string",
1490
+ workflow_deployment_name="string",
1491
+ release_tag="string",
1492
+ external_id="string",
1493
+ event_types=["NODE"],
1494
+ )
1495
+ async for chunk in response:
1496
+ yield chunk
1497
+
1498
+
1499
+ asyncio.run(main())
1515
1500
  """
1516
- _request: typing.Dict[str, typing.Any] = {"inputs": inputs}
1517
- if expand_meta is not OMIT:
1518
- _request["expand_meta"] = expand_meta
1519
- if workflow_deployment_id is not OMIT:
1520
- _request["workflow_deployment_id"] = workflow_deployment_id
1521
- if workflow_deployment_name is not OMIT:
1522
- _request["workflow_deployment_name"] = workflow_deployment_name
1523
- if release_tag is not OMIT:
1524
- _request["release_tag"] = release_tag
1525
- if external_id is not OMIT:
1526
- _request["external_id"] = external_id
1527
- if event_types is not OMIT:
1528
- _request["event_types"] = event_types
1529
1501
  async with self._client_wrapper.httpx_client.stream(
1502
+ "v1/execute-workflow-stream",
1503
+ base_url=self._client_wrapper.get_environment().predict,
1530
1504
  method="POST",
1531
- url=urllib.parse.urljoin(
1532
- f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow-stream"
1533
- ),
1534
- params=jsonable_encoder(
1535
- request_options.get("additional_query_parameters") if request_options is not None else None
1536
- ),
1537
- json=jsonable_encoder(_request)
1538
- if request_options is None or request_options.get("additional_body_parameters") is None
1539
- else {
1540
- **jsonable_encoder(_request),
1541
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1505
+ json={
1506
+ "inputs": inputs,
1507
+ "expand_meta": expand_meta,
1508
+ "workflow_deployment_id": workflow_deployment_id,
1509
+ "workflow_deployment_name": workflow_deployment_name,
1510
+ "release_tag": release_tag,
1511
+ "external_id": external_id,
1512
+ "event_types": event_types,
1542
1513
  },
1543
- headers=jsonable_encoder(
1544
- remove_none_from_dict(
1545
- {
1546
- **self._client_wrapper.get_headers(),
1547
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1548
- }
1549
- )
1550
- ),
1551
- timeout=request_options.get("timeout_in_seconds")
1552
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1553
- else self._client_wrapper.get_timeout(),
1554
- retries=0,
1555
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
1514
+ request_options=request_options,
1515
+ omit=OMIT,
1556
1516
  ) as _response:
1557
- if 200 <= _response.status_code < 300:
1558
- async for _text in _response.aiter_lines():
1559
- if len(_text) == 0:
1560
- continue
1561
- yield pydantic_v1.parse_obj_as(WorkflowStreamEvent, json.loads(_text)) # type: ignore
1562
- return
1563
- await _response.aread()
1564
- if _response.status_code == 400:
1565
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1566
- if _response.status_code == 404:
1567
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1568
- if _response.status_code == 500:
1569
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1570
1517
  try:
1518
+ if 200 <= _response.status_code < 300:
1519
+ async for _text in _response.aiter_lines():
1520
+ try:
1521
+ if len(_text) == 0:
1522
+ continue
1523
+ yield pydantic_v1.parse_obj_as(WorkflowStreamEvent, json.loads(_text)) # type: ignore
1524
+ except:
1525
+ pass
1526
+ return
1527
+ await _response.aread()
1528
+ if _response.status_code == 400:
1529
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1530
+ if _response.status_code == 404:
1531
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1532
+ if _response.status_code == 500:
1533
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1571
1534
  _response_json = _response.json()
1572
1535
  except JSONDecodeError:
1573
1536
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1576,11 +1539,11 @@ class AsyncVellum:
1576
1539
  async def generate(
1577
1540
  self,
1578
1541
  *,
1542
+ requests: typing.Sequence[GenerateRequest],
1579
1543
  deployment_id: typing.Optional[str] = OMIT,
1580
1544
  deployment_name: typing.Optional[str] = OMIT,
1581
- requests: typing.Sequence[GenerateRequest],
1582
1545
  options: typing.Optional[GenerateOptionsRequest] = OMIT,
1583
- request_options: typing.Optional[RequestOptions] = None,
1546
+ request_options: typing.Optional[RequestOptions] = None
1584
1547
  ) -> GenerateResponse:
1585
1548
  """
1586
1549
  Generate a completion using a previously defined deployment.
@@ -1588,75 +1551,76 @@ class AsyncVellum:
1588
1551
  Important: This endpoint is DEPRECATED and has been superseded by
1589
1552
  [execute-prompt](/api-reference/api-reference/execute-prompt).
1590
1553
 
1591
- Parameters:
1592
- - deployment_id: typing.Optional[str]. The ID of the deployment. Must provide either this or deployment_name.
1554
+ Parameters
1555
+ ----------
1556
+ requests : typing.Sequence[GenerateRequest]
1557
+ The generation request to make. Bulk requests are no longer supported, this field must be an array of length 1.
1558
+
1559
+ deployment_id : typing.Optional[str]
1560
+ The ID of the deployment. Must provide either this or deployment_name.
1561
+
1562
+ deployment_name : typing.Optional[str]
1563
+ The name of the deployment. Must provide either this or deployment_id.
1564
+
1565
+ options : typing.Optional[GenerateOptionsRequest]
1566
+ Additional configuration that can be used to control what's included in the response.
1567
+
1568
+ request_options : typing.Optional[RequestOptions]
1569
+ Request-specific configuration.
1593
1570
 
1594
- - deployment_name: typing.Optional[str]. The name of the deployment. Must provide either this or deployment_id.
1571
+ Returns
1572
+ -------
1573
+ GenerateResponse
1595
1574
 
1596
- - requests: typing.Sequence[GenerateRequest]. The generation request to make. Bulk requests are no longer supported, this field must be an array of length 1.
1597
1575
 
1598
- - options: typing.Optional[GenerateOptionsRequest]. Additional configuration that can be used to control what's included in the response.
1576
+ Examples
1577
+ --------
1578
+ import asyncio
1599
1579
 
1600
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
1601
- ---
1602
1580
  from vellum import GenerateRequest
1603
1581
  from vellum.client import AsyncVellum
1604
1582
 
1605
1583
  client = AsyncVellum(
1606
1584
  api_key="YOUR_API_KEY",
1607
1585
  )
1608
- await client.generate(
1609
- requests=[
1610
- GenerateRequest(
1611
- input_values={},
1612
- )
1613
- ],
1614
- )
1586
+
1587
+
1588
+ async def main() -> None:
1589
+ await client.generate(
1590
+ requests=[
1591
+ GenerateRequest(
1592
+ input_values={"key": "value"},
1593
+ )
1594
+ ],
1595
+ )
1596
+
1597
+
1598
+ asyncio.run(main())
1615
1599
  """
1616
- _request: typing.Dict[str, typing.Any] = {"requests": requests}
1617
- if deployment_id is not OMIT:
1618
- _request["deployment_id"] = deployment_id
1619
- if deployment_name is not OMIT:
1620
- _request["deployment_name"] = deployment_name
1621
- if options is not OMIT:
1622
- _request["options"] = options
1623
1600
  _response = await self._client_wrapper.httpx_client.request(
1601
+ "v1/generate",
1602
+ base_url=self._client_wrapper.get_environment().predict,
1624
1603
  method="POST",
1625
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate"),
1626
- params=jsonable_encoder(
1627
- request_options.get("additional_query_parameters") if request_options is not None else None
1628
- ),
1629
- json=jsonable_encoder(_request)
1630
- if request_options is None or request_options.get("additional_body_parameters") is None
1631
- else {
1632
- **jsonable_encoder(_request),
1633
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1604
+ json={
1605
+ "deployment_id": deployment_id,
1606
+ "deployment_name": deployment_name,
1607
+ "requests": requests,
1608
+ "options": options,
1634
1609
  },
1635
- headers=jsonable_encoder(
1636
- remove_none_from_dict(
1637
- {
1638
- **self._client_wrapper.get_headers(),
1639
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1640
- }
1641
- )
1642
- ),
1643
- timeout=request_options.get("timeout_in_seconds")
1644
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1645
- else self._client_wrapper.get_timeout(),
1646
- retries=0,
1647
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
1610
+ request_options=request_options,
1611
+ omit=OMIT,
1648
1612
  )
1649
- if 200 <= _response.status_code < 300:
1650
- return pydantic_v1.parse_obj_as(GenerateResponse, _response.json()) # type: ignore
1651
- if _response.status_code == 400:
1652
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1653
- if _response.status_code == 403:
1654
- raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1655
- if _response.status_code == 404:
1656
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1657
- if _response.status_code == 500:
1658
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1659
1613
  try:
1614
+ if 200 <= _response.status_code < 300:
1615
+ return pydantic_v1.parse_obj_as(GenerateResponse, _response.json()) # type: ignore
1616
+ if _response.status_code == 400:
1617
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1618
+ if _response.status_code == 403:
1619
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1620
+ if _response.status_code == 404:
1621
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1622
+ if _response.status_code == 500:
1623
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1660
1624
  _response_json = _response.json()
1661
1625
  except JSONDecodeError:
1662
1626
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1665,11 +1629,11 @@ class AsyncVellum:
1665
1629
  async def generate_stream(
1666
1630
  self,
1667
1631
  *,
1632
+ requests: typing.Sequence[GenerateRequest],
1668
1633
  deployment_id: typing.Optional[str] = OMIT,
1669
1634
  deployment_name: typing.Optional[str] = OMIT,
1670
- requests: typing.Sequence[GenerateRequest],
1671
1635
  options: typing.Optional[GenerateOptionsRequest] = OMIT,
1672
- request_options: typing.Optional[RequestOptions] = None,
1636
+ request_options: typing.Optional[RequestOptions] = None
1673
1637
  ) -> typing.AsyncIterator[GenerateStreamResponse]:
1674
1638
  """
1675
1639
  Generate a stream of completions using a previously defined deployment.
@@ -1677,17 +1641,32 @@ class AsyncVellum:
1677
1641
  Important: This endpoint is DEPRECATED and has been superseded by
1678
1642
  [execute-prompt-stream](/api-reference/api-reference/execute-prompt-stream).
1679
1643
 
1680
- Parameters:
1681
- - deployment_id: typing.Optional[str]. The ID of the deployment. Must provide either this or deployment_name.
1644
+ Parameters
1645
+ ----------
1646
+ requests : typing.Sequence[GenerateRequest]
1647
+ The generation request to make. Bulk requests are no longer supported, this field must be an array of length 1.
1648
+
1649
+ deployment_id : typing.Optional[str]
1650
+ The ID of the deployment. Must provide either this or deployment_name.
1651
+
1652
+ deployment_name : typing.Optional[str]
1653
+ The name of the deployment. Must provide either this or deployment_id.
1654
+
1655
+ options : typing.Optional[GenerateOptionsRequest]
1656
+ Additional configuration that can be used to control what's included in the response.
1682
1657
 
1683
- - deployment_name: typing.Optional[str]. The name of the deployment. Must provide either this or deployment_id.
1658
+ request_options : typing.Optional[RequestOptions]
1659
+ Request-specific configuration.
1684
1660
 
1685
- - requests: typing.Sequence[GenerateRequest]. The generation request to make. Bulk requests are no longer supported, this field must be an array of length 1.
1661
+ Yields
1662
+ ------
1663
+ typing.AsyncIterator[GenerateStreamResponse]
1686
1664
 
1687
- - options: typing.Optional[GenerateOptionsRequest]. Additional configuration that can be used to control what's included in the response.
1688
1665
 
1689
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
1690
- ---
1666
+ Examples
1667
+ --------
1668
+ import asyncio
1669
+
1691
1670
  from vellum import (
1692
1671
  ChatMessageContentRequest_String,
1693
1672
  ChatMessageRequest,
@@ -1699,77 +1678,68 @@ class AsyncVellum:
1699
1678
  client = AsyncVellum(
1700
1679
  api_key="YOUR_API_KEY",
1701
1680
  )
1702
- await client.generate_stream(
1703
- deployment_id="string",
1704
- deployment_name="string",
1705
- requests=[
1706
- GenerateRequest(
1707
- input_values={"string": {"key": "value"}},
1708
- chat_history=[
1709
- ChatMessageRequest(
1710
- text="string",
1711
- role="SYSTEM",
1712
- content=ChatMessageContentRequest_String(),
1713
- source="string",
1714
- )
1715
- ],
1716
- external_ids=["string"],
1717
- )
1718
- ],
1719
- options=GenerateOptionsRequest(
1720
- logprobs="ALL",
1721
- ),
1722
- )
1681
+
1682
+
1683
+ async def main() -> None:
1684
+ response = await client.generate_stream(
1685
+ deployment_id="string",
1686
+ deployment_name="string",
1687
+ requests=[
1688
+ GenerateRequest(
1689
+ input_values={"string": {"key": "value"}},
1690
+ chat_history=[
1691
+ ChatMessageRequest(
1692
+ text="string",
1693
+ role="SYSTEM",
1694
+ content=ChatMessageContentRequest_String(),
1695
+ source="string",
1696
+ )
1697
+ ],
1698
+ external_ids=["string"],
1699
+ )
1700
+ ],
1701
+ options=GenerateOptionsRequest(
1702
+ logprobs="ALL",
1703
+ ),
1704
+ )
1705
+ async for chunk in response:
1706
+ yield chunk
1707
+
1708
+
1709
+ asyncio.run(main())
1723
1710
  """
1724
- _request: typing.Dict[str, typing.Any] = {"requests": requests}
1725
- if deployment_id is not OMIT:
1726
- _request["deployment_id"] = deployment_id
1727
- if deployment_name is not OMIT:
1728
- _request["deployment_name"] = deployment_name
1729
- if options is not OMIT:
1730
- _request["options"] = options
1731
1711
  async with self._client_wrapper.httpx_client.stream(
1712
+ "v1/generate-stream",
1713
+ base_url=self._client_wrapper.get_environment().predict,
1732
1714
  method="POST",
1733
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate-stream"),
1734
- params=jsonable_encoder(
1735
- request_options.get("additional_query_parameters") if request_options is not None else None
1736
- ),
1737
- json=jsonable_encoder(_request)
1738
- if request_options is None or request_options.get("additional_body_parameters") is None
1739
- else {
1740
- **jsonable_encoder(_request),
1741
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1715
+ json={
1716
+ "deployment_id": deployment_id,
1717
+ "deployment_name": deployment_name,
1718
+ "requests": requests,
1719
+ "options": options,
1742
1720
  },
1743
- headers=jsonable_encoder(
1744
- remove_none_from_dict(
1745
- {
1746
- **self._client_wrapper.get_headers(),
1747
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1748
- }
1749
- )
1750
- ),
1751
- timeout=request_options.get("timeout_in_seconds")
1752
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1753
- else self._client_wrapper.get_timeout(),
1754
- retries=0,
1755
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
1721
+ request_options=request_options,
1722
+ omit=OMIT,
1756
1723
  ) as _response:
1757
- if 200 <= _response.status_code < 300:
1758
- async for _text in _response.aiter_lines():
1759
- if len(_text) == 0:
1760
- continue
1761
- yield pydantic_v1.parse_obj_as(GenerateStreamResponse, json.loads(_text)) # type: ignore
1762
- return
1763
- await _response.aread()
1764
- if _response.status_code == 400:
1765
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1766
- if _response.status_code == 403:
1767
- raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1768
- if _response.status_code == 404:
1769
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1770
- if _response.status_code == 500:
1771
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1772
1724
  try:
1725
+ if 200 <= _response.status_code < 300:
1726
+ async for _text in _response.aiter_lines():
1727
+ try:
1728
+ if len(_text) == 0:
1729
+ continue
1730
+ yield pydantic_v1.parse_obj_as(GenerateStreamResponse, json.loads(_text)) # type: ignore
1731
+ except:
1732
+ pass
1733
+ return
1734
+ await _response.aread()
1735
+ if _response.status_code == 400:
1736
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1737
+ if _response.status_code == 403:
1738
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1739
+ if _response.status_code == 404:
1740
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1741
+ if _response.status_code == 500:
1742
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1773
1743
  _response_json = _response.json()
1774
1744
  except JSONDecodeError:
1775
1745
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1778,77 +1748,73 @@ class AsyncVellum:
1778
1748
  async def search(
1779
1749
  self,
1780
1750
  *,
1751
+ query: str,
1781
1752
  index_id: typing.Optional[str] = OMIT,
1782
1753
  index_name: typing.Optional[str] = OMIT,
1783
- query: str,
1784
1754
  options: typing.Optional[SearchRequestOptionsRequest] = OMIT,
1785
- request_options: typing.Optional[RequestOptions] = None,
1755
+ request_options: typing.Optional[RequestOptions] = None
1786
1756
  ) -> SearchResponse:
1787
1757
  """
1788
1758
  Perform a search against a document index.
1789
1759
 
1790
- Parameters:
1791
- - index_id: typing.Optional[str]. The ID of the index to search against. Must provide either this or index_name.
1760
+ Parameters
1761
+ ----------
1762
+ query : str
1763
+ The query to search for.
1764
+
1765
+ index_id : typing.Optional[str]
1766
+ The ID of the index to search against. Must provide either this or index_name.
1767
+
1768
+ index_name : typing.Optional[str]
1769
+ The name of the index to search against. Must provide either this or index_id.
1792
1770
 
1793
- - index_name: typing.Optional[str]. The name of the index to search against. Must provide either this or index_id.
1771
+ options : typing.Optional[SearchRequestOptionsRequest]
1772
+ Configuration options for the search.
1794
1773
 
1795
- - query: str. The query to search for.
1774
+ request_options : typing.Optional[RequestOptions]
1775
+ Request-specific configuration.
1796
1776
 
1797
- - options: typing.Optional[SearchRequestOptionsRequest]. Configuration options for the search.
1777
+ Returns
1778
+ -------
1779
+ SearchResponse
1780
+
1781
+
1782
+ Examples
1783
+ --------
1784
+ import asyncio
1798
1785
 
1799
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
1800
- ---
1801
1786
  from vellum.client import AsyncVellum
1802
1787
 
1803
1788
  client = AsyncVellum(
1804
1789
  api_key="YOUR_API_KEY",
1805
1790
  )
1806
- await client.search(
1807
- query="query",
1808
- )
1791
+
1792
+
1793
+ async def main() -> None:
1794
+ await client.search(
1795
+ query="query",
1796
+ )
1797
+
1798
+
1799
+ asyncio.run(main())
1809
1800
  """
1810
- _request: typing.Dict[str, typing.Any] = {"query": query}
1811
- if index_id is not OMIT:
1812
- _request["index_id"] = index_id
1813
- if index_name is not OMIT:
1814
- _request["index_name"] = index_name
1815
- if options is not OMIT:
1816
- _request["options"] = options
1817
1801
  _response = await self._client_wrapper.httpx_client.request(
1802
+ "v1/search",
1803
+ base_url=self._client_wrapper.get_environment().predict,
1818
1804
  method="POST",
1819
- url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/search"),
1820
- params=jsonable_encoder(
1821
- request_options.get("additional_query_parameters") if request_options is not None else None
1822
- ),
1823
- json=jsonable_encoder(_request)
1824
- if request_options is None or request_options.get("additional_body_parameters") is None
1825
- else {
1826
- **jsonable_encoder(_request),
1827
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1828
- },
1829
- headers=jsonable_encoder(
1830
- remove_none_from_dict(
1831
- {
1832
- **self._client_wrapper.get_headers(),
1833
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1834
- }
1835
- )
1836
- ),
1837
- timeout=request_options.get("timeout_in_seconds")
1838
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1839
- else self._client_wrapper.get_timeout(),
1840
- retries=0,
1841
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
1805
+ json={"index_id": index_id, "index_name": index_name, "query": query, "options": options},
1806
+ request_options=request_options,
1807
+ omit=OMIT,
1842
1808
  )
1843
- if 200 <= _response.status_code < 300:
1844
- return pydantic_v1.parse_obj_as(SearchResponse, _response.json()) # type: ignore
1845
- if _response.status_code == 400:
1846
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1847
- if _response.status_code == 404:
1848
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1849
- if _response.status_code == 500:
1850
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1851
1809
  try:
1810
+ if 200 <= _response.status_code < 300:
1811
+ return pydantic_v1.parse_obj_as(SearchResponse, _response.json()) # type: ignore
1812
+ if _response.status_code == 400:
1813
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1814
+ if _response.status_code == 404:
1815
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1816
+ if _response.status_code == 500:
1817
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1852
1818
  _response_json = _response.json()
1853
1819
  except JSONDecodeError:
1854
1820
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1857,75 +1823,69 @@ class AsyncVellum:
1857
1823
  async def submit_completion_actuals(
1858
1824
  self,
1859
1825
  *,
1826
+ actuals: typing.Sequence[SubmitCompletionActualRequest],
1860
1827
  deployment_id: typing.Optional[str] = OMIT,
1861
1828
  deployment_name: typing.Optional[str] = OMIT,
1862
- actuals: typing.Sequence[SubmitCompletionActualRequest],
1863
- request_options: typing.Optional[RequestOptions] = None,
1829
+ request_options: typing.Optional[RequestOptions] = None
1864
1830
  ) -> None:
1865
1831
  """
1866
1832
  Used to submit feedback regarding the quality of previously generated completions.
1867
1833
 
1868
- Parameters:
1869
- - deployment_id: typing.Optional[str]. The ID of the deployment. Must provide either this or deployment_name.
1834
+ Parameters
1835
+ ----------
1836
+ actuals : typing.Sequence[SubmitCompletionActualRequest]
1837
+ Feedback regarding the quality of previously generated completions
1838
+
1839
+ deployment_id : typing.Optional[str]
1840
+ The ID of the deployment. Must provide either this or deployment_name.
1841
+
1842
+ deployment_name : typing.Optional[str]
1843
+ The name of the deployment. Must provide either this or deployment_id.
1844
+
1845
+ request_options : typing.Optional[RequestOptions]
1846
+ Request-specific configuration.
1870
1847
 
1871
- - deployment_name: typing.Optional[str]. The name of the deployment. Must provide either this or deployment_id.
1848
+ Returns
1849
+ -------
1850
+ None
1872
1851
 
1873
- - actuals: typing.Sequence[SubmitCompletionActualRequest]. Feedback regarding the quality of previously generated completions
1852
+ Examples
1853
+ --------
1854
+ import asyncio
1874
1855
 
1875
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
1876
- ---
1877
1856
  from vellum import SubmitCompletionActualRequest
1878
1857
  from vellum.client import AsyncVellum
1879
1858
 
1880
1859
  client = AsyncVellum(
1881
1860
  api_key="YOUR_API_KEY",
1882
1861
  )
1883
- await client.submit_completion_actuals(
1884
- actuals=[SubmitCompletionActualRequest()],
1885
- )
1862
+
1863
+
1864
+ async def main() -> None:
1865
+ await client.submit_completion_actuals(
1866
+ actuals=[SubmitCompletionActualRequest()],
1867
+ )
1868
+
1869
+
1870
+ asyncio.run(main())
1886
1871
  """
1887
- _request: typing.Dict[str, typing.Any] = {"actuals": actuals}
1888
- if deployment_id is not OMIT:
1889
- _request["deployment_id"] = deployment_id
1890
- if deployment_name is not OMIT:
1891
- _request["deployment_name"] = deployment_name
1892
1872
  _response = await self._client_wrapper.httpx_client.request(
1873
+ "v1/submit-completion-actuals",
1874
+ base_url=self._client_wrapper.get_environment().predict,
1893
1875
  method="POST",
1894
- url=urllib.parse.urljoin(
1895
- f"{self._client_wrapper.get_environment().predict}/", "v1/submit-completion-actuals"
1896
- ),
1897
- params=jsonable_encoder(
1898
- request_options.get("additional_query_parameters") if request_options is not None else None
1899
- ),
1900
- json=jsonable_encoder(_request)
1901
- if request_options is None or request_options.get("additional_body_parameters") is None
1902
- else {
1903
- **jsonable_encoder(_request),
1904
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1905
- },
1906
- headers=jsonable_encoder(
1907
- remove_none_from_dict(
1908
- {
1909
- **self._client_wrapper.get_headers(),
1910
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1911
- }
1912
- )
1913
- ),
1914
- timeout=request_options.get("timeout_in_seconds")
1915
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1916
- else self._client_wrapper.get_timeout(),
1917
- retries=0,
1918
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
1876
+ json={"deployment_id": deployment_id, "deployment_name": deployment_name, "actuals": actuals},
1877
+ request_options=request_options,
1878
+ omit=OMIT,
1919
1879
  )
1920
- if 200 <= _response.status_code < 300:
1921
- return
1922
- if _response.status_code == 400:
1923
- raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1924
- if _response.status_code == 404:
1925
- raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1926
- if _response.status_code == 500:
1927
- raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1928
1880
  try:
1881
+ if 200 <= _response.status_code < 300:
1882
+ return
1883
+ if _response.status_code == 400:
1884
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1885
+ if _response.status_code == 404:
1886
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1887
+ if _response.status_code == 500:
1888
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
1929
1889
  _response_json = _response.json()
1930
1890
  except JSONDecodeError:
1931
1891
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -1937,67 +1897,61 @@ class AsyncVellum:
1937
1897
  actuals: typing.Sequence[SubmitWorkflowExecutionActualRequest],
1938
1898
  execution_id: typing.Optional[str] = OMIT,
1939
1899
  external_id: typing.Optional[str] = OMIT,
1940
- request_options: typing.Optional[RequestOptions] = None,
1900
+ request_options: typing.Optional[RequestOptions] = None
1941
1901
  ) -> None:
1942
1902
  """
1943
1903
  Used to submit feedback regarding the quality of previous workflow execution and its outputs.
1944
1904
 
1945
1905
  **Note:** Uses a base url of `https://predict.vellum.ai`.
1946
1906
 
1947
- Parameters:
1948
- - actuals: typing.Sequence[SubmitWorkflowExecutionActualRequest]. Feedback regarding the quality of an output on a previously executed workflow.
1907
+ Parameters
1908
+ ----------
1909
+ actuals : typing.Sequence[SubmitWorkflowExecutionActualRequest]
1910
+ Feedback regarding the quality of an output on a previously executed workflow.
1911
+
1912
+ execution_id : typing.Optional[str]
1913
+ The Vellum-generated ID of a previously executed workflow. Must provide either this or external_id.
1914
+
1915
+ external_id : typing.Optional[str]
1916
+ The external ID that was originally provided by when executing the workflow, if applicable, that you'd now like to submit actuals for. Must provide either this or execution_id.
1917
+
1918
+ request_options : typing.Optional[RequestOptions]
1919
+ Request-specific configuration.
1949
1920
 
1950
- - execution_id: typing.Optional[str]. The Vellum-generated ID of a previously executed workflow. Must provide either this or external_id.
1921
+ Returns
1922
+ -------
1923
+ None
1951
1924
 
1952
- - external_id: typing.Optional[str]. The external ID that was originally provided by when executing the workflow, if applicable, that you'd now like to submit actuals for. Must provide either this or execution_id.
1925
+ Examples
1926
+ --------
1927
+ import asyncio
1953
1928
 
1954
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
1955
- ---
1956
1929
  from vellum.client import AsyncVellum
1957
1930
 
1958
1931
  client = AsyncVellum(
1959
1932
  api_key="YOUR_API_KEY",
1960
1933
  )
1961
- await client.submit_workflow_execution_actuals(
1962
- actuals=[],
1963
- )
1934
+
1935
+
1936
+ async def main() -> None:
1937
+ await client.submit_workflow_execution_actuals(
1938
+ actuals=[],
1939
+ )
1940
+
1941
+
1942
+ asyncio.run(main())
1964
1943
  """
1965
- _request: typing.Dict[str, typing.Any] = {"actuals": actuals}
1966
- if execution_id is not OMIT:
1967
- _request["execution_id"] = execution_id
1968
- if external_id is not OMIT:
1969
- _request["external_id"] = external_id
1970
1944
  _response = await self._client_wrapper.httpx_client.request(
1945
+ "v1/submit-workflow-execution-actuals",
1946
+ base_url=self._client_wrapper.get_environment().predict,
1971
1947
  method="POST",
1972
- url=urllib.parse.urljoin(
1973
- f"{self._client_wrapper.get_environment().predict}/", "v1/submit-workflow-execution-actuals"
1974
- ),
1975
- params=jsonable_encoder(
1976
- request_options.get("additional_query_parameters") if request_options is not None else None
1977
- ),
1978
- json=jsonable_encoder(_request)
1979
- if request_options is None or request_options.get("additional_body_parameters") is None
1980
- else {
1981
- **jsonable_encoder(_request),
1982
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
1983
- },
1984
- headers=jsonable_encoder(
1985
- remove_none_from_dict(
1986
- {
1987
- **self._client_wrapper.get_headers(),
1988
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
1989
- }
1990
- )
1991
- ),
1992
- timeout=request_options.get("timeout_in_seconds")
1993
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
1994
- else self._client_wrapper.get_timeout(),
1995
- retries=0,
1996
- max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
1948
+ json={"actuals": actuals, "execution_id": execution_id, "external_id": external_id},
1949
+ request_options=request_options,
1950
+ omit=OMIT,
1997
1951
  )
1998
- if 200 <= _response.status_code < 300:
1999
- return
2000
1952
  try:
1953
+ if 200 <= _response.status_code < 300:
1954
+ return
2001
1955
  _response_json = _response.json()
2002
1956
  except JSONDecodeError:
2003
1957
  raise ApiError(status_code=_response.status_code, body=_response.text)