vellum-ai 0.3.23__py3-none-any.whl → 0.5.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (327) hide show
  1. vellum/__init__.py +37 -60
  2. vellum/client.py +139 -137
  3. vellum/core/__init__.py +2 -0
  4. vellum/core/client_wrapper.py +1 -1
  5. vellum/core/jsonable_encoder.py +5 -9
  6. vellum/core/pydantic_utilities.py +12 -0
  7. vellum/errors/__init__.py +1 -2
  8. vellum/lib/__init__.py +5 -0
  9. vellum/lib/test_suites/__init__.py +5 -0
  10. vellum/lib/test_suites/constants.py +2 -0
  11. vellum/lib/test_suites/exceptions.py +2 -0
  12. vellum/lib/test_suites/resources.py +331 -0
  13. vellum/lib/utils/__init__.py +0 -0
  14. vellum/lib/utils/env.py +13 -0
  15. vellum/lib/utils/exceptions.py +2 -0
  16. vellum/lib/utils/paginator.py +29 -0
  17. vellum/resources/__init__.py +0 -4
  18. vellum/resources/deployments/client.py +27 -31
  19. vellum/resources/deployments/types/deployments_list_request_status.py +1 -13
  20. vellum/resources/document_indexes/client.py +35 -39
  21. vellum/resources/document_indexes/types/document_indexes_list_request_status.py +1 -13
  22. vellum/resources/documents/client.py +131 -35
  23. vellum/resources/folder_entities/client.py +4 -4
  24. vellum/resources/sandboxes/client.py +18 -46
  25. vellum/resources/test_suite_runs/client.py +19 -23
  26. vellum/resources/test_suites/client.py +17 -21
  27. vellum/resources/workflow_deployments/client.py +13 -17
  28. vellum/resources/workflow_deployments/types/workflow_deployments_list_request_status.py +1 -13
  29. vellum/types/__init__.py +37 -55
  30. vellum/types/api_node_result.py +3 -7
  31. vellum/types/api_node_result_data.py +4 -8
  32. vellum/types/array_chat_message_content.py +3 -7
  33. vellum/types/array_chat_message_content_request.py +3 -7
  34. vellum/types/chat_history_input_request.py +4 -8
  35. vellum/types/chat_history_variable_value.py +3 -7
  36. vellum/types/chat_message.py +4 -8
  37. vellum/types/chat_message_request.py +4 -8
  38. vellum/types/chat_message_role.py +1 -32
  39. vellum/types/code_execution_node_array_result.py +3 -7
  40. vellum/types/code_execution_node_chat_history_result.py +3 -7
  41. vellum/types/code_execution_node_error_result.py +3 -7
  42. vellum/types/code_execution_node_function_call_result.py +3 -7
  43. vellum/types/code_execution_node_json_result.py +3 -7
  44. vellum/types/code_execution_node_number_result.py +3 -7
  45. vellum/types/code_execution_node_result.py +3 -7
  46. vellum/types/code_execution_node_result_data.py +3 -7
  47. vellum/types/code_execution_node_search_results_result.py +3 -7
  48. vellum/types/code_execution_node_string_result.py +3 -7
  49. vellum/types/conditional_node_result.py +3 -7
  50. vellum/types/conditional_node_result_data.py +3 -7
  51. vellum/types/deployment_provider_payload_response.py +3 -7
  52. vellum/types/deployment_read.py +8 -12
  53. vellum/types/document_document_to_document_index.py +6 -10
  54. vellum/types/document_index_read.py +8 -12
  55. vellum/types/document_read.py +8 -12
  56. vellum/types/enriched_normalized_completion.py +9 -13
  57. vellum/types/entity_status.py +1 -18
  58. vellum/types/environment_enum.py +1 -27
  59. vellum/types/error_variable_value.py +3 -7
  60. vellum/types/execute_prompt_api_error_response.py +4 -8
  61. vellum/types/execute_workflow_error_response.py +4 -8
  62. vellum/types/execute_workflow_response.py +3 -7
  63. vellum/types/execute_workflow_stream_error_response.py +4 -8
  64. vellum/types/execution_array_vellum_value.py +4 -8
  65. vellum/types/execution_chat_history_vellum_value.py +4 -8
  66. vellum/types/execution_error_vellum_value.py +4 -8
  67. vellum/types/execution_function_call_vellum_value.py +4 -8
  68. vellum/types/execution_json_vellum_value.py +4 -8
  69. vellum/types/execution_number_vellum_value.py +4 -8
  70. vellum/types/execution_search_results_vellum_value.py +4 -8
  71. vellum/types/execution_string_vellum_value.py +4 -8
  72. vellum/types/external_test_case_execution.py +4 -8
  73. vellum/types/external_test_case_execution_request.py +4 -8
  74. vellum/types/finish_reason_enum.py +1 -27
  75. vellum/types/fulfilled_execute_prompt_event.py +3 -7
  76. vellum/types/fulfilled_execute_prompt_response.py +5 -9
  77. vellum/types/fulfilled_execute_workflow_workflow_result_event.py +3 -7
  78. vellum/types/fulfilled_function_call.py +3 -7
  79. vellum/types/{registered_prompt_input_variable_request.py → fulfilled_function_call_request.py} +10 -9
  80. vellum/types/fulfilled_prompt_execution_meta.py +3 -7
  81. vellum/types/fulfilled_workflow_node_result_event.py +3 -7
  82. vellum/types/function_call_chat_message_content.py +3 -7
  83. vellum/types/function_call_chat_message_content_request.py +3 -7
  84. vellum/types/function_call_chat_message_content_value.py +3 -7
  85. vellum/types/function_call_chat_message_content_value_request.py +3 -7
  86. vellum/types/function_call_variable_value.py +3 -7
  87. vellum/types/generate_error_response.py +4 -8
  88. vellum/types/generate_options_request.py +4 -8
  89. vellum/types/generate_request.py +6 -10
  90. vellum/types/generate_result.py +5 -9
  91. vellum/types/generate_result_data.py +4 -8
  92. vellum/types/generate_result_error.py +4 -8
  93. vellum/types/generate_stream_response.py +3 -7
  94. vellum/types/generate_stream_result.py +3 -7
  95. vellum/types/generate_stream_result_data.py +3 -7
  96. vellum/types/image_chat_message_content.py +3 -7
  97. vellum/types/image_chat_message_content_request.py +3 -7
  98. vellum/types/image_variable_value.py +3 -7
  99. vellum/types/indexing_state_enum.py +3 -37
  100. vellum/types/initiated_execute_prompt_event.py +3 -7
  101. vellum/types/initiated_prompt_execution_meta.py +3 -7
  102. vellum/types/initiated_workflow_node_result_event.py +3 -7
  103. vellum/types/json_input_request.py +4 -8
  104. vellum/types/json_variable_value.py +3 -7
  105. vellum/types/logical_operator.py +23 -173
  106. vellum/types/logprobs_enum.py +1 -18
  107. vellum/types/metadata_filter_config_request.py +3 -7
  108. vellum/types/metadata_filter_rule_combinator.py +1 -18
  109. vellum/types/metadata_filter_rule_request.py +3 -7
  110. vellum/types/ml_model_usage.py +3 -7
  111. vellum/types/named_scenario_input_chat_history_variable_value_request.py +31 -0
  112. vellum/types/named_scenario_input_request.py +31 -0
  113. vellum/types/{registered_prompt_sandbox_snapshot.py → named_scenario_input_string_variable_value_request.py} +7 -9
  114. vellum/types/named_test_case_chat_history_variable_value.py +3 -7
  115. vellum/types/named_test_case_chat_history_variable_value_request.py +3 -7
  116. vellum/types/named_test_case_error_variable_value.py +3 -7
  117. vellum/types/named_test_case_error_variable_value_request.py +3 -7
  118. vellum/types/{register_prompt_prompt.py → named_test_case_function_call_variable_value.py} +7 -13
  119. vellum/types/named_test_case_function_call_variable_value_request.py +31 -0
  120. vellum/types/named_test_case_json_variable_value.py +3 -7
  121. vellum/types/named_test_case_json_variable_value_request.py +3 -7
  122. vellum/types/named_test_case_number_variable_value.py +3 -7
  123. vellum/types/named_test_case_number_variable_value_request.py +3 -7
  124. vellum/types/named_test_case_search_results_variable_value.py +3 -7
  125. vellum/types/named_test_case_search_results_variable_value_request.py +3 -7
  126. vellum/types/named_test_case_string_variable_value.py +3 -7
  127. vellum/types/named_test_case_string_variable_value_request.py +3 -7
  128. vellum/types/named_test_case_variable_value.py +12 -0
  129. vellum/types/named_test_case_variable_value_request.py +12 -0
  130. vellum/types/node_input_compiled_array_value.py +3 -7
  131. vellum/types/node_input_compiled_chat_history_value.py +3 -7
  132. vellum/types/node_input_compiled_error_value.py +3 -7
  133. vellum/types/node_input_compiled_function_call.py +3 -7
  134. vellum/types/node_input_compiled_json_value.py +3 -7
  135. vellum/types/node_input_compiled_number_value.py +3 -7
  136. vellum/types/node_input_compiled_search_results_value.py +3 -7
  137. vellum/types/node_input_compiled_string_value.py +3 -7
  138. vellum/types/node_output_compiled_array_value.py +3 -7
  139. vellum/types/node_output_compiled_chat_history_value.py +3 -7
  140. vellum/types/node_output_compiled_error_value.py +3 -7
  141. vellum/types/node_output_compiled_function_value.py +3 -7
  142. vellum/types/node_output_compiled_json_value.py +3 -7
  143. vellum/types/node_output_compiled_number_value.py +3 -7
  144. vellum/types/node_output_compiled_search_results_value.py +3 -7
  145. vellum/types/node_output_compiled_string_value.py +3 -7
  146. vellum/types/normalized_log_probs.py +3 -7
  147. vellum/types/normalized_token_log_probs.py +3 -7
  148. vellum/types/number_variable_value.py +3 -7
  149. vellum/types/paginated_document_index_read_list.py +3 -7
  150. vellum/types/paginated_slim_deployment_read_list.py +3 -7
  151. vellum/types/paginated_slim_document_list.py +3 -7
  152. vellum/types/paginated_slim_workflow_deployment_list.py +3 -7
  153. vellum/types/paginated_test_suite_run_execution_list.py +3 -7
  154. vellum/types/paginated_test_suite_test_case_list.py +3 -7
  155. vellum/types/processing_failure_reason_enum.py +1 -20
  156. vellum/types/processing_state_enum.py +1 -32
  157. vellum/types/prompt_deployment_expand_meta_request_request.py +9 -13
  158. vellum/types/prompt_execution_meta.py +3 -7
  159. vellum/types/prompt_node_result.py +3 -7
  160. vellum/types/prompt_node_result_data.py +3 -7
  161. vellum/types/raw_prompt_execution_overrides_request.py +5 -9
  162. vellum/types/rejected_execute_prompt_event.py +3 -7
  163. vellum/types/rejected_execute_prompt_response.py +5 -9
  164. vellum/types/rejected_execute_workflow_workflow_result_event.py +3 -7
  165. vellum/types/rejected_function_call.py +3 -7
  166. vellum/types/rejected_prompt_execution_meta.py +3 -7
  167. vellum/types/rejected_workflow_node_result_event.py +3 -7
  168. vellum/types/sandbox_scenario.py +5 -9
  169. vellum/types/scenario_input.py +18 -21
  170. vellum/types/{registered_prompt_sandbox.py → scenario_input_chat_history_variable_value.py} +7 -13
  171. vellum/types/{register_prompt_error_response.py → scenario_input_string_variable_value.py} +7 -9
  172. vellum/types/search_error_response.py +4 -8
  173. vellum/types/search_filters_request.py +5 -9
  174. vellum/types/search_node_result.py +3 -7
  175. vellum/types/search_node_result_data.py +4 -8
  176. vellum/types/search_request_options_request.py +7 -11
  177. vellum/types/search_response.py +4 -8
  178. vellum/types/search_result.py +6 -10
  179. vellum/types/search_result_document.py +7 -11
  180. vellum/types/search_result_document_request.py +6 -10
  181. vellum/types/search_result_merging_request.py +4 -8
  182. vellum/types/search_result_request.py +6 -10
  183. vellum/types/search_results_variable_value.py +3 -7
  184. vellum/types/search_weights_request.py +5 -9
  185. vellum/types/slim_deployment_read.py +7 -11
  186. vellum/types/slim_document.py +12 -16
  187. vellum/types/slim_workflow_deployment.py +9 -13
  188. vellum/types/streaming_execute_prompt_event.py +4 -8
  189. vellum/types/streaming_prompt_execution_meta.py +3 -7
  190. vellum/types/streaming_workflow_node_result_event.py +3 -7
  191. vellum/types/string_chat_message_content.py +3 -7
  192. vellum/types/string_chat_message_content_request.py +3 -7
  193. vellum/types/string_input_request.py +4 -8
  194. vellum/types/string_variable_value.py +3 -7
  195. vellum/types/submit_completion_actual_request.py +8 -12
  196. vellum/types/submit_completion_actuals_error_response.py +3 -7
  197. vellum/types/subworkflow_node_result.py +3 -7
  198. vellum/types/templating_node_array_result.py +3 -7
  199. vellum/types/templating_node_chat_history_result.py +3 -7
  200. vellum/types/templating_node_error_result.py +3 -7
  201. vellum/types/templating_node_function_call_result.py +3 -7
  202. vellum/types/templating_node_json_result.py +3 -7
  203. vellum/types/templating_node_number_result.py +3 -7
  204. vellum/types/templating_node_result.py +3 -7
  205. vellum/types/templating_node_result_data.py +3 -7
  206. vellum/types/templating_node_search_results_result.py +3 -7
  207. vellum/types/templating_node_string_result.py +3 -7
  208. vellum/types/terminal_node_array_result.py +4 -8
  209. vellum/types/terminal_node_chat_history_result.py +4 -8
  210. vellum/types/terminal_node_error_result.py +4 -8
  211. vellum/types/terminal_node_function_call_result.py +4 -8
  212. vellum/types/terminal_node_json_result.py +4 -8
  213. vellum/types/terminal_node_number_result.py +4 -8
  214. vellum/types/terminal_node_result.py +3 -7
  215. vellum/types/terminal_node_result_data.py +3 -7
  216. vellum/types/terminal_node_search_results_result.py +4 -8
  217. vellum/types/terminal_node_string_result.py +4 -8
  218. vellum/types/test_case_chat_history_variable_value.py +3 -7
  219. vellum/types/test_case_error_variable_value.py +3 -7
  220. vellum/types/test_case_function_call_variable_value.py +32 -0
  221. vellum/types/test_case_json_variable_value.py +3 -7
  222. vellum/types/test_case_number_variable_value.py +3 -7
  223. vellum/types/test_case_search_results_variable_value.py +3 -7
  224. vellum/types/test_case_string_variable_value.py +3 -7
  225. vellum/types/test_case_variable_value.py +12 -0
  226. vellum/types/test_suite_run_deployment_release_tag_exec_config.py +4 -8
  227. vellum/types/test_suite_run_deployment_release_tag_exec_config_data.py +5 -9
  228. vellum/types/test_suite_run_deployment_release_tag_exec_config_data_request.py +5 -9
  229. vellum/types/test_suite_run_deployment_release_tag_exec_config_request.py +4 -8
  230. vellum/types/test_suite_run_execution.py +3 -7
  231. vellum/types/test_suite_run_execution_chat_history_output.py +3 -7
  232. vellum/types/test_suite_run_execution_error_output.py +3 -7
  233. vellum/types/{registered_prompt_model_version.py → test_suite_run_execution_function_call_output.py} +8 -13
  234. vellum/types/test_suite_run_execution_json_output.py +3 -7
  235. vellum/types/test_suite_run_execution_metric_definition.py +3 -7
  236. vellum/types/test_suite_run_execution_metric_result.py +3 -7
  237. vellum/types/test_suite_run_execution_number_output.py +3 -7
  238. vellum/types/test_suite_run_execution_output.py +12 -0
  239. vellum/types/test_suite_run_execution_search_results_output.py +3 -7
  240. vellum/types/test_suite_run_execution_string_output.py +3 -7
  241. vellum/types/test_suite_run_external_exec_config.py +4 -8
  242. vellum/types/test_suite_run_external_exec_config_data.py +4 -8
  243. vellum/types/test_suite_run_external_exec_config_data_request.py +4 -8
  244. vellum/types/test_suite_run_external_exec_config_request.py +4 -8
  245. vellum/types/test_suite_run_metric_error_output.py +3 -7
  246. vellum/types/test_suite_run_metric_number_output.py +3 -7
  247. vellum/types/test_suite_run_metric_string_output.py +3 -7
  248. vellum/types/test_suite_run_read.py +5 -9
  249. vellum/types/test_suite_run_state.py +1 -37
  250. vellum/types/test_suite_run_test_suite.py +3 -7
  251. vellum/types/test_suite_run_workflow_release_tag_exec_config.py +4 -8
  252. vellum/types/test_suite_run_workflow_release_tag_exec_config_data.py +5 -9
  253. vellum/types/test_suite_run_workflow_release_tag_exec_config_data_request.py +5 -9
  254. vellum/types/test_suite_run_workflow_release_tag_exec_config_request.py +4 -8
  255. vellum/types/test_suite_test_case.py +3 -7
  256. vellum/types/upload_document_error_response.py +3 -7
  257. vellum/types/upload_document_response.py +4 -8
  258. vellum/types/vellum_error.py +3 -7
  259. vellum/types/vellum_error_code_enum.py +3 -32
  260. vellum/types/vellum_error_request.py +3 -7
  261. vellum/types/vellum_image.py +3 -7
  262. vellum/types/vellum_image_request.py +3 -7
  263. vellum/types/vellum_variable.py +3 -7
  264. vellum/types/vellum_variable_type.py +6 -57
  265. vellum/types/workflow_deployment_read.py +9 -13
  266. vellum/types/workflow_event_error.py +3 -7
  267. vellum/types/workflow_execution_actual_chat_history_request.py +8 -12
  268. vellum/types/workflow_execution_actual_json_request.py +8 -12
  269. vellum/types/workflow_execution_actual_string_request.py +8 -12
  270. vellum/types/workflow_execution_event_error_code.py +13 -52
  271. vellum/types/workflow_execution_event_type.py +1 -18
  272. vellum/types/workflow_execution_node_result_event.py +3 -7
  273. vellum/types/workflow_execution_workflow_result_event.py +3 -7
  274. vellum/types/workflow_node_result_event_state.py +3 -32
  275. vellum/types/workflow_output_array.py +4 -8
  276. vellum/types/workflow_output_chat_history.py +4 -8
  277. vellum/types/workflow_output_error.py +4 -8
  278. vellum/types/workflow_output_function_call.py +4 -8
  279. vellum/types/workflow_output_image.py +4 -8
  280. vellum/types/workflow_output_json.py +4 -8
  281. vellum/types/workflow_output_number.py +4 -8
  282. vellum/types/workflow_output_search_results.py +4 -8
  283. vellum/types/workflow_output_string.py +4 -8
  284. vellum/types/workflow_request_chat_history_input_request.py +4 -8
  285. vellum/types/workflow_request_json_input_request.py +4 -8
  286. vellum/types/workflow_request_number_input_request.py +4 -8
  287. vellum/types/workflow_request_string_input_request.py +4 -8
  288. vellum/types/workflow_result_event.py +3 -7
  289. vellum/types/workflow_result_event_output_data_array.py +4 -8
  290. vellum/types/workflow_result_event_output_data_chat_history.py +4 -8
  291. vellum/types/workflow_result_event_output_data_error.py +4 -8
  292. vellum/types/workflow_result_event_output_data_function_call.py +4 -8
  293. vellum/types/workflow_result_event_output_data_json.py +4 -8
  294. vellum/types/workflow_result_event_output_data_number.py +4 -8
  295. vellum/types/workflow_result_event_output_data_search_results.py +4 -8
  296. vellum/types/workflow_result_event_output_data_string.py +5 -9
  297. {vellum_ai-0.3.23.dist-info → vellum_ai-0.5.1.dist-info}/METADATA +1 -2
  298. vellum_ai-0.5.1.dist-info/RECORD +382 -0
  299. vellum/errors/conflict_error.py +0 -9
  300. vellum/resources/model_versions/__init__.py +0 -2
  301. vellum/resources/model_versions/client.py +0 -123
  302. vellum/resources/registered_prompts/__init__.py +0 -2
  303. vellum/resources/registered_prompts/client.py +0 -327
  304. vellum/types/block_type_enum.py +0 -36
  305. vellum/types/model_version_build_config.py +0 -40
  306. vellum/types/model_version_exec_config.py +0 -48
  307. vellum/types/model_version_exec_config_parameters.py +0 -37
  308. vellum/types/model_version_read.py +0 -82
  309. vellum/types/model_version_read_status_enum.py +0 -36
  310. vellum/types/model_version_sandbox_snapshot.py +0 -44
  311. vellum/types/prompt_template_block.py +0 -41
  312. vellum/types/prompt_template_block_data.py +0 -31
  313. vellum/types/prompt_template_block_data_request.py +0 -31
  314. vellum/types/prompt_template_block_properties.py +0 -47
  315. vellum/types/prompt_template_block_properties_request.py +0 -47
  316. vellum/types/prompt_template_block_request.py +0 -41
  317. vellum/types/prompt_template_block_state.py +0 -22
  318. vellum/types/provider_enum.py +0 -81
  319. vellum/types/register_prompt_model_parameters_request.py +0 -37
  320. vellum/types/register_prompt_prompt_info_request.py +0 -35
  321. vellum/types/register_prompt_response.py +0 -62
  322. vellum/types/registered_prompt_deployment.py +0 -42
  323. vellum/types/scenario_input_request.py +0 -34
  324. vellum/types/scenario_input_type_enum.py +0 -22
  325. vellum_ai-0.3.23.dist-info/RECORD +0 -394
  326. {vellum_ai-0.3.23.dist-info → vellum_ai-0.5.1.dist-info}/LICENSE +0 -0
  327. {vellum_ai-0.3.23.dist-info → vellum_ai-0.5.1.dist-info}/WHEEL +0 -0
