vellum_ai 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. checksums.yaml +7 -0
  2. data/lib/core/file_utilities.rb +26 -0
  3. data/lib/environment.rb +11 -0
  4. data/lib/gemconfig.rb +14 -0
  5. data/lib/requests.rb +88 -0
  6. data/lib/types_export.rb +255 -0
  7. data/lib/vellum_ai/deployments/client.rb +157 -0
  8. data/lib/vellum_ai/deployments/types/deployments_list_request_status.rb +8 -0
  9. data/lib/vellum_ai/document_indexes/client.rb +135 -0
  10. data/lib/vellum_ai/documents/client.rb +245 -0
  11. data/lib/vellum_ai/model_versions/client.rb +61 -0
  12. data/lib/vellum_ai/registered_prompts/client.rb +154 -0
  13. data/lib/vellum_ai/sandboxes/client.rb +132 -0
  14. data/lib/vellum_ai/test_suites/client.rb +130 -0
  15. data/lib/vellum_ai/types/api_node_result.rb +52 -0
  16. data/lib/vellum_ai/types/api_node_result_data.rb +80 -0
  17. data/lib/vellum_ai/types/array_chat_message_content.rb +50 -0
  18. data/lib/vellum_ai/types/array_chat_message_content_item.rb +103 -0
  19. data/lib/vellum_ai/types/array_chat_message_content_item_request.rb +103 -0
  20. data/lib/vellum_ai/types/array_chat_message_content_request.rb +50 -0
  21. data/lib/vellum_ai/types/block_type_enum.rb +11 -0
  22. data/lib/vellum_ai/types/chat_history_enum.rb +5 -0
  23. data/lib/vellum_ai/types/chat_history_input_request.rb +55 -0
  24. data/lib/vellum_ai/types/chat_message.rb +62 -0
  25. data/lib/vellum_ai/types/chat_message_content.rb +116 -0
  26. data/lib/vellum_ai/types/chat_message_content_request.rb +116 -0
  27. data/lib/vellum_ai/types/chat_message_request.rb +62 -0
  28. data/lib/vellum_ai/types/chat_message_role.rb +6 -0
  29. data/lib/vellum_ai/types/code_execution_node_chat_history_result.rb +54 -0
  30. data/lib/vellum_ai/types/code_execution_node_error_result.rb +56 -0
  31. data/lib/vellum_ai/types/code_execution_node_json_result.rb +50 -0
  32. data/lib/vellum_ai/types/code_execution_node_number_result.rb +50 -0
  33. data/lib/vellum_ai/types/code_execution_node_result.rb +52 -0
  34. data/lib/vellum_ai/types/code_execution_node_result_data.rb +51 -0
  35. data/lib/vellum_ai/types/code_execution_node_result_output.rb +142 -0
  36. data/lib/vellum_ai/types/code_execution_node_search_results_result.rb +54 -0
  37. data/lib/vellum_ai/types/code_execution_node_string_result.rb +50 -0
  38. data/lib/vellum_ai/types/conditional_node_result.rb +52 -0
  39. data/lib/vellum_ai/types/conditional_node_result_data.rb +45 -0
  40. data/lib/vellum_ai/types/deployment_provider_payload_response.rb +45 -0
  41. data/lib/vellum_ai/types/deployment_read.rb +115 -0
  42. data/lib/vellum_ai/types/document_document_to_document_index.rb +70 -0
  43. data/lib/vellum_ai/types/document_index_read.rb +98 -0
  44. data/lib/vellum_ai/types/document_read.rb +121 -0
  45. data/lib/vellum_ai/types/document_status.rb +5 -0
  46. data/lib/vellum_ai/types/enriched_normalized_completion.rb +118 -0
  47. data/lib/vellum_ai/types/entity_status.rb +6 -0
  48. data/lib/vellum_ai/types/environment_enum.rb +6 -0
  49. data/lib/vellum_ai/types/error_enum.rb +5 -0
  50. data/lib/vellum_ai/types/error_variable_value.rb +51 -0
  51. data/lib/vellum_ai/types/execute_prompt_api_error_response.rb +45 -0
  52. data/lib/vellum_ai/types/execute_prompt_event.rb +116 -0
  53. data/lib/vellum_ai/types/execute_prompt_response.rb +90 -0
  54. data/lib/vellum_ai/types/execute_workflow_error_response.rb +45 -0
  55. data/lib/vellum_ai/types/execute_workflow_response.rb +67 -0
  56. data/lib/vellum_ai/types/execute_workflow_stream_error_response.rb +45 -0
  57. data/lib/vellum_ai/types/execute_workflow_workflow_result_event.rb +90 -0
  58. data/lib/vellum_ai/types/finish_reason_enum.rb +6 -0
  59. data/lib/vellum_ai/types/fulfilled_enum.rb +5 -0
  60. data/lib/vellum_ai/types/fulfilled_execute_prompt_event.rb +66 -0
  61. data/lib/vellum_ai/types/fulfilled_execute_prompt_response.rb +71 -0
  62. data/lib/vellum_ai/types/fulfilled_execute_workflow_workflow_result_event.rb +61 -0
  63. data/lib/vellum_ai/types/fulfilled_function_call.rb +56 -0
  64. data/lib/vellum_ai/types/fulfilled_prompt_execution_meta.rb +52 -0
  65. data/lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb +90 -0
  66. data/lib/vellum_ai/types/function_call.rb +90 -0
  67. data/lib/vellum_ai/types/function_call_chat_message_content.rb +52 -0
  68. data/lib/vellum_ai/types/function_call_chat_message_content_request.rb +52 -0
  69. data/lib/vellum_ai/types/function_call_chat_message_content_value.rb +56 -0
  70. data/lib/vellum_ai/types/function_call_chat_message_content_value_request.rb +56 -0
  71. data/lib/vellum_ai/types/function_call_enum.rb +5 -0
  72. data/lib/vellum_ai/types/function_call_variable_value.rb +51 -0
  73. data/lib/vellum_ai/types/generate_error_response.rb +45 -0
  74. data/lib/vellum_ai/types/generate_options_request.rb +50 -0
  75. data/lib/vellum_ai/types/generate_request.rb +60 -0
  76. data/lib/vellum_ai/types/generate_response.rb +49 -0
  77. data/lib/vellum_ai/types/generate_result.rb +62 -0
  78. data/lib/vellum_ai/types/generate_result_data.rb +49 -0
  79. data/lib/vellum_ai/types/generate_result_error.rb +45 -0
  80. data/lib/vellum_ai/types/generate_stream_response.rb +51 -0
  81. data/lib/vellum_ai/types/generate_stream_result.rb +67 -0
  82. data/lib/vellum_ai/types/generate_stream_result_data.rb +56 -0
  83. data/lib/vellum_ai/types/image_chat_message_content.rb +52 -0
  84. data/lib/vellum_ai/types/image_chat_message_content_request.rb +52 -0
  85. data/lib/vellum_ai/types/image_enum.rb +5 -0
  86. data/lib/vellum_ai/types/indexing_state_enum.rb +12 -0
  87. data/lib/vellum_ai/types/initiated_enum.rb +5 -0
  88. data/lib/vellum_ai/types/initiated_execute_prompt_event.rb +57 -0
  89. data/lib/vellum_ai/types/initiated_prompt_execution_meta.rb +68 -0
  90. data/lib/vellum_ai/types/initiated_workflow_node_result_event.rb +90 -0
  91. data/lib/vellum_ai/types/json_enum.rb +5 -0
  92. data/lib/vellum_ai/types/json_input_request.rb +51 -0
  93. data/lib/vellum_ai/types/json_variable_value.rb +45 -0
  94. data/lib/vellum_ai/types/logical_operator.rb +25 -0
  95. data/lib/vellum_ai/types/logprobs_enum.rb +6 -0
  96. data/lib/vellum_ai/types/metadata_filter_config_request.rb +85 -0
  97. data/lib/vellum_ai/types/metadata_filter_rule_combinator.rb +6 -0
  98. data/lib/vellum_ai/types/metadata_filter_rule_request.rb +84 -0
  99. data/lib/vellum_ai/types/model_version_build_config.rb +66 -0
  100. data/lib/vellum_ai/types/model_version_exec_config.rb +90 -0
  101. data/lib/vellum_ai/types/model_version_exec_config_parameters.rb +98 -0
  102. data/lib/vellum_ai/types/model_version_read.rb +133 -0
  103. data/lib/vellum_ai/types/model_version_read_status_enum.rb +11 -0
  104. data/lib/vellum_ai/types/model_version_sandbox_snapshot.rb +61 -0
  105. data/lib/vellum_ai/types/named_test_case_chat_history_variable_value_request.rb +54 -0
  106. data/lib/vellum_ai/types/named_test_case_error_variable_value_request.rb +56 -0
  107. data/lib/vellum_ai/types/named_test_case_json_variable_value_request.rb +50 -0
  108. data/lib/vellum_ai/types/named_test_case_number_variable_value_request.rb +50 -0
  109. data/lib/vellum_ai/types/named_test_case_search_results_variable_value_request.rb +54 -0
  110. data/lib/vellum_ai/types/named_test_case_string_variable_value_request.rb +50 -0
  111. data/lib/vellum_ai/types/named_test_case_variable_value_request.rb +142 -0
  112. data/lib/vellum_ai/types/node_input_compiled_chat_history_value.rb +59 -0
  113. data/lib/vellum_ai/types/node_input_compiled_error_value.rb +61 -0
  114. data/lib/vellum_ai/types/node_input_compiled_json_value.rb +55 -0
  115. data/lib/vellum_ai/types/node_input_compiled_number_value.rb +55 -0
  116. data/lib/vellum_ai/types/node_input_compiled_search_results_value.rb +59 -0
  117. data/lib/vellum_ai/types/node_input_compiled_string_value.rb +55 -0
  118. data/lib/vellum_ai/types/node_input_variable_compiled_value.rb +142 -0
  119. data/lib/vellum_ai/types/node_output_compiled_chat_history_value.rb +54 -0
  120. data/lib/vellum_ai/types/node_output_compiled_error_value.rb +56 -0
  121. data/lib/vellum_ai/types/node_output_compiled_json_value.rb +50 -0
  122. data/lib/vellum_ai/types/node_output_compiled_number_value.rb +50 -0
  123. data/lib/vellum_ai/types/node_output_compiled_search_results_value.rb +54 -0
  124. data/lib/vellum_ai/types/node_output_compiled_string_value.rb +50 -0
  125. data/lib/vellum_ai/types/node_output_compiled_value.rb +142 -0
  126. data/lib/vellum_ai/types/normalized_log_probs.rb +54 -0
  127. data/lib/vellum_ai/types/normalized_token_log_probs.rb +61 -0
  128. data/lib/vellum_ai/types/number_enum.rb +5 -0
  129. data/lib/vellum_ai/types/paginated_slim_deployment_read_list.rb +64 -0
  130. data/lib/vellum_ai/types/paginated_slim_document_list.rb +64 -0
  131. data/lib/vellum_ai/types/paginated_slim_workflow_deployment_list.rb +64 -0
  132. data/lib/vellum_ai/types/processing_failure_reason_enum.rb +9 -0
  133. data/lib/vellum_ai/types/processing_state_enum.rb +11 -0
  134. data/lib/vellum_ai/types/prompt_deployment_expand_meta_request_request.rb +74 -0
  135. data/lib/vellum_ai/types/prompt_deployment_input_request.rb +103 -0
  136. data/lib/vellum_ai/types/prompt_execution_meta.rb +76 -0
  137. data/lib/vellum_ai/types/prompt_node_result.rb +52 -0
  138. data/lib/vellum_ai/types/prompt_node_result_data.rb +55 -0
  139. data/lib/vellum_ai/types/prompt_output.rb +116 -0
  140. data/lib/vellum_ai/types/prompt_template_block.rb +62 -0
  141. data/lib/vellum_ai/types/prompt_template_block_data.rb +54 -0
  142. data/lib/vellum_ai/types/prompt_template_block_data_request.rb +54 -0
  143. data/lib/vellum_ai/types/prompt_template_block_properties.rb +104 -0
  144. data/lib/vellum_ai/types/prompt_template_block_properties_request.rb +104 -0
  145. data/lib/vellum_ai/types/prompt_template_block_request.rb +62 -0
  146. data/lib/vellum_ai/types/provider_enum.rb +20 -0
  147. data/lib/vellum_ai/types/raw_prompt_execution_overrides_request.rb +55 -0
  148. data/lib/vellum_ai/types/register_prompt_error_response.rb +45 -0
  149. data/lib/vellum_ai/types/register_prompt_model_parameters_request.rb +98 -0
  150. data/lib/vellum_ai/types/register_prompt_prompt.rb +50 -0
  151. data/lib/vellum_ai/types/register_prompt_prompt_info_request.rb +60 -0
  152. data/lib/vellum_ai/types/register_prompt_response.rb +110 -0
  153. data/lib/vellum_ai/types/registered_prompt_deployment.rb +55 -0
  154. data/lib/vellum_ai/types/registered_prompt_input_variable_request.rb +56 -0
  155. data/lib/vellum_ai/types/registered_prompt_model_version.rb +50 -0
  156. data/lib/vellum_ai/types/registered_prompt_sandbox.rb +50 -0
  157. data/lib/vellum_ai/types/registered_prompt_sandbox_snapshot.rb +45 -0
  158. data/lib/vellum_ai/types/rejected_enum.rb +5 -0
  159. data/lib/vellum_ai/types/rejected_execute_prompt_event.rb +68 -0
  160. data/lib/vellum_ai/types/rejected_execute_prompt_response.rb +73 -0
  161. data/lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb +63 -0
  162. data/lib/vellum_ai/types/rejected_function_call.rb +62 -0
  163. data/lib/vellum_ai/types/rejected_prompt_execution_meta.rb +52 -0
  164. data/lib/vellum_ai/types/rejected_workflow_node_result_event.rb +92 -0
  165. data/lib/vellum_ai/types/sandbox_scenario.rb +59 -0
  166. data/lib/vellum_ai/types/scenario_input.rb +70 -0
  167. data/lib/vellum_ai/types/scenario_input_request.rb +70 -0
  168. data/lib/vellum_ai/types/scenario_input_type_enum.rb +6 -0
  169. data/lib/vellum_ai/types/search_error_response.rb +45 -0
  170. data/lib/vellum_ai/types/search_filters_request.rb +56 -0
  171. data/lib/vellum_ai/types/search_node_result.rb +52 -0
  172. data/lib/vellum_ai/types/search_node_result_data.rb +70 -0
  173. data/lib/vellum_ai/types/search_request_options_request.rb +79 -0
  174. data/lib/vellum_ai/types/search_response.rb +49 -0
  175. data/lib/vellum_ai/types/search_result.rb +66 -0
  176. data/lib/vellum_ai/types/search_result_document.rb +60 -0
  177. data/lib/vellum_ai/types/search_result_document_request.rb +55 -0
  178. data/lib/vellum_ai/types/search_result_merging_request.rb +45 -0
  179. data/lib/vellum_ai/types/search_result_request.rb +66 -0
  180. data/lib/vellum_ai/types/search_results_enum.rb +5 -0
  181. data/lib/vellum_ai/types/search_weights_request.rb +50 -0
  182. data/lib/vellum_ai/types/slim_deployment_read.rb +109 -0
  183. data/lib/vellum_ai/types/slim_document.rb +126 -0
  184. data/lib/vellum_ai/types/slim_workflow_deployment.rb +118 -0
  185. data/lib/vellum_ai/types/streaming_enum.rb +5 -0
  186. data/lib/vellum_ai/types/streaming_execute_prompt_event.rb +85 -0
  187. data/lib/vellum_ai/types/streaming_prompt_execution_meta.rb +46 -0
  188. data/lib/vellum_ai/types/streaming_workflow_node_result_event.rb +99 -0
  189. data/lib/vellum_ai/types/string_chat_message_content.rb +46 -0
  190. data/lib/vellum_ai/types/string_chat_message_content_request.rb +46 -0
  191. data/lib/vellum_ai/types/string_enum.rb +5 -0
  192. data/lib/vellum_ai/types/string_input_request.rb +51 -0
  193. data/lib/vellum_ai/types/string_variable_value.rb +45 -0
  194. data/lib/vellum_ai/types/submit_completion_actual_request.rb +67 -0
  195. data/lib/vellum_ai/types/submit_completion_actuals_error_response.rb +45 -0
  196. data/lib/vellum_ai/types/submit_workflow_execution_actual_request.rb +103 -0
  197. data/lib/vellum_ai/types/templating_node_chat_history_result.rb +54 -0
  198. data/lib/vellum_ai/types/templating_node_error_result.rb +56 -0
  199. data/lib/vellum_ai/types/templating_node_json_result.rb +50 -0
  200. data/lib/vellum_ai/types/templating_node_number_result.rb +50 -0
  201. data/lib/vellum_ai/types/templating_node_result.rb +52 -0
  202. data/lib/vellum_ai/types/templating_node_result_data.rb +51 -0
  203. data/lib/vellum_ai/types/templating_node_result_output.rb +142 -0
  204. data/lib/vellum_ai/types/templating_node_search_results_result.rb +54 -0
  205. data/lib/vellum_ai/types/templating_node_string_result.rb +50 -0
  206. data/lib/vellum_ai/types/terminal_node_chat_history_result.rb +59 -0
  207. data/lib/vellum_ai/types/terminal_node_error_result.rb +61 -0
  208. data/lib/vellum_ai/types/terminal_node_json_result.rb +55 -0
  209. data/lib/vellum_ai/types/terminal_node_number_result.rb +55 -0
  210. data/lib/vellum_ai/types/terminal_node_result.rb +52 -0
  211. data/lib/vellum_ai/types/terminal_node_result_data.rb +51 -0
  212. data/lib/vellum_ai/types/terminal_node_result_output.rb +142 -0
  213. data/lib/vellum_ai/types/terminal_node_search_results_result.rb +59 -0
  214. data/lib/vellum_ai/types/terminal_node_string_result.rb +55 -0
  215. data/lib/vellum_ai/types/test_case_chat_history_variable_value.rb +54 -0
  216. data/lib/vellum_ai/types/test_case_error_variable_value.rb +56 -0
  217. data/lib/vellum_ai/types/test_case_json_variable_value.rb +50 -0
  218. data/lib/vellum_ai/types/test_case_number_variable_value.rb +50 -0
  219. data/lib/vellum_ai/types/test_case_search_results_variable_value.rb +54 -0
  220. data/lib/vellum_ai/types/test_case_string_variable_value.rb +50 -0
  221. data/lib/vellum_ai/types/test_case_variable_value.rb +142 -0
  222. data/lib/vellum_ai/types/test_suite_test_case.rb +68 -0
  223. data/lib/vellum_ai/types/upload_document_error_response.rb +45 -0
  224. data/lib/vellum_ai/types/upload_document_response.rb +45 -0
  225. data/lib/vellum_ai/types/vellum_error.rb +51 -0
  226. data/lib/vellum_ai/types/vellum_error_code_enum.rb +10 -0
  227. data/lib/vellum_ai/types/vellum_error_request.rb +51 -0
  228. data/lib/vellum_ai/types/vellum_image.rb +50 -0
  229. data/lib/vellum_ai/types/vellum_image_request.rb +50 -0
  230. data/lib/vellum_ai/types/vellum_variable.rb +56 -0
  231. data/lib/vellum_ai/types/vellum_variable_type.rb +16 -0
  232. data/lib/vellum_ai/types/workflow_event_error.rb +51 -0
  233. data/lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb +77 -0
  234. data/lib/vellum_ai/types/workflow_execution_actual_json_request.rb +73 -0
  235. data/lib/vellum_ai/types/workflow_execution_actual_string_request.rb +73 -0
  236. data/lib/vellum_ai/types/workflow_execution_event_error_code.rb +13 -0
  237. data/lib/vellum_ai/types/workflow_execution_event_type.rb +6 -0
  238. data/lib/vellum_ai/types/workflow_execution_node_result_event.rb +68 -0
  239. data/lib/vellum_ai/types/workflow_execution_workflow_result_event.rb +68 -0
  240. data/lib/vellum_ai/types/workflow_node_result_data.rb +155 -0
  241. data/lib/vellum_ai/types/workflow_node_result_event.rb +116 -0
  242. data/lib/vellum_ai/types/workflow_node_result_event_state.rb +11 -0
  243. data/lib/vellum_ai/types/workflow_output.rb +168 -0
  244. data/lib/vellum_ai/types/workflow_output_chat_history.rb +60 -0
  245. data/lib/vellum_ai/types/workflow_output_error.rb +62 -0
  246. data/lib/vellum_ai/types/workflow_output_function_call.rb +62 -0
  247. data/lib/vellum_ai/types/workflow_output_image.rb +62 -0
  248. data/lib/vellum_ai/types/workflow_output_json.rb +56 -0
  249. data/lib/vellum_ai/types/workflow_output_number.rb +56 -0
  250. data/lib/vellum_ai/types/workflow_output_search_results.rb +60 -0
  251. data/lib/vellum_ai/types/workflow_output_string.rb +56 -0
  252. data/lib/vellum_ai/types/workflow_request_chat_history_input_request.rb +54 -0
  253. data/lib/vellum_ai/types/workflow_request_input_request.rb +116 -0
  254. data/lib/vellum_ai/types/workflow_request_json_input_request.rb +50 -0
  255. data/lib/vellum_ai/types/workflow_request_number_input_request.rb +50 -0
  256. data/lib/vellum_ai/types/workflow_request_string_input_request.rb +50 -0
  257. data/lib/vellum_ai/types/workflow_result_event.rb +95 -0
  258. data/lib/vellum_ai/types/workflow_result_event_output_data.rb +142 -0
  259. data/lib/vellum_ai/types/workflow_result_event_output_data_chat_history.rb +83 -0
  260. data/lib/vellum_ai/types/workflow_result_event_output_data_error.rb +85 -0
  261. data/lib/vellum_ai/types/workflow_result_event_output_data_json.rb +79 -0
  262. data/lib/vellum_ai/types/workflow_result_event_output_data_number.rb +79 -0
  263. data/lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb +83 -0
  264. data/lib/vellum_ai/types/workflow_result_event_output_data_string.rb +79 -0
  265. data/lib/vellum_ai/types/workflow_stream_event.rb +90 -0
  266. data/lib/vellum_ai/workflow_deployments/client.rb +82 -0
  267. data/lib/vellum_ai/workflow_deployments/types/workflow_deployments_list_request_status.rb +8 -0
  268. data/lib/vellum_ai.rb +476 -0
  269. metadata +381 -0
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module Vellum
6
+ class VellumImage
7
+ attr_reader :src, :metadata, :additional_properties
8
+
9
+ # @param src [String]
10
+ # @param metadata [Hash{String => String}]
11
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
12
+ # @return [VellumImage]
13
+ def initialize(src:, metadata: nil, additional_properties: nil)
14
+ # @type [String]
15
+ @src = src
16
+ # @type [Hash{String => String}]
17
+ @metadata = metadata
18
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
19
+ @additional_properties = additional_properties
20
+ end
21
+
22
+ # Deserialize a JSON object to an instance of VellumImage
23
+ #
24
+ # @param json_object [JSON]
25
+ # @return [VellumImage]
26
+ def self.from_json(json_object:)
27
+ struct = JSON.parse(json_object, object_class: OpenStruct)
28
+ JSON.parse(json_object)
29
+ src = struct.src
30
+ metadata = struct.metadata
31
+ new(src: src, metadata: metadata, additional_properties: struct)
32
+ end
33
+
34
+ # Serialize an instance of VellumImage to a JSON object
35
+ #
36
+ # @return [JSON]
37
+ def to_json(*_args)
38
+ { "src": @src, "metadata": @metadata }.to_json
39
+ end
40
+
41
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
42
+ #
43
+ # @param obj [Object]
44
+ # @return [Void]
45
+ def self.validate_raw(obj:)
46
+ obj.src.is_a?(String) != false || raise("Passed value for field obj.src is not the expected type, validation failed.")
47
+ obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module Vellum
6
+ class VellumImageRequest
7
+ attr_reader :src, :metadata, :additional_properties
8
+
9
+ # @param src [String]
10
+ # @param metadata [Hash{String => String}]
11
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
12
+ # @return [VellumImageRequest]
13
+ def initialize(src:, metadata: nil, additional_properties: nil)
14
+ # @type [String]
15
+ @src = src
16
+ # @type [Hash{String => String}]
17
+ @metadata = metadata
18
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
19
+ @additional_properties = additional_properties
20
+ end
21
+
22
+ # Deserialize a JSON object to an instance of VellumImageRequest
23
+ #
24
+ # @param json_object [JSON]
25
+ # @return [VellumImageRequest]
26
+ def self.from_json(json_object:)
27
+ struct = JSON.parse(json_object, object_class: OpenStruct)
28
+ JSON.parse(json_object)
29
+ src = struct.src
30
+ metadata = struct.metadata
31
+ new(src: src, metadata: metadata, additional_properties: struct)
32
+ end
33
+
34
+ # Serialize an instance of VellumImageRequest to a JSON object
35
+ #
36
+ # @return [JSON]
37
+ def to_json(*_args)
38
+ { "src": @src, "metadata": @metadata }.to_json
39
+ end
40
+
41
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
42
+ #
43
+ # @param obj [Object]
44
+ # @return [Void]
45
+ def self.validate_raw(obj:)
46
+ obj.src.is_a?(String) != false || raise("Passed value for field obj.src is not the expected type, validation failed.")
47
+ obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "vellum_variable_type"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class VellumVariable
8
+ attr_reader :id, :key, :type, :additional_properties
9
+
10
+ # @param id [String]
11
+ # @param key [String]
12
+ # @param type [VELLUM_VARIABLE_TYPE]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [VellumVariable]
15
+ def initialize(id:, key:, type:, additional_properties: nil)
16
+ # @type [String]
17
+ @id = id
18
+ # @type [String]
19
+ @key = key
20
+ # @type [VELLUM_VARIABLE_TYPE]
21
+ @type = type
22
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
23
+ @additional_properties = additional_properties
24
+ end
25
+
26
+ # Deserialize a JSON object to an instance of VellumVariable
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [VellumVariable]
30
+ def self.from_json(json_object:)
31
+ struct = JSON.parse(json_object, object_class: OpenStruct)
32
+ parsed_json = JSON.parse(json_object)
33
+ id = struct.id
34
+ key = struct.key
35
+ type = VELLUM_VARIABLE_TYPE.key(parsed_json["type"]) || parsed_json["type"]
36
+ new(id: id, key: key, type: type, additional_properties: struct)
37
+ end
38
+
39
+ # Serialize an instance of VellumVariable to a JSON object
40
+ #
41
+ # @return [JSON]
42
+ def to_json(*_args)
43
+ { "id": @id, "key": @key, "type": VELLUM_VARIABLE_TYPE[@type] || @type }.to_json
44
+ end
45
+
46
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
47
+ #
48
+ # @param obj [Object]
49
+ # @return [Void]
50
+ def self.validate_raw(obj:)
51
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
52
+ obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
53
+ obj.type.is_a?(VELLUM_VARIABLE_TYPE) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vellum
4
+ # @type [VELLUM_VARIABLE_TYPE]
5
+ VELLUM_VARIABLE_TYPE = {
6
+ string: "STRING",
7
+ number: "NUMBER",
8
+ json: "JSON",
9
+ chat_history: "CHAT_HISTORY",
10
+ search_results: "SEARCH_RESULTS",
11
+ error: "ERROR",
12
+ array: "ARRAY",
13
+ function_call: "FUNCTION_CALL",
14
+ image: "IMAGE"
15
+ }.freeze
16
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "workflow_execution_event_error_code"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class WorkflowEventError
8
+ attr_reader :message, :code, :additional_properties
9
+
10
+ # @param message [String]
11
+ # @param code [WORKFLOW_EXECUTION_EVENT_ERROR_CODE]
12
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
13
+ # @return [WorkflowEventError]
14
+ def initialize(message:, code:, additional_properties: nil)
15
+ # @type [String]
16
+ @message = message
17
+ # @type [WORKFLOW_EXECUTION_EVENT_ERROR_CODE]
18
+ @code = code
19
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
20
+ @additional_properties = additional_properties
21
+ end
22
+
23
+ # Deserialize a JSON object to an instance of WorkflowEventError
24
+ #
25
+ # @param json_object [JSON]
26
+ # @return [WorkflowEventError]
27
+ def self.from_json(json_object:)
28
+ struct = JSON.parse(json_object, object_class: OpenStruct)
29
+ parsed_json = JSON.parse(json_object)
30
+ message = struct.message
31
+ code = WORKFLOW_EXECUTION_EVENT_ERROR_CODE.key(parsed_json["code"]) || parsed_json["code"]
32
+ new(message: message, code: code, additional_properties: struct)
33
+ end
34
+
35
+ # Serialize an instance of WorkflowEventError to a JSON object
36
+ #
37
+ # @return [JSON]
38
+ def to_json(*_args)
39
+ { "message": @message, "code": WORKFLOW_EXECUTION_EVENT_ERROR_CODE[@code] || @code }.to_json
40
+ end
41
+
42
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
43
+ #
44
+ # @param obj [Object]
45
+ # @return [Void]
46
+ def self.validate_raw(obj:)
47
+ obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
48
+ obj.code.is_a?(WORKFLOW_EXECUTION_EVENT_ERROR_CODE) != false || raise("Passed value for field obj.code is not the expected type, validation failed.")
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "chat_message_request"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class WorkflowExecutionActualChatHistoryRequest
8
+ attr_reader :output_id, :output_key, :quality, :timestamp, :desired_output_value, :additional_properties
9
+
10
+ # @param output_id [String] The Vellum-generated ID of a workflow output. Must provide either this or output_key. output_key is typically preferred.
11
+ # @param output_key [String] The user-defined name of a workflow output. Must provide either this or output_id. Should correspond to the `Name` specified in a Final Output Node. Generally preferred over output_id.
12
+ # @param quality [Float] Optionally provide a decimal number between 0.0 and 1.0 (inclusive) representing the quality of the output. 0 is the worst, 1 is the best.
13
+ # @param timestamp [Float] Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.
14
+ # @param desired_output_value [Array<ChatMessageRequest>] Optionally provide the value that the output ideally should have been.
15
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
16
+ # @return [WorkflowExecutionActualChatHistoryRequest]
17
+ def initialize(output_id: nil, output_key: nil, quality: nil, timestamp: nil, desired_output_value: nil,
18
+ additional_properties: nil)
19
+ # @type [String] The Vellum-generated ID of a workflow output. Must provide either this or output_key. output_key is typically preferred.
20
+ @output_id = output_id
21
+ # @type [String] The user-defined name of a workflow output. Must provide either this or output_id. Should correspond to the `Name` specified in a Final Output Node. Generally preferred over output_id.
22
+ @output_key = output_key
23
+ # @type [Float] Optionally provide a decimal number between 0.0 and 1.0 (inclusive) representing the quality of the output. 0 is the worst, 1 is the best.
24
+ @quality = quality
25
+ # @type [Float] Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.
26
+ @timestamp = timestamp
27
+ # @type [Array<ChatMessageRequest>] Optionally provide the value that the output ideally should have been.
28
+ @desired_output_value = desired_output_value
29
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
30
+ @additional_properties = additional_properties
31
+ end
32
+
33
+ # Deserialize a JSON object to an instance of WorkflowExecutionActualChatHistoryRequest
34
+ #
35
+ # @param json_object [JSON]
36
+ # @return [WorkflowExecutionActualChatHistoryRequest]
37
+ def self.from_json(json_object:)
38
+ struct = JSON.parse(json_object, object_class: OpenStruct)
39
+ parsed_json = JSON.parse(json_object)
40
+ output_id = struct.output_id
41
+ output_key = struct.output_key
42
+ quality = struct.quality
43
+ timestamp = struct.timestamp
44
+ desired_output_value = parsed_json["desired_output_value"].map do |v|
45
+ v = v.to_json
46
+ ChatMessageRequest.from_json(json_object: v)
47
+ end
48
+ new(output_id: output_id, output_key: output_key, quality: quality, timestamp: timestamp,
49
+ desired_output_value: desired_output_value, additional_properties: struct)
50
+ end
51
+
52
+ # Serialize an instance of WorkflowExecutionActualChatHistoryRequest to a JSON object
53
+ #
54
+ # @return [JSON]
55
+ def to_json(*_args)
56
+ {
57
+ "output_id": @output_id,
58
+ "output_key": @output_key,
59
+ "quality": @quality,
60
+ "timestamp": @timestamp,
61
+ "desired_output_value": @desired_output_value
62
+ }.to_json
63
+ end
64
+
65
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.output_id&.is_a?(String) != false || raise("Passed value for field obj.output_id is not the expected type, validation failed.")
71
+ obj.output_key&.is_a?(String) != false || raise("Passed value for field obj.output_key is not the expected type, validation failed.")
72
+ obj.quality&.is_a?(Float) != false || raise("Passed value for field obj.quality is not the expected type, validation failed.")
73
+ obj.timestamp&.is_a?(Float) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
74
+ obj.desired_output_value&.is_a?(Array) != false || raise("Passed value for field obj.desired_output_value is not the expected type, validation failed.")
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module Vellum
6
+ class WorkflowExecutionActualJsonRequest
7
+ attr_reader :output_id, :output_key, :quality, :timestamp, :desired_output_value, :additional_properties
8
+
9
+ # @param output_id [String] The Vellum-generated ID of a workflow output. Must provide either this or output_key. output_key is typically preferred.
10
+ # @param output_key [String] The user-defined name of a workflow output. Must provide either this or output_id. Should correspond to the `Name` specified in a Final Output Node. Generally preferred over output_id.
11
+ # @param quality [Float] Optionally provide a decimal number between 0.0 and 1.0 (inclusive) representing the quality of the output. 0 is the worst, 1 is the best.
12
+ # @param timestamp [Float] Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.
13
+ # @param desired_output_value [Hash{String => String}] Optionally provide the value that the output ideally should have been.
14
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
15
+ # @return [WorkflowExecutionActualJsonRequest]
16
+ def initialize(output_id: nil, output_key: nil, quality: nil, timestamp: nil, desired_output_value: nil,
17
+ additional_properties: nil)
18
+ # @type [String] The Vellum-generated ID of a workflow output. Must provide either this or output_key. output_key is typically preferred.
19
+ @output_id = output_id
20
+ # @type [String] The user-defined name of a workflow output. Must provide either this or output_id. Should correspond to the `Name` specified in a Final Output Node. Generally preferred over output_id.
21
+ @output_key = output_key
22
+ # @type [Float] Optionally provide a decimal number between 0.0 and 1.0 (inclusive) representing the quality of the output. 0 is the worst, 1 is the best.
23
+ @quality = quality
24
+ # @type [Float] Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.
25
+ @timestamp = timestamp
26
+ # @type [Hash{String => String}] Optionally provide the value that the output ideally should have been.
27
+ @desired_output_value = desired_output_value
28
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
29
+ @additional_properties = additional_properties
30
+ end
31
+
32
+ # Deserialize a JSON object to an instance of WorkflowExecutionActualJsonRequest
33
+ #
34
+ # @param json_object [JSON]
35
+ # @return [WorkflowExecutionActualJsonRequest]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ JSON.parse(json_object)
39
+ output_id = struct.output_id
40
+ output_key = struct.output_key
41
+ quality = struct.quality
42
+ timestamp = struct.timestamp
43
+ desired_output_value = struct.desired_output_value
44
+ new(output_id: output_id, output_key: output_key, quality: quality, timestamp: timestamp,
45
+ desired_output_value: desired_output_value, additional_properties: struct)
46
+ end
47
+
48
+ # Serialize an instance of WorkflowExecutionActualJsonRequest to a JSON object
49
+ #
50
+ # @return [JSON]
51
+ def to_json(*_args)
52
+ {
53
+ "output_id": @output_id,
54
+ "output_key": @output_key,
55
+ "quality": @quality,
56
+ "timestamp": @timestamp,
57
+ "desired_output_value": @desired_output_value
58
+ }.to_json
59
+ end
60
+
61
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
62
+ #
63
+ # @param obj [Object]
64
+ # @return [Void]
65
+ def self.validate_raw(obj:)
66
+ obj.output_id&.is_a?(String) != false || raise("Passed value for field obj.output_id is not the expected type, validation failed.")
67
+ obj.output_key&.is_a?(String) != false || raise("Passed value for field obj.output_key is not the expected type, validation failed.")
68
+ obj.quality&.is_a?(Float) != false || raise("Passed value for field obj.quality is not the expected type, validation failed.")
69
+ obj.timestamp&.is_a?(Float) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
70
+ obj.desired_output_value&.is_a?(Hash) != false || raise("Passed value for field obj.desired_output_value is not the expected type, validation failed.")
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module Vellum
6
+ class WorkflowExecutionActualStringRequest
7
+ attr_reader :output_id, :output_key, :quality, :timestamp, :desired_output_value, :additional_properties
8
+
9
+ # @param output_id [String] The Vellum-generated ID of a workflow output. Must provide either this or output_key. output_key is typically preferred.
10
+ # @param output_key [String] The user-defined name of a workflow output. Must provide either this or output_id. Should correspond to the `Name` specified in a Final Output Node. Generally preferred over output_id.
11
+ # @param quality [Float] Optionally provide a decimal number between 0.0 and 1.0 (inclusive) representing the quality of the output. 0 is the worst, 1 is the best.
12
+ # @param timestamp [Float] Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.
13
+ # @param desired_output_value [String] Optionally provide the value that the output ideally should have been.
14
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
15
+ # @return [WorkflowExecutionActualStringRequest]
16
+ def initialize(output_id: nil, output_key: nil, quality: nil, timestamp: nil, desired_output_value: nil,
17
+ additional_properties: nil)
18
+ # @type [String] The Vellum-generated ID of a workflow output. Must provide either this or output_key. output_key is typically preferred.
19
+ @output_id = output_id
20
+ # @type [String] The user-defined name of a workflow output. Must provide either this or output_id. Should correspond to the `Name` specified in a Final Output Node. Generally preferred over output_id.
21
+ @output_key = output_key
22
+ # @type [Float] Optionally provide a decimal number between 0.0 and 1.0 (inclusive) representing the quality of the output. 0 is the worst, 1 is the best.
23
+ @quality = quality
24
+ # @type [Float] Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.
25
+ @timestamp = timestamp
26
+ # @type [String] Optionally provide the value that the output ideally should have been.
27
+ @desired_output_value = desired_output_value
28
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
29
+ @additional_properties = additional_properties
30
+ end
31
+
32
+ # Deserialize a JSON object to an instance of WorkflowExecutionActualStringRequest
33
+ #
34
+ # @param json_object [JSON]
35
+ # @return [WorkflowExecutionActualStringRequest]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ JSON.parse(json_object)
39
+ output_id = struct.output_id
40
+ output_key = struct.output_key
41
+ quality = struct.quality
42
+ timestamp = struct.timestamp
43
+ desired_output_value = struct.desired_output_value
44
+ new(output_id: output_id, output_key: output_key, quality: quality, timestamp: timestamp,
45
+ desired_output_value: desired_output_value, additional_properties: struct)
46
+ end
47
+
48
+ # Serialize an instance of WorkflowExecutionActualStringRequest to a JSON object
49
+ #
50
+ # @return [JSON]
51
+ def to_json(*_args)
52
+ {
53
+ "output_id": @output_id,
54
+ "output_key": @output_key,
55
+ "quality": @quality,
56
+ "timestamp": @timestamp,
57
+ "desired_output_value": @desired_output_value
58
+ }.to_json
59
+ end
60
+
61
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
62
+ #
63
+ # @param obj [Object]
64
+ # @return [Void]
65
+ def self.validate_raw(obj:)
66
+ obj.output_id&.is_a?(String) != false || raise("Passed value for field obj.output_id is not the expected type, validation failed.")
67
+ obj.output_key&.is_a?(String) != false || raise("Passed value for field obj.output_key is not the expected type, validation failed.")
68
+ obj.quality&.is_a?(Float) != false || raise("Passed value for field obj.quality is not the expected type, validation failed.")
69
+ obj.timestamp&.is_a?(Float) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
70
+ obj.desired_output_value&.is_a?(String) != false || raise("Passed value for field obj.desired_output_value is not the expected type, validation failed.")
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vellum
4
+ # @type [WORKFLOW_EXECUTION_EVENT_ERROR_CODE]
5
+ WORKFLOW_EXECUTION_EVENT_ERROR_CODE = {
6
+ workflow_initialization: "WORKFLOW_INITIALIZATION",
7
+ node_execution_count_limit_reached: "NODE_EXECUTION_COUNT_LIMIT_REACHED",
8
+ internal_server_error: "INTERNAL_SERVER_ERROR",
9
+ node_execution: "NODE_EXECUTION",
10
+ llm_provider: "LLM_PROVIDER",
11
+ invalid_template: "INVALID_TEMPLATE"
12
+ }.freeze
13
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vellum
4
+ # @type [WORKFLOW_EXECUTION_EVENT_TYPE]
5
+ WORKFLOW_EXECUTION_EVENT_TYPE = { node: "NODE", workflow: "WORKFLOW" }.freeze
6
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "workflow_node_result_event"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A NODE-level event emitted from the workflow's execution.
8
+ class WorkflowExecutionNodeResultEvent
9
+ attr_reader :execution_id, :run_id, :external_id, :data, :additional_properties
10
+
11
+ # @param execution_id [String]
12
+ # @param run_id [String]
13
+ # @param external_id [String]
14
+ # @param data [WorkflowNodeResultEvent]
15
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
16
+ # @return [WorkflowExecutionNodeResultEvent]
17
+ def initialize(execution_id:, data:, run_id: nil, external_id: nil, additional_properties: nil)
18
+ # @type [String]
19
+ @execution_id = execution_id
20
+ # @type [String]
21
+ @run_id = run_id
22
+ # @type [String]
23
+ @external_id = external_id
24
+ # @type [WorkflowNodeResultEvent]
25
+ @data = data
26
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
27
+ @additional_properties = additional_properties
28
+ end
29
+
30
+ # Deserialize a JSON object to an instance of WorkflowExecutionNodeResultEvent
31
+ #
32
+ # @param json_object [JSON]
33
+ # @return [WorkflowExecutionNodeResultEvent]
34
+ def self.from_json(json_object:)
35
+ struct = JSON.parse(json_object, object_class: OpenStruct)
36
+ parsed_json = JSON.parse(json_object)
37
+ execution_id = struct.execution_id
38
+ run_id = struct.run_id
39
+ external_id = struct.external_id
40
+ if parsed_json["data"].nil?
41
+ data = nil
42
+ else
43
+ data = parsed_json["data"].to_json
44
+ data = WorkflowNodeResultEvent.from_json(json_object: data)
45
+ end
46
+ new(execution_id: execution_id, run_id: run_id, external_id: external_id, data: data,
47
+ additional_properties: struct)
48
+ end
49
+
50
+ # Serialize an instance of WorkflowExecutionNodeResultEvent to a JSON object
51
+ #
52
+ # @return [JSON]
53
+ def to_json(*_args)
54
+ { "execution_id": @execution_id, "run_id": @run_id, "external_id": @external_id, "data": @data }.to_json
55
+ end
56
+
57
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
58
+ #
59
+ # @param obj [Object]
60
+ # @return [Void]
61
+ def self.validate_raw(obj:)
62
+ obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
63
+ obj.run_id&.is_a?(String) != false || raise("Passed value for field obj.run_id is not the expected type, validation failed.")
64
+ obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
65
+ WorkflowNodeResultEvent.validate_raw(obj: obj.data)
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "workflow_result_event"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A WORKFLOW-level event emitted from the workflow's execution.
8
+ class WorkflowExecutionWorkflowResultEvent
9
+ attr_reader :execution_id, :run_id, :external_id, :data, :additional_properties
10
+
11
+ # @param execution_id [String]
12
+ # @param run_id [String]
13
+ # @param external_id [String]
14
+ # @param data [WorkflowResultEvent]
15
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
16
+ # @return [WorkflowExecutionWorkflowResultEvent]
17
+ def initialize(execution_id:, data:, run_id: nil, external_id: nil, additional_properties: nil)
18
+ # @type [String]
19
+ @execution_id = execution_id
20
+ # @type [String]
21
+ @run_id = run_id
22
+ # @type [String]
23
+ @external_id = external_id
24
+ # @type [WorkflowResultEvent]
25
+ @data = data
26
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
27
+ @additional_properties = additional_properties
28
+ end
29
+
30
+ # Deserialize a JSON object to an instance of WorkflowExecutionWorkflowResultEvent
31
+ #
32
+ # @param json_object [JSON]
33
+ # @return [WorkflowExecutionWorkflowResultEvent]
34
+ def self.from_json(json_object:)
35
+ struct = JSON.parse(json_object, object_class: OpenStruct)
36
+ parsed_json = JSON.parse(json_object)
37
+ execution_id = struct.execution_id
38
+ run_id = struct.run_id
39
+ external_id = struct.external_id
40
+ if parsed_json["data"].nil?
41
+ data = nil
42
+ else
43
+ data = parsed_json["data"].to_json
44
+ data = WorkflowResultEvent.from_json(json_object: data)
45
+ end
46
+ new(execution_id: execution_id, run_id: run_id, external_id: external_id, data: data,
47
+ additional_properties: struct)
48
+ end
49
+
50
+ # Serialize an instance of WorkflowExecutionWorkflowResultEvent to a JSON object
51
+ #
52
+ # @return [JSON]
53
+ def to_json(*_args)
54
+ { "execution_id": @execution_id, "run_id": @run_id, "external_id": @external_id, "data": @data }.to_json
55
+ end
56
+
57
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
58
+ #
59
+ # @param obj [Object]
60
+ # @return [Void]
61
+ def self.validate_raw(obj:)
62
+ obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
63
+ obj.run_id&.is_a?(String) != false || raise("Passed value for field obj.run_id is not the expected type, validation failed.")
64
+ obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
65
+ WorkflowResultEvent.validate_raw(obj: obj.data)
66
+ end
67
+ end
68
+ end