vellum/core/__init__.py CHANGED
@@ -6,6 +6,7 @@ from .datetime_utils import serialize_datetime
6
6
  from .file import File, convert_file_dict_to_httpx_tuples
7
7
  from .http_client import AsyncHttpClient, HttpClient
8
8
  from .jsonable_encoder import jsonable_encoder
9
+ from .pydantic_utilities import pydantic_v1
9
10
  from .remove_none_from_dict import remove_none_from_dict
10
11
  from .request_options import RequestOptions
11
12
 
@@ -20,6 +21,7 @@ __all__ = [
20
21
  "SyncClientWrapper",
21
22
  "convert_file_dict_to_httpx_tuples",
22
23
  "jsonable_encoder",
24
+ "pydantic_v1",
23
25
  "remove_none_from_dict",
24
26
  "serialize_datetime",
25
27
  ]
@@ -18,7 +18,7 @@ class BaseClientWrapper:
18
18
  headers: typing.Dict[str, str] = {
19
19
  "X-Fern-Language": "Python",
20
20
  "X-Fern-SDK-Name": "vellum-ai",
21
- "X-Fern-SDK-Version": "0.3.23",
21
+ "X-Fern-SDK-Version": "0.5.1",
22
22
  }
23
23
  headers["X_API_KEY"] = self.api_key
24
24
  return headers
@@ -16,12 +16,8 @@ from pathlib import PurePath
16
16
  from types import GeneratorType
17
17
  from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
18
18
 
19
- try:
20
- import pydantic.v1 as pydantic # type: ignore
21
- except ImportError:
22
- import pydantic # type: ignore
23
-
24
19
  from .datetime_utils import serialize_datetime
20
+ from .pydantic_utilities import pydantic_v1
25
21
 
26
22
  SetIntStr = Set[Union[int, str]]
27
23
  DictIntStrAny = Dict[Union[int, str], Any]
@@ -36,7 +32,7 @@ def generate_encoders_by_class_tuples(
36
32
  return encoders_by_class_tuples
37
33
 
38
34
 
39
- encoders_by_class_tuples = generate_encoders_by_class_tuples(pydantic.json.ENCODERS_BY_TYPE)
35
+ encoders_by_class_tuples = generate_encoders_by_class_tuples(pydantic_v1.json.ENCODERS_BY_TYPE)
40
36
 
41
37
 
42
38
  def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any:
@@ -48,7 +44,7 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any]
48
44
  for encoder_type, encoder_instance in custom_encoder.items():
49
45
  if isinstance(obj, encoder_type):
50
46
  return encoder_instance(obj)
51
- if isinstance(obj, pydantic.BaseModel):
47
+ if isinstance(obj, pydantic_v1.BaseModel):
52
48
  encoder = getattr(obj.__config__, "json_encoders", {})
53
49
  if custom_encoder:
54
50
  encoder.update(custom_encoder)
@@ -84,8 +80,8 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any]
84
80
  encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder))
85
81
  return encoded_list
86
82
 
87
- if type(obj) in pydantic.json.ENCODERS_BY_TYPE:
88
- return pydantic.json.ENCODERS_BY_TYPE[type(obj)](obj)
83
+ if type(obj) in pydantic_v1.json.ENCODERS_BY_TYPE:
84
+ return pydantic_v1.json.ENCODERS_BY_TYPE[type(obj)](obj)
89
85
  for encoder, classes_tuple in encoders_by_class_tuples.items():
90
86
  if isinstance(obj, classes_tuple):
91
87
  return encoder(obj)
@@ -0,0 +1,12 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import pydantic
4
+
5
+ IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
6
+
7
+ if IS_PYDANTIC_V2:
8
+ import pydantic.v1 as pydantic_v1 # type: ignore # nopycln: import
9
+ else:
10
+ import pydantic as pydantic_v1 # type: ignore # nopycln: import
11
+
12
+ __all__ = ["pydantic_v1"]
vellum/errors/__init__.py CHANGED
@@ -1,9 +1,8 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  from .bad_request_error import BadRequestError
4
- from .conflict_error import ConflictError
5
4
  from .forbidden_error import ForbiddenError
6
5
  from .internal_server_error import InternalServerError
7
6
  from .not_found_error import NotFoundError
8
7
 
9
- __all__ = ["BadRequestError", "ConflictError", "ForbiddenError", "InternalServerError", "NotFoundError"]
8
+ __all__ = ["BadRequestError", "ForbiddenError", "InternalServerError", "NotFoundError"]
vellum/lib/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .test_suites import VellumTestSuite
2
+
3
+ __all__ = [
4
+ "VellumTestSuite",
5
+ ]
@@ -0,0 +1,5 @@
1
+ from .resources import VellumTestSuite
2
+
3
+ __all__ = [
4
+ "VellumTestSuite",
5
+ ]
@@ -0,0 +1,2 @@
1
+ DEFAULT_POLLING_INTERVAL_MS = 500 # Half a second
2
+ DEFAULT_MAX_POLLING_DURATION_MS = 30 * 60 * 1000 # Half an hour
@@ -0,0 +1,2 @@
1
+ class TestSuiteRunResultsException(Exception):
2
+ pass
@@ -0,0 +1,331 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ import time
5
+ from functools import cached_property
6
+ from typing import Callable, Generator, List, Any
7
+
8
+ from vellum import TestSuiteRunRead, TestSuiteRunMetricOutput_Number
9
+ from vellum.client import Vellum
10
+ from vellum.lib.test_suites.constants import (
11
+ DEFAULT_MAX_POLLING_DURATION_MS,
12
+ DEFAULT_POLLING_INTERVAL_MS,
13
+ )
14
+ from vellum.lib.test_suites.exceptions import TestSuiteRunResultsException
15
+ from vellum.lib.utils.env import get_api_key
16
+ from vellum.lib.utils.paginator import PaginatedResults, get_all_results
17
+ from vellum.types import (
18
+ ExternalTestCaseExecutionRequest,
19
+ NamedTestCaseVariableValueRequest,
20
+ TestCaseVariableValue,
21
+ TestSuiteRunExecConfigRequest_External,
22
+ TestSuiteRunExecution,
23
+ TestSuiteRunExternalExecConfigDataRequest,
24
+ TestSuiteRunMetricOutput,
25
+ TestSuiteRunState,
26
+ )
27
+
28
+ logger = logging.getLogger(__name__)
29
+
30
+
31
+ class VellumTestSuiteRunExecution(TestSuiteRunExecution):
32
+ @classmethod
33
+ def from_api(cls, execution: TestSuiteRunExecution) -> VellumTestSuiteRunExecution:
34
+ return cls(
35
+ id=execution.id,
36
+ test_case_id=execution.test_case_id,
37
+ outputs=execution.outputs,
38
+ metric_results=execution.metric_results,
39
+ )
40
+
41
+ def get_metric_output(
42
+ self,
43
+ metric_identifier: str | None = None,
44
+ output_identifier: str | None = None,
45
+ ) -> TestSuiteRunMetricOutput:
46
+ """Retrieve a metric's output by specifying the info needed to uniquely identify that metric and output.
47
+
48
+ metric_identifier: Anything that uniquely identifies the metric to retrieve (e.g. it's label, name or id)
49
+ output_identifier: Anything that uniquely identifies the output to retrieve (e.g. it's name)
50
+ """
51
+
52
+ metric_outputs = self.get_metric_outputs(metric_identifier)
53
+
54
+ filtered_metric_outputs = [
55
+ metric_output
56
+ for metric_output in metric_outputs
57
+ if output_identifier is None or metric_output.name == output_identifier
58
+ ]
59
+
60
+ if len(filtered_metric_outputs) == 0:
61
+ raise TestSuiteRunResultsException(
62
+ f"No metric outputs found with identifier: {output_identifier}"
63
+ )
64
+
65
+ if len(filtered_metric_outputs) > 1:
66
+ raise TestSuiteRunResultsException(
67
+ f"Multiple metric outputs found with identifier: {output_identifier}"
68
+ )
69
+
70
+ return filtered_metric_outputs[0]
71
+
72
+ def get_metric_outputs(
73
+ self,
74
+ metric_identifier: str | None = None,
75
+ ) -> List[TestSuiteRunMetricOutput]:
76
+ """Return a metric's output across all executions by providing the info needed to uniquely identify it.
77
+
78
+ metric_identifier: Anything that uniquely identifies the metric to retrieve (e.g. it's label, name or id).
79
+ """
80
+
81
+ filtered_metric_results = [
82
+ metric_output
83
+ for metric_output in self.metric_results
84
+ if metric_identifier is None
85
+ or (metric_output.metric_id == metric_identifier)
86
+ or (metric_output.metric_label == metric_identifier)
87
+ or (
88
+ metric_output.metric_definition
89
+ and metric_output.metric_definition.id == metric_identifier
90
+ )
91
+ or (
92
+ metric_output.metric_definition
93
+ and metric_output.metric_definition.name == metric_identifier
94
+ )
95
+ or (
96
+ metric_output.metric_definition
97
+ and metric_output.metric_definition.label == metric_identifier
98
+ )
99
+ ]
100
+
101
+ if len(filtered_metric_results) == 0:
102
+ raise TestSuiteRunResultsException(
103
+ f"No metric results found with identifier: {metric_identifier}"
104
+ )
105
+
106
+ if len(filtered_metric_results) > 1:
107
+ raise TestSuiteRunResultsException(
108
+ f"Multiple metric results found with identifier: {metric_identifier}"
109
+ )
110
+
111
+ return filtered_metric_results[0].outputs
112
+
113
+
114
+ class VellumTestSuiteRunResults:
115
+ """A utility class with methods for conveniently operating on a Test Suite Run and its results."""
116
+
117
+ def __init__(
118
+ self,
119
+ test_suite_run: TestSuiteRunRead,
120
+ *,
121
+ client: Vellum | None = None,
122
+ polling_interval: int = DEFAULT_POLLING_INTERVAL_MS,
123
+ max_polling_duration: int = DEFAULT_MAX_POLLING_DURATION_MS,
124
+ ) -> None:
125
+ self._test_suite_run = test_suite_run
126
+ self._client = client or Vellum(
127
+ api_key=get_api_key(),
128
+ )
129
+ self._executions: Generator[VellumTestSuiteRunExecution, None, None] | None = (
130
+ None
131
+ )
132
+ self._polling_interval = polling_interval
133
+ self._max_polling_duration = max_polling_duration
134
+
135
+ @property
136
+ def state(self) -> TestSuiteRunState:
137
+ return self._test_suite_run.state
138
+
139
+ @cached_property
140
+ def all_executions(self) -> list[VellumTestSuiteRunExecution]:
141
+ return list(self._get_test_suite_run_executions())
142
+
143
+ def get_metric_outputs(
144
+ self, metric_identifier: str | None = None, output_identifier: str | None = None
145
+ ) -> List[TestSuiteRunMetricOutput]:
146
+ """Retrieve a metric's output across all executions by providing the info needed to uniquely identify it."""
147
+
148
+ return [
149
+ execution.get_metric_output(
150
+ metric_identifier=metric_identifier, output_identifier=output_identifier
151
+ )
152
+ for execution in self.all_executions
153
+ ]
154
+
155
+ def get_count_metric_outputs(
156
+ self,
157
+ metric_identifier: str | None = None,
158
+ output_identifier: str | None = None,
159
+ *,
160
+ predicate: Callable[[TestSuiteRunMetricOutput], bool] | None = None,
161
+ ) -> int:
162
+ """Returns the count of all metric outputs that match the given criteria."""
163
+
164
+ metric_outputs = self.get_metric_outputs(
165
+ metric_identifier=metric_identifier, output_identifier=output_identifier
166
+ )
167
+
168
+ if predicate is None:
169
+ return len(metric_outputs)
170
+
171
+ return len([output for output in metric_outputs if predicate(output)])
172
+
173
+ def get_numeric_metric_output_values(
174
+ self,
175
+ metric_identifier: str | None = None,
176
+ output_identifier: str | None = None,
177
+ ) -> List[float]:
178
+ """Returns the values of a numeric metric output that match the given criteria."""
179
+
180
+ metric_outputs: list[TestSuiteRunMetricOutput_Number] = []
181
+
182
+ for output in self.get_metric_outputs(
183
+ metric_identifier=metric_identifier, output_identifier=output_identifier
184
+ ):
185
+ if output.type != "NUMBER":
186
+ raise TestSuiteRunResultsException(
187
+ f"Expected a numeric metric output, but got a {output.type} output instead."
188
+ )
189
+
190
+ metric_outputs.append(output)
191
+
192
+ return [output.value for output in metric_outputs]
193
+
194
+ def get_mean_metric_output(
195
+ self, metric_identifier: str | None = None, output_identifier: str | None = None
196
+ ) -> float:
197
+ """Returns the mean of all metric outputs that match the given criteria."""
198
+ output_values = self.get_numeric_metric_output_values(
199
+ metric_identifier=metric_identifier, output_identifier=output_identifier
200
+ )
201
+ return sum(output_values) / len(output_values)
202
+
203
+ def get_min_metric_output(
204
+ self, metric_identifier: str | None = None, output_identifier: str | None = None
205
+ ) -> float:
206
+ """Returns the min value across= all metric outputs that match the given criteria."""
207
+ output_values = self.get_numeric_metric_output_values(
208
+ metric_identifier=metric_identifier, output_identifier=output_identifier
209
+ )
210
+ return min(output_values)
211
+
212
+ def get_max_metric_output(
213
+ self, metric_identifier: str | None = None, output_identifier: str | None = None
214
+ ) -> float:
215
+ """Returns the max value across all metric outputs that match the given criteria."""
216
+ output_values = self.get_numeric_metric_output_values(
217
+ metric_identifier=metric_identifier, output_identifier=output_identifier
218
+ )
219
+ return max(output_values)
220
+
221
+ def wait_until_complete(self) -> None:
222
+ """Wait until the Test Suite Run is no longer in a QUEUED or RUNNING state."""
223
+
224
+ start_time = time.time_ns()
225
+ while True:
226
+ logger.debug("Polling for latest test suite run state...")
227
+ self._refresh_test_suite_run()
228
+ if self.state not in {"QUEUED", "RUNNING"}:
229
+ break
230
+
231
+ current_time = time.time_ns()
232
+ if ((current_time - start_time) / 1e6) > self._max_polling_duration:
233
+ raise TestSuiteRunResultsException(
234
+ "Test suite run timed out polling for executions"
235
+ )
236
+
237
+ time.sleep(self._polling_interval / 1000.0)
238
+
239
+ if self.state == "FAILED":
240
+ raise TestSuiteRunResultsException("Test suite run failed")
241
+
242
+ if self.state == "CANCELLED":
243
+ raise TestSuiteRunResultsException("Test suite run was cancelled")
244
+
245
+ def _refresh_test_suite_run(self):
246
+ test_suite_run = self._client.test_suite_runs.retrieve(self._test_suite_run.id)
247
+ self._test_suite_run = test_suite_run
248
+
249
+ def _list_paginated_executions(
250
+ self, offset: int | None, limit: int | None
251
+ ) -> PaginatedResults[TestSuiteRunExecution]:
252
+ response = self._client.test_suite_runs.list_executions(
253
+ self._test_suite_run.id,
254
+ offset=offset,
255
+ limit=limit,
256
+ expand=[
257
+ "results.metric_results.metric_definition",
258
+ "results.metric_results.metric_label",
259
+ ],
260
+ )
261
+ return PaginatedResults(results=response.results, count=response.count)
262
+
263
+ def _wrap_api_executions(
264
+ self, executions: Generator[TestSuiteRunExecution, None, None]
265
+ ) -> Generator[VellumTestSuiteRunExecution, None, None]:
266
+ for execution in executions:
267
+ yield VellumTestSuiteRunExecution.from_api(execution)
268
+
269
+ def _get_test_suite_run_executions(
270
+ self,
271
+ ) -> Generator[VellumTestSuiteRunExecution, None, None]:
272
+ if self._executions is not None:
273
+ return self._executions
274
+
275
+ self.wait_until_complete()
276
+
277
+ raw_api_executions = get_all_results(self._list_paginated_executions)
278
+ self._executions = self._wrap_api_executions(raw_api_executions)
279
+ return self._executions
280
+
281
+
282
+ class VellumTestSuite:
283
+ """A utility class that provides methods for running a Vellum Test Suite and interacting with its results."""
284
+
285
+ def __init__(
286
+ self,
287
+ test_suite_id: str,
288
+ *,
289
+ client: Vellum | None = None,
290
+ ) -> None:
291
+ self.client = client or Vellum(
292
+ api_key=get_api_key(),
293
+ )
294
+ self._test_suite_id = test_suite_id
295
+
296
+ def run_external(
297
+ self,
298
+ executable: Callable[
299
+ [List[TestCaseVariableValue]], List[NamedTestCaseVariableValueRequest]
300
+ ],
301
+ ) -> VellumTestSuiteRunResults:
302
+ """
303
+ Runs this Vellum Test Suite on any executable function defined external to Vellum.
304
+
305
+ Returns a wrapper that polls the generated Test Suite Run until it's done running and returns its results.
306
+ """
307
+ test_cases = self.client.test_suites.list_test_suite_test_cases(
308
+ id=self._test_suite_id
309
+ )
310
+ executions: List[ExternalTestCaseExecutionRequest] = []
311
+
312
+ for test_case in test_cases.results:
313
+ outputs = executable(test_case.input_values)
314
+
315
+ executions.append(
316
+ ExternalTestCaseExecutionRequest(
317
+ test_case_id=test_case.id, # type: ignore[arg-type]
318
+ outputs=outputs,
319
+ )
320
+ )
321
+
322
+ test_suite_run = self.client.test_suite_runs.create(
323
+ test_suite_id=self._test_suite_id,
324
+ exec_config=TestSuiteRunExecConfigRequest_External(
325
+ type="EXTERNAL",
326
+ data=TestSuiteRunExternalExecConfigDataRequest(
327
+ executions=executions,
328
+ ),
329
+ ),
330
+ )
331
+ return VellumTestSuiteRunResults(test_suite_run, client=self.client)
File without changes
@@ -0,0 +1,13 @@
1
+ import os
2
+
3
+ from .exceptions import VellumClientException
4
+
5
+
6
+ def get_api_key() -> str:
7
+ api_key = os.environ.get("VELLUM_API_KEY")
8
+ if api_key is None:
9
+ raise VellumClientException(
10
+ "`VELLUM_API_KEY` environment variable is required to be set."
11
+ )
12
+
13
+ return api_key
@@ -0,0 +1,2 @@
1
+ class VellumClientException(Exception):
2
+ pass
@@ -0,0 +1,29 @@
1
+ from dataclasses import dataclass
2
+ from typing import Callable, Generator, Generic, List, TypeVar, Union
3
+
4
+
5
+ Result = TypeVar("Result")
6
+
7
+
8
+ @dataclass
9
+ class PaginatedResults(Generic[Result]):
10
+ count: int
11
+ results: List[Result]
12
+
13
+
14
+ def get_all_results(
15
+ paginated_api: Callable[[int, Union[int, None]], PaginatedResults[Result]],
16
+ page_size: Union[int, None] = None,
17
+ ) -> Generator[Result, None, None]:
18
+ offset = 0
19
+ count = 0
20
+ while True:
21
+ paginated_results = paginated_api(offset, page_size)
22
+ for result in paginated_results.results:
23
+ yield result
24
+ count += 1
25
+
26
+ if paginated_results.count <= count:
27
+ break
28
+
29
+ offset = count
@@ -5,8 +5,6 @@ from . import (
5
5
  document_indexes,
6
6
  documents,
7
7
  folder_entities,
8
- model_versions,
9
- registered_prompts,
10
8
  sandboxes,
11
9
  test_suite_runs,
12
10
  test_suites,
@@ -24,8 +22,6 @@ __all__ = [
24
22
  "document_indexes",
25
23
  "documents",
26
24
  "folder_entities",
27
- "model_versions",
28
- "registered_prompts",
29
25
  "sandboxes",
30
26
  "test_suite_runs",
31
27
  "test_suites",
@@ -7,6 +7,7 @@ from json.decoder import JSONDecodeError
7
7
  from ...core.api_error import ApiError
8
8
  from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
9
  from ...core.jsonable_encoder import jsonable_encoder
10
+ from ...core.pydantic_utilities import pydantic_v1
10
11
  from ...core.remove_none_from_dict import remove_none_from_dict
11
12
  from ...core.request_options import RequestOptions
12
13
  from ...errors.bad_request_error import BadRequestError
@@ -19,11 +20,6 @@ from ...types.paginated_slim_deployment_read_list import PaginatedSlimDeployment
19
20
  from ...types.prompt_deployment_input_request import PromptDeploymentInputRequest
20
21
  from .types.deployments_list_request_status import DeploymentsListRequestStatus
21
22
 
22
- try:
23
- import pydantic.v1 as pydantic # type: ignore
24
- except ImportError:
25
- import pydantic # type: ignore
26
-
27
23
  # this is used as the default value for optional parameters
28
24
  OMIT = typing.cast(typing.Any, ...)
29
25
 
@@ -61,8 +57,8 @@ class DeploymentsClient:
61
57
  client.deployments.list()
62
58
  """
63
59
  _response = self._client_wrapper.httpx_client.request(
64
- "GET",
65
- urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/deployments"),
60
+ method="GET",
61
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/deployments"),
66
62
  params=jsonable_encoder(
67
63
  remove_none_from_dict(
68
64
  {
@@ -93,7 +89,7 @@ class DeploymentsClient:
93
89
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
94
90
  )
95
91
  if 200 <= _response.status_code < 300:
96
- return pydantic.parse_obj_as(PaginatedSlimDeploymentReadList, _response.json()) # type: ignore
92
+ return pydantic_v1.parse_obj_as(PaginatedSlimDeploymentReadList, _response.json()) # type: ignore
97
93
  try:
98
94
  _response_json = _response.json()
99
95
  except JSONDecodeError:
@@ -119,8 +115,8 @@ class DeploymentsClient:
119
115
  )
120
116
  """
121
117
  _response = self._client_wrapper.httpx_client.request(
122
- "GET",
123
- urllib.parse.urljoin(
118
+ method="GET",
119
+ url=urllib.parse.urljoin(
124
120
  f"{self._client_wrapper.get_environment().default}/", f"v1/deployments/{jsonable_encoder(id)}"
125
121
  ),
126
122
  params=jsonable_encoder(
@@ -141,7 +137,7 @@ class DeploymentsClient:
141
137
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
142
138
  )
143
139
  if 200 <= _response.status_code < 300:
144
- return pydantic.parse_obj_as(DeploymentRead, _response.json()) # type: ignore
140
+ return pydantic_v1.parse_obj_as(DeploymentRead, _response.json()) # type: ignore
145
141
  try:
146
142
  _response_json = _response.json()
147
143
  except JSONDecodeError:
@@ -186,8 +182,8 @@ class DeploymentsClient:
186
182
  if release_tag is not OMIT:
187
183
  _request["release_tag"] = release_tag
188
184
  _response = self._client_wrapper.httpx_client.request(
189
- "POST",
190
- urllib.parse.urljoin(
185
+ method="POST",
186
+ url=urllib.parse.urljoin(
191
187
  f"{self._client_wrapper.get_environment().default}/", "v1/deployments/provider-payload"
192
188
  ),
193
189
  params=jsonable_encoder(
@@ -214,15 +210,15 @@ class DeploymentsClient:
214
210
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
215
211
  )
216
212
  if 200 <= _response.status_code < 300:
217
- return pydantic.parse_obj_as(DeploymentProviderPayloadResponse, _response.json()) # type: ignore
213
+ return pydantic_v1.parse_obj_as(DeploymentProviderPayloadResponse, _response.json()) # type: ignore
218
214
  if _response.status_code == 400:
219
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
215
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
220
216
  if _response.status_code == 403:
221
- raise ForbiddenError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
217
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
222
218
  if _response.status_code == 404:
223
- raise NotFoundError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
219
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
224
220
  if _response.status_code == 500:
225
- raise InternalServerError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
221
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
226
222
  try:
227
223
  _response_json = _response.json()
228
224
  except JSONDecodeError:
@@ -263,8 +259,8 @@ class AsyncDeploymentsClient:
263
259
  await client.deployments.list()
264
260
  """
265
261
  _response = await self._client_wrapper.httpx_client.request(
266
- "GET",
267
- urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/deployments"),
262
+ method="GET",
263
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/deployments"),
268
264
  params=jsonable_encoder(
269
265
  remove_none_from_dict(
270
266
  {
@@ -295,7 +291,7 @@ class AsyncDeploymentsClient:
295
291
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
296
292
  )
297
293
  if 200 <= _response.status_code < 300:
298
- return pydantic.parse_obj_as(PaginatedSlimDeploymentReadList, _response.json()) # type: ignore
294
+ return pydantic_v1.parse_obj_as(PaginatedSlimDeploymentReadList, _response.json()) # type: ignore
299
295
  try:
300
296
  _response_json = _response.json()
301
297
  except JSONDecodeError:
@@ -321,8 +317,8 @@ class AsyncDeploymentsClient:
321
317
  )
322
318
  """
323
319
  _response = await self._client_wrapper.httpx_client.request(
324
- "GET",
325
- urllib.parse.urljoin(
320
+ method="GET",
321
+ url=urllib.parse.urljoin(
326
322
  f"{self._client_wrapper.get_environment().default}/", f"v1/deployments/{jsonable_encoder(id)}"
327
323
  ),
328
324
  params=jsonable_encoder(
@@ -343,7 +339,7 @@ class AsyncDeploymentsClient:
343
339
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
344
340
  )
345
341
  if 200 <= _response.status_code < 300:
346
- return pydantic.parse_obj_as(DeploymentRead, _response.json()) # type: ignore
342
+ return pydantic_v1.parse_obj_as(DeploymentRead, _response.json()) # type: ignore
347
343
  try:
348
344
  _response_json = _response.json()
349
345
  except JSONDecodeError:
@@ -388,8 +384,8 @@ class AsyncDeploymentsClient:
388
384
  if release_tag is not OMIT:
389
385
  _request["release_tag"] = release_tag
390
386
  _response = await self._client_wrapper.httpx_client.request(
391
- "POST",
392
- urllib.parse.urljoin(
387
+ method="POST",
388
+ url=urllib.parse.urljoin(
393
389
  f"{self._client_wrapper.get_environment().default}/", "v1/deployments/provider-payload"
394
390
  ),
395
391
  params=jsonable_encoder(
@@ -416,15 +412,15 @@ class AsyncDeploymentsClient:
416
412
  max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
417
413
  )
418
414
  if 200 <= _response.status_code < 300:
419
- return pydantic.parse_obj_as(DeploymentProviderPayloadResponse, _response.json()) # type: ignore
415
+ return pydantic_v1.parse_obj_as(DeploymentProviderPayloadResponse, _response.json()) # type: ignore
420
416
  if _response.status_code == 400:
421
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
417
+ raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
422
418
  if _response.status_code == 403:
423
- raise ForbiddenError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
419
+ raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
424
420
  if _response.status_code == 404:
425
- raise NotFoundError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
421
+ raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
426
422
  if _response.status_code == 500:
427
- raise InternalServerError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
423
+ raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
428
424
  try:
429
425
  _response_json = _response.json()
430
426
  except JSONDecodeError: