vellum_ai 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/core/file_utilities.rb +26 -0
- data/lib/environment.rb +11 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/requests.rb +88 -0
- data/lib/types_export.rb +255 -0
- data/lib/vellum_ai/deployments/client.rb +157 -0
- data/lib/vellum_ai/deployments/types/deployments_list_request_status.rb +8 -0
- data/lib/vellum_ai/document_indexes/client.rb +135 -0
- data/lib/vellum_ai/documents/client.rb +245 -0
- data/lib/vellum_ai/model_versions/client.rb +61 -0
- data/lib/vellum_ai/registered_prompts/client.rb +154 -0
- data/lib/vellum_ai/sandboxes/client.rb +132 -0
- data/lib/vellum_ai/test_suites/client.rb +130 -0
- data/lib/vellum_ai/types/api_node_result.rb +52 -0
- data/lib/vellum_ai/types/api_node_result_data.rb +80 -0
- data/lib/vellum_ai/types/array_chat_message_content.rb +50 -0
- data/lib/vellum_ai/types/array_chat_message_content_item.rb +103 -0
- data/lib/vellum_ai/types/array_chat_message_content_item_request.rb +103 -0
- data/lib/vellum_ai/types/array_chat_message_content_request.rb +50 -0
- data/lib/vellum_ai/types/block_type_enum.rb +11 -0
- data/lib/vellum_ai/types/chat_history_enum.rb +5 -0
- data/lib/vellum_ai/types/chat_history_input_request.rb +55 -0
- data/lib/vellum_ai/types/chat_message.rb +62 -0
- data/lib/vellum_ai/types/chat_message_content.rb +116 -0
- data/lib/vellum_ai/types/chat_message_content_request.rb +116 -0
- data/lib/vellum_ai/types/chat_message_request.rb +62 -0
- data/lib/vellum_ai/types/chat_message_role.rb +6 -0
- data/lib/vellum_ai/types/code_execution_node_chat_history_result.rb +54 -0
- data/lib/vellum_ai/types/code_execution_node_error_result.rb +56 -0
- data/lib/vellum_ai/types/code_execution_node_json_result.rb +50 -0
- data/lib/vellum_ai/types/code_execution_node_number_result.rb +50 -0
- data/lib/vellum_ai/types/code_execution_node_result.rb +52 -0
- data/lib/vellum_ai/types/code_execution_node_result_data.rb +51 -0
- data/lib/vellum_ai/types/code_execution_node_result_output.rb +142 -0
- data/lib/vellum_ai/types/code_execution_node_search_results_result.rb +54 -0
- data/lib/vellum_ai/types/code_execution_node_string_result.rb +50 -0
- data/lib/vellum_ai/types/conditional_node_result.rb +52 -0
- data/lib/vellum_ai/types/conditional_node_result_data.rb +45 -0
- data/lib/vellum_ai/types/deployment_provider_payload_response.rb +45 -0
- data/lib/vellum_ai/types/deployment_read.rb +115 -0
- data/lib/vellum_ai/types/document_document_to_document_index.rb +70 -0
- data/lib/vellum_ai/types/document_index_read.rb +98 -0
- data/lib/vellum_ai/types/document_read.rb +121 -0
- data/lib/vellum_ai/types/document_status.rb +5 -0
- data/lib/vellum_ai/types/enriched_normalized_completion.rb +118 -0
- data/lib/vellum_ai/types/entity_status.rb +6 -0
- data/lib/vellum_ai/types/environment_enum.rb +6 -0
- data/lib/vellum_ai/types/error_enum.rb +5 -0
- data/lib/vellum_ai/types/error_variable_value.rb +51 -0
- data/lib/vellum_ai/types/execute_prompt_api_error_response.rb +45 -0
- data/lib/vellum_ai/types/execute_prompt_event.rb +116 -0
- data/lib/vellum_ai/types/execute_prompt_response.rb +90 -0
- data/lib/vellum_ai/types/execute_workflow_error_response.rb +45 -0
- data/lib/vellum_ai/types/execute_workflow_response.rb +67 -0
- data/lib/vellum_ai/types/execute_workflow_stream_error_response.rb +45 -0
- data/lib/vellum_ai/types/execute_workflow_workflow_result_event.rb +90 -0
- data/lib/vellum_ai/types/finish_reason_enum.rb +6 -0
- data/lib/vellum_ai/types/fulfilled_enum.rb +5 -0
- data/lib/vellum_ai/types/fulfilled_execute_prompt_event.rb +66 -0
- data/lib/vellum_ai/types/fulfilled_execute_prompt_response.rb +71 -0
- data/lib/vellum_ai/types/fulfilled_execute_workflow_workflow_result_event.rb +61 -0
- data/lib/vellum_ai/types/fulfilled_function_call.rb +56 -0
- data/lib/vellum_ai/types/fulfilled_prompt_execution_meta.rb +52 -0
- data/lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb +90 -0
- data/lib/vellum_ai/types/function_call.rb +90 -0
- data/lib/vellum_ai/types/function_call_chat_message_content.rb +52 -0
- data/lib/vellum_ai/types/function_call_chat_message_content_request.rb +52 -0
- data/lib/vellum_ai/types/function_call_chat_message_content_value.rb +56 -0
- data/lib/vellum_ai/types/function_call_chat_message_content_value_request.rb +56 -0
- data/lib/vellum_ai/types/function_call_enum.rb +5 -0
- data/lib/vellum_ai/types/function_call_variable_value.rb +51 -0
- data/lib/vellum_ai/types/generate_error_response.rb +45 -0
- data/lib/vellum_ai/types/generate_options_request.rb +50 -0
- data/lib/vellum_ai/types/generate_request.rb +60 -0
- data/lib/vellum_ai/types/generate_response.rb +49 -0
- data/lib/vellum_ai/types/generate_result.rb +62 -0
- data/lib/vellum_ai/types/generate_result_data.rb +49 -0
- data/lib/vellum_ai/types/generate_result_error.rb +45 -0
- data/lib/vellum_ai/types/generate_stream_response.rb +51 -0
- data/lib/vellum_ai/types/generate_stream_result.rb +67 -0
- data/lib/vellum_ai/types/generate_stream_result_data.rb +56 -0
- data/lib/vellum_ai/types/image_chat_message_content.rb +52 -0
- data/lib/vellum_ai/types/image_chat_message_content_request.rb +52 -0
- data/lib/vellum_ai/types/image_enum.rb +5 -0
- data/lib/vellum_ai/types/indexing_state_enum.rb +12 -0
- data/lib/vellum_ai/types/initiated_enum.rb +5 -0
- data/lib/vellum_ai/types/initiated_execute_prompt_event.rb +57 -0
- data/lib/vellum_ai/types/initiated_prompt_execution_meta.rb +68 -0
- data/lib/vellum_ai/types/initiated_workflow_node_result_event.rb +90 -0
- data/lib/vellum_ai/types/json_enum.rb +5 -0
- data/lib/vellum_ai/types/json_input_request.rb +51 -0
- data/lib/vellum_ai/types/json_variable_value.rb +45 -0
- data/lib/vellum_ai/types/logical_operator.rb +25 -0
- data/lib/vellum_ai/types/logprobs_enum.rb +6 -0
- data/lib/vellum_ai/types/metadata_filter_config_request.rb +85 -0
- data/lib/vellum_ai/types/metadata_filter_rule_combinator.rb +6 -0
- data/lib/vellum_ai/types/metadata_filter_rule_request.rb +84 -0
- data/lib/vellum_ai/types/model_version_build_config.rb +66 -0
- data/lib/vellum_ai/types/model_version_exec_config.rb +90 -0
- data/lib/vellum_ai/types/model_version_exec_config_parameters.rb +98 -0
- data/lib/vellum_ai/types/model_version_read.rb +133 -0
- data/lib/vellum_ai/types/model_version_read_status_enum.rb +11 -0
- data/lib/vellum_ai/types/model_version_sandbox_snapshot.rb +61 -0
- data/lib/vellum_ai/types/named_test_case_chat_history_variable_value_request.rb +54 -0
- data/lib/vellum_ai/types/named_test_case_error_variable_value_request.rb +56 -0
- data/lib/vellum_ai/types/named_test_case_json_variable_value_request.rb +50 -0
- data/lib/vellum_ai/types/named_test_case_number_variable_value_request.rb +50 -0
- data/lib/vellum_ai/types/named_test_case_search_results_variable_value_request.rb +54 -0
- data/lib/vellum_ai/types/named_test_case_string_variable_value_request.rb +50 -0
- data/lib/vellum_ai/types/named_test_case_variable_value_request.rb +142 -0
- data/lib/vellum_ai/types/node_input_compiled_chat_history_value.rb +59 -0
- data/lib/vellum_ai/types/node_input_compiled_error_value.rb +61 -0
- data/lib/vellum_ai/types/node_input_compiled_json_value.rb +55 -0
- data/lib/vellum_ai/types/node_input_compiled_number_value.rb +55 -0
- data/lib/vellum_ai/types/node_input_compiled_search_results_value.rb +59 -0
- data/lib/vellum_ai/types/node_input_compiled_string_value.rb +55 -0
- data/lib/vellum_ai/types/node_input_variable_compiled_value.rb +142 -0
- data/lib/vellum_ai/types/node_output_compiled_chat_history_value.rb +54 -0
- data/lib/vellum_ai/types/node_output_compiled_error_value.rb +56 -0
- data/lib/vellum_ai/types/node_output_compiled_json_value.rb +50 -0
- data/lib/vellum_ai/types/node_output_compiled_number_value.rb +50 -0
- data/lib/vellum_ai/types/node_output_compiled_search_results_value.rb +54 -0
- data/lib/vellum_ai/types/node_output_compiled_string_value.rb +50 -0
- data/lib/vellum_ai/types/node_output_compiled_value.rb +142 -0
- data/lib/vellum_ai/types/normalized_log_probs.rb +54 -0
- data/lib/vellum_ai/types/normalized_token_log_probs.rb +61 -0
- data/lib/vellum_ai/types/number_enum.rb +5 -0
- data/lib/vellum_ai/types/paginated_slim_deployment_read_list.rb +64 -0
- data/lib/vellum_ai/types/paginated_slim_document_list.rb +64 -0
- data/lib/vellum_ai/types/paginated_slim_workflow_deployment_list.rb +64 -0
- data/lib/vellum_ai/types/processing_failure_reason_enum.rb +9 -0
- data/lib/vellum_ai/types/processing_state_enum.rb +11 -0
- data/lib/vellum_ai/types/prompt_deployment_expand_meta_request_request.rb +74 -0
- data/lib/vellum_ai/types/prompt_deployment_input_request.rb +103 -0
- data/lib/vellum_ai/types/prompt_execution_meta.rb +76 -0
- data/lib/vellum_ai/types/prompt_node_result.rb +52 -0
- data/lib/vellum_ai/types/prompt_node_result_data.rb +55 -0
- data/lib/vellum_ai/types/prompt_output.rb +116 -0
- data/lib/vellum_ai/types/prompt_template_block.rb +62 -0
- data/lib/vellum_ai/types/prompt_template_block_data.rb +54 -0
- data/lib/vellum_ai/types/prompt_template_block_data_request.rb +54 -0
- data/lib/vellum_ai/types/prompt_template_block_properties.rb +104 -0
- data/lib/vellum_ai/types/prompt_template_block_properties_request.rb +104 -0
- data/lib/vellum_ai/types/prompt_template_block_request.rb +62 -0
- data/lib/vellum_ai/types/provider_enum.rb +20 -0
- data/lib/vellum_ai/types/raw_prompt_execution_overrides_request.rb +55 -0
- data/lib/vellum_ai/types/register_prompt_error_response.rb +45 -0
- data/lib/vellum_ai/types/register_prompt_model_parameters_request.rb +98 -0
- data/lib/vellum_ai/types/register_prompt_prompt.rb +50 -0
- data/lib/vellum_ai/types/register_prompt_prompt_info_request.rb +60 -0
- data/lib/vellum_ai/types/register_prompt_response.rb +110 -0
- data/lib/vellum_ai/types/registered_prompt_deployment.rb +55 -0
- data/lib/vellum_ai/types/registered_prompt_input_variable_request.rb +56 -0
- data/lib/vellum_ai/types/registered_prompt_model_version.rb +50 -0
- data/lib/vellum_ai/types/registered_prompt_sandbox.rb +50 -0
- data/lib/vellum_ai/types/registered_prompt_sandbox_snapshot.rb +45 -0
- data/lib/vellum_ai/types/rejected_enum.rb +5 -0
- data/lib/vellum_ai/types/rejected_execute_prompt_event.rb +68 -0
- data/lib/vellum_ai/types/rejected_execute_prompt_response.rb +73 -0
- data/lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb +63 -0
- data/lib/vellum_ai/types/rejected_function_call.rb +62 -0
- data/lib/vellum_ai/types/rejected_prompt_execution_meta.rb +52 -0
- data/lib/vellum_ai/types/rejected_workflow_node_result_event.rb +92 -0
- data/lib/vellum_ai/types/sandbox_scenario.rb +59 -0
- data/lib/vellum_ai/types/scenario_input.rb +70 -0
- data/lib/vellum_ai/types/scenario_input_request.rb +70 -0
- data/lib/vellum_ai/types/scenario_input_type_enum.rb +6 -0
- data/lib/vellum_ai/types/search_error_response.rb +45 -0
- data/lib/vellum_ai/types/search_filters_request.rb +56 -0
- data/lib/vellum_ai/types/search_node_result.rb +52 -0
- data/lib/vellum_ai/types/search_node_result_data.rb +70 -0
- data/lib/vellum_ai/types/search_request_options_request.rb +79 -0
- data/lib/vellum_ai/types/search_response.rb +49 -0
- data/lib/vellum_ai/types/search_result.rb +66 -0
- data/lib/vellum_ai/types/search_result_document.rb +60 -0
- data/lib/vellum_ai/types/search_result_document_request.rb +55 -0
- data/lib/vellum_ai/types/search_result_merging_request.rb +45 -0
- data/lib/vellum_ai/types/search_result_request.rb +66 -0
- data/lib/vellum_ai/types/search_results_enum.rb +5 -0
- data/lib/vellum_ai/types/search_weights_request.rb +50 -0
- data/lib/vellum_ai/types/slim_deployment_read.rb +109 -0
- data/lib/vellum_ai/types/slim_document.rb +126 -0
- data/lib/vellum_ai/types/slim_workflow_deployment.rb +118 -0
- data/lib/vellum_ai/types/streaming_enum.rb +5 -0
- data/lib/vellum_ai/types/streaming_execute_prompt_event.rb +85 -0
- data/lib/vellum_ai/types/streaming_prompt_execution_meta.rb +46 -0
- data/lib/vellum_ai/types/streaming_workflow_node_result_event.rb +99 -0
- data/lib/vellum_ai/types/string_chat_message_content.rb +46 -0
- data/lib/vellum_ai/types/string_chat_message_content_request.rb +46 -0
- data/lib/vellum_ai/types/string_enum.rb +5 -0
- data/lib/vellum_ai/types/string_input_request.rb +51 -0
- data/lib/vellum_ai/types/string_variable_value.rb +45 -0
- data/lib/vellum_ai/types/submit_completion_actual_request.rb +67 -0
- data/lib/vellum_ai/types/submit_completion_actuals_error_response.rb +45 -0
- data/lib/vellum_ai/types/submit_workflow_execution_actual_request.rb +103 -0
- data/lib/vellum_ai/types/templating_node_chat_history_result.rb +54 -0
- data/lib/vellum_ai/types/templating_node_error_result.rb +56 -0
- data/lib/vellum_ai/types/templating_node_json_result.rb +50 -0
- data/lib/vellum_ai/types/templating_node_number_result.rb +50 -0
- data/lib/vellum_ai/types/templating_node_result.rb +52 -0
- data/lib/vellum_ai/types/templating_node_result_data.rb +51 -0
- data/lib/vellum_ai/types/templating_node_result_output.rb +142 -0
- data/lib/vellum_ai/types/templating_node_search_results_result.rb +54 -0
- data/lib/vellum_ai/types/templating_node_string_result.rb +50 -0
- data/lib/vellum_ai/types/terminal_node_chat_history_result.rb +59 -0
- data/lib/vellum_ai/types/terminal_node_error_result.rb +61 -0
- data/lib/vellum_ai/types/terminal_node_json_result.rb +55 -0
- data/lib/vellum_ai/types/terminal_node_number_result.rb +55 -0
- data/lib/vellum_ai/types/terminal_node_result.rb +52 -0
- data/lib/vellum_ai/types/terminal_node_result_data.rb +51 -0
- data/lib/vellum_ai/types/terminal_node_result_output.rb +142 -0
- data/lib/vellum_ai/types/terminal_node_search_results_result.rb +59 -0
- data/lib/vellum_ai/types/terminal_node_string_result.rb +55 -0
- data/lib/vellum_ai/types/test_case_chat_history_variable_value.rb +54 -0
- data/lib/vellum_ai/types/test_case_error_variable_value.rb +56 -0
- data/lib/vellum_ai/types/test_case_json_variable_value.rb +50 -0
- data/lib/vellum_ai/types/test_case_number_variable_value.rb +50 -0
- data/lib/vellum_ai/types/test_case_search_results_variable_value.rb +54 -0
- data/lib/vellum_ai/types/test_case_string_variable_value.rb +50 -0
- data/lib/vellum_ai/types/test_case_variable_value.rb +142 -0
- data/lib/vellum_ai/types/test_suite_test_case.rb +68 -0
- data/lib/vellum_ai/types/upload_document_error_response.rb +45 -0
- data/lib/vellum_ai/types/upload_document_response.rb +45 -0
- data/lib/vellum_ai/types/vellum_error.rb +51 -0
- data/lib/vellum_ai/types/vellum_error_code_enum.rb +10 -0
- data/lib/vellum_ai/types/vellum_error_request.rb +51 -0
- data/lib/vellum_ai/types/vellum_image.rb +50 -0
- data/lib/vellum_ai/types/vellum_image_request.rb +50 -0
- data/lib/vellum_ai/types/vellum_variable.rb +56 -0
- data/lib/vellum_ai/types/vellum_variable_type.rb +16 -0
- data/lib/vellum_ai/types/workflow_event_error.rb +51 -0
- data/lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb +77 -0
- data/lib/vellum_ai/types/workflow_execution_actual_json_request.rb +73 -0
- data/lib/vellum_ai/types/workflow_execution_actual_string_request.rb +73 -0
- data/lib/vellum_ai/types/workflow_execution_event_error_code.rb +13 -0
- data/lib/vellum_ai/types/workflow_execution_event_type.rb +6 -0
- data/lib/vellum_ai/types/workflow_execution_node_result_event.rb +68 -0
- data/lib/vellum_ai/types/workflow_execution_workflow_result_event.rb +68 -0
- data/lib/vellum_ai/types/workflow_node_result_data.rb +155 -0
- data/lib/vellum_ai/types/workflow_node_result_event.rb +116 -0
- data/lib/vellum_ai/types/workflow_node_result_event_state.rb +11 -0
- data/lib/vellum_ai/types/workflow_output.rb +168 -0
- data/lib/vellum_ai/types/workflow_output_chat_history.rb +60 -0
- data/lib/vellum_ai/types/workflow_output_error.rb +62 -0
- data/lib/vellum_ai/types/workflow_output_function_call.rb +62 -0
- data/lib/vellum_ai/types/workflow_output_image.rb +62 -0
- data/lib/vellum_ai/types/workflow_output_json.rb +56 -0
- data/lib/vellum_ai/types/workflow_output_number.rb +56 -0
- data/lib/vellum_ai/types/workflow_output_search_results.rb +60 -0
- data/lib/vellum_ai/types/workflow_output_string.rb +56 -0
- data/lib/vellum_ai/types/workflow_request_chat_history_input_request.rb +54 -0
- data/lib/vellum_ai/types/workflow_request_input_request.rb +116 -0
- data/lib/vellum_ai/types/workflow_request_json_input_request.rb +50 -0
- data/lib/vellum_ai/types/workflow_request_number_input_request.rb +50 -0
- data/lib/vellum_ai/types/workflow_request_string_input_request.rb +50 -0
- data/lib/vellum_ai/types/workflow_result_event.rb +95 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data.rb +142 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_chat_history.rb +83 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_error.rb +85 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_json.rb +79 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_number.rb +79 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb +83 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_string.rb +79 -0
- data/lib/vellum_ai/types/workflow_stream_event.rb +90 -0
- data/lib/vellum_ai/workflow_deployments/client.rb +82 -0
- data/lib/vellum_ai/workflow_deployments/types/workflow_deployments_list_request_status.rb +8 -0
- data/lib/vellum_ai.rb +476 -0
- metadata +381 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 51f2e016abf98b307b469b704ca8f6cbfee098bb83f0c19d1dfa5ad0514908d5
|
4
|
+
data.tar.gz: 2cfc2c48a9d061283e3264caf5ae705968d2aec96d0b8d23ff6b1cc659ab7b10
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db41f9553fa39d81da3b4dc30bd4d296aa424a646488523c6bd8ec2eae4965f56ec793d20582ffc8abbebb7823a72c9edef70e1c9636c9903499c16c571e894c
|
7
|
+
data.tar.gz: bfd98565b2c779bbab50735f403b8b311d4e19b2c3765be50b9331f653bdc6b512b279a071e0c437451170fa70e206f71b5b1583db1635819650deca470d113d
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday/multipart"
|
4
|
+
require "mini_mime"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# Utility class for managing files.
|
8
|
+
class FileUtilities
|
9
|
+
# @param file_like [String, IO] The file to be uploaded, or a string path to the file.
|
10
|
+
# @return [Faraday::Multipart::FilePart]
|
11
|
+
def self.as_faraday_multipart(file_like:)
|
12
|
+
path = if file_like.is_a?(String)
|
13
|
+
file_like
|
14
|
+
else
|
15
|
+
file_like.path
|
16
|
+
end
|
17
|
+
mime_type = MiniMime.lookup_by_filename(path)
|
18
|
+
mime_type = if mime_type.nil?
|
19
|
+
"application/octet-stream"
|
20
|
+
else
|
21
|
+
mime_type.content_type
|
22
|
+
end
|
23
|
+
Faraday::Multipart::FilePart.new(file_like, mime_type)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/environment.rb
ADDED
data/lib/gemconfig.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vellum
|
4
|
+
module Gemconfig
|
5
|
+
VERSION = ""
|
6
|
+
AUTHORS = ["Vellum"].freeze
|
7
|
+
EMAIL = ""
|
8
|
+
SUMMARY = "The Vellum Ruby Library provides access to the Vellum API from Ruby."
|
9
|
+
DESCRIPTION = "The Vellum Ruby Library provides access to the Vellum API from Ruby."
|
10
|
+
HOMEPAGE = "https://github.com/vellum-ai/vellum-client-ruby"
|
11
|
+
SOURCE_CODE_URI = "https://github.com/vellum-ai/vellum-client-ruby"
|
12
|
+
CHANGELOG_URI = "https://github.com/vellum-ai/vellum-client-ruby/blob/master/CHANGELOG.md"
|
13
|
+
end
|
14
|
+
end
|
data/lib/requests.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "environment"
|
4
|
+
require "faraday"
|
5
|
+
require "faraday/multipart"
|
6
|
+
require "faraday/retry"
|
7
|
+
require "async/http/faraday"
|
8
|
+
|
9
|
+
module Vellum
|
10
|
+
class RequestClient
|
11
|
+
attr_reader :headers, :default_environment, :conn
|
12
|
+
|
13
|
+
# @param environment [Environment]
|
14
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
15
|
+
# @param timeout_in_seconds [Long]
|
16
|
+
# @param api_key [String]
|
17
|
+
# @return [RequestClient]
|
18
|
+
def initialize(api_key:, environment: Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil)
|
19
|
+
@default_environment = environment
|
20
|
+
@headers = {
|
21
|
+
"X-Fern-Language": "Ruby",
|
22
|
+
"X-Fern-SDK-Name": "Vellum",
|
23
|
+
"X-Fern-SDK-Version": "0.3.4",
|
24
|
+
"X_API_KEY": api_key.to_s
|
25
|
+
}
|
26
|
+
@conn = Faraday.new(headers: @headers) do |faraday|
|
27
|
+
faraday.request :multipart
|
28
|
+
faraday.request :json
|
29
|
+
faraday.response :raise_error, include_request: true
|
30
|
+
faraday.request :retry, { max: max_retries } unless max_retries.nil?
|
31
|
+
faraday.options.timeout = timeout_in_seconds unless timeout_in_seconds.nil?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class AsyncRequestClient
|
37
|
+
attr_reader :headers, :default_environment, :conn
|
38
|
+
|
39
|
+
# @param environment [Environment]
|
40
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
41
|
+
# @param timeout_in_seconds [Long]
|
42
|
+
# @param api_key [String]
|
43
|
+
# @return [AsyncRequestClient]
|
44
|
+
def initialize(api_key:, environment: Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil)
|
45
|
+
@default_environment = environment
|
46
|
+
@headers = {
|
47
|
+
"X-Fern-Language": "Ruby",
|
48
|
+
"X-Fern-SDK-Name": "Vellum",
|
49
|
+
"X-Fern-SDK-Version": "0.3.4",
|
50
|
+
"X_API_KEY": api_key.to_s
|
51
|
+
}
|
52
|
+
@conn = Faraday.new(headers: @headers) do |faraday|
|
53
|
+
faraday.request :multipart
|
54
|
+
faraday.request :json
|
55
|
+
faraday.response :raise_error, include_request: true
|
56
|
+
faraday.adapter :async_http
|
57
|
+
faraday.request :retry, { max: max_retries } unless max_retries.nil?
|
58
|
+
faraday.options.timeout = timeout_in_seconds unless timeout_in_seconds.nil?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Additional options for request-specific configuration when calling APIs via the SDK.
|
64
|
+
class RequestOptions
|
65
|
+
attr_reader :api_key, :additional_headers, :additional_query_parameters, :additional_body_parameters,
|
66
|
+
:timeout_in_seconds
|
67
|
+
|
68
|
+
# @param api_key [String]
|
69
|
+
# @param additional_headers [Hash{String => Object}]
|
70
|
+
# @param additional_query_parameters [Hash{String => Object}]
|
71
|
+
# @param additional_body_parameters [Hash{String => Object}]
|
72
|
+
# @param timeout_in_seconds [Long]
|
73
|
+
# @return [RequestOptions]
|
74
|
+
def initialize(api_key: nil, additional_headers: nil, additional_query_parameters: nil,
|
75
|
+
additional_body_parameters: nil, timeout_in_seconds: nil)
|
76
|
+
# @type [String]
|
77
|
+
@api_key = api_key
|
78
|
+
# @type [Hash{String => Object}]
|
79
|
+
@additional_headers = additional_headers
|
80
|
+
# @type [Hash{String => Object}]
|
81
|
+
@additional_query_parameters = additional_query_parameters
|
82
|
+
# @type [Hash{String => Object}]
|
83
|
+
@additional_body_parameters = additional_body_parameters
|
84
|
+
# @type [Long]
|
85
|
+
@timeout_in_seconds = timeout_in_seconds
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/types_export.rb
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_ai/deployments/types/deployments_list_request_status"
|
4
|
+
require_relative "vellum_ai/workflow_deployments/types/workflow_deployments_list_request_status"
|
5
|
+
require_relative "vellum_ai/types/api_node_result"
|
6
|
+
require_relative "vellum_ai/types/api_node_result_data"
|
7
|
+
require_relative "vellum_ai/types/array_chat_message_content"
|
8
|
+
require_relative "vellum_ai/types/array_chat_message_content_item"
|
9
|
+
require_relative "vellum_ai/types/array_chat_message_content_item_request"
|
10
|
+
require_relative "vellum_ai/types/array_chat_message_content_request"
|
11
|
+
require_relative "vellum_ai/types/block_type_enum"
|
12
|
+
require_relative "vellum_ai/types/chat_history_enum"
|
13
|
+
require_relative "vellum_ai/types/chat_history_input_request"
|
14
|
+
require_relative "vellum_ai/types/chat_message"
|
15
|
+
require_relative "vellum_ai/types/chat_message_content"
|
16
|
+
require_relative "vellum_ai/types/chat_message_content_request"
|
17
|
+
require_relative "vellum_ai/types/chat_message_request"
|
18
|
+
require_relative "vellum_ai/types/chat_message_role"
|
19
|
+
require_relative "vellum_ai/types/code_execution_node_chat_history_result"
|
20
|
+
require_relative "vellum_ai/types/code_execution_node_error_result"
|
21
|
+
require_relative "vellum_ai/types/code_execution_node_json_result"
|
22
|
+
require_relative "vellum_ai/types/code_execution_node_number_result"
|
23
|
+
require_relative "vellum_ai/types/code_execution_node_result"
|
24
|
+
require_relative "vellum_ai/types/code_execution_node_result_data"
|
25
|
+
require_relative "vellum_ai/types/code_execution_node_result_output"
|
26
|
+
require_relative "vellum_ai/types/code_execution_node_search_results_result"
|
27
|
+
require_relative "vellum_ai/types/code_execution_node_string_result"
|
28
|
+
require_relative "vellum_ai/types/conditional_node_result"
|
29
|
+
require_relative "vellum_ai/types/conditional_node_result_data"
|
30
|
+
require_relative "vellum_ai/types/deployment_provider_payload_response"
|
31
|
+
require_relative "vellum_ai/types/deployment_read"
|
32
|
+
require_relative "vellum_ai/types/document_document_to_document_index"
|
33
|
+
require_relative "vellum_ai/types/document_index_read"
|
34
|
+
require_relative "vellum_ai/types/document_read"
|
35
|
+
require_relative "vellum_ai/types/document_status"
|
36
|
+
require_relative "vellum_ai/types/enriched_normalized_completion"
|
37
|
+
require_relative "vellum_ai/types/entity_status"
|
38
|
+
require_relative "vellum_ai/types/environment_enum"
|
39
|
+
require_relative "vellum_ai/types/error_enum"
|
40
|
+
require_relative "vellum_ai/types/error_variable_value"
|
41
|
+
require_relative "vellum_ai/types/execute_prompt_api_error_response"
|
42
|
+
require_relative "vellum_ai/types/execute_prompt_event"
|
43
|
+
require_relative "vellum_ai/types/execute_prompt_response"
|
44
|
+
require_relative "vellum_ai/types/execute_workflow_error_response"
|
45
|
+
require_relative "vellum_ai/types/execute_workflow_response"
|
46
|
+
require_relative "vellum_ai/types/execute_workflow_stream_error_response"
|
47
|
+
require_relative "vellum_ai/types/execute_workflow_workflow_result_event"
|
48
|
+
require_relative "vellum_ai/types/finish_reason_enum"
|
49
|
+
require_relative "vellum_ai/types/fulfilled_enum"
|
50
|
+
require_relative "vellum_ai/types/fulfilled_execute_prompt_event"
|
51
|
+
require_relative "vellum_ai/types/fulfilled_execute_prompt_response"
|
52
|
+
require_relative "vellum_ai/types/fulfilled_execute_workflow_workflow_result_event"
|
53
|
+
require_relative "vellum_ai/types/fulfilled_function_call"
|
54
|
+
require_relative "vellum_ai/types/fulfilled_prompt_execution_meta"
|
55
|
+
require_relative "vellum_ai/types/fulfilled_workflow_node_result_event"
|
56
|
+
require_relative "vellum_ai/types/function_call"
|
57
|
+
require_relative "vellum_ai/types/function_call_chat_message_content"
|
58
|
+
require_relative "vellum_ai/types/function_call_chat_message_content_request"
|
59
|
+
require_relative "vellum_ai/types/function_call_chat_message_content_value"
|
60
|
+
require_relative "vellum_ai/types/function_call_chat_message_content_value_request"
|
61
|
+
require_relative "vellum_ai/types/function_call_enum"
|
62
|
+
require_relative "vellum_ai/types/function_call_variable_value"
|
63
|
+
require_relative "vellum_ai/types/generate_error_response"
|
64
|
+
require_relative "vellum_ai/types/generate_options_request"
|
65
|
+
require_relative "vellum_ai/types/generate_request"
|
66
|
+
require_relative "vellum_ai/types/generate_response"
|
67
|
+
require_relative "vellum_ai/types/generate_result"
|
68
|
+
require_relative "vellum_ai/types/generate_result_data"
|
69
|
+
require_relative "vellum_ai/types/generate_result_error"
|
70
|
+
require_relative "vellum_ai/types/generate_stream_response"
|
71
|
+
require_relative "vellum_ai/types/generate_stream_result"
|
72
|
+
require_relative "vellum_ai/types/generate_stream_result_data"
|
73
|
+
require_relative "vellum_ai/types/image_chat_message_content"
|
74
|
+
require_relative "vellum_ai/types/image_chat_message_content_request"
|
75
|
+
require_relative "vellum_ai/types/image_enum"
|
76
|
+
require_relative "vellum_ai/types/indexing_state_enum"
|
77
|
+
require_relative "vellum_ai/types/initiated_enum"
|
78
|
+
require_relative "vellum_ai/types/initiated_execute_prompt_event"
|
79
|
+
require_relative "vellum_ai/types/initiated_prompt_execution_meta"
|
80
|
+
require_relative "vellum_ai/types/initiated_workflow_node_result_event"
|
81
|
+
require_relative "vellum_ai/types/json_input_request"
|
82
|
+
require_relative "vellum_ai/types/json_enum"
|
83
|
+
require_relative "vellum_ai/types/json_variable_value"
|
84
|
+
require_relative "vellum_ai/types/logical_operator"
|
85
|
+
require_relative "vellum_ai/types/logprobs_enum"
|
86
|
+
require_relative "vellum_ai/types/metadata_filter_config_request"
|
87
|
+
require_relative "vellum_ai/types/metadata_filter_rule_combinator"
|
88
|
+
require_relative "vellum_ai/types/metadata_filter_rule_request"
|
89
|
+
require_relative "vellum_ai/types/model_version_build_config"
|
90
|
+
require_relative "vellum_ai/types/model_version_exec_config"
|
91
|
+
require_relative "vellum_ai/types/model_version_exec_config_parameters"
|
92
|
+
require_relative "vellum_ai/types/model_version_read"
|
93
|
+
require_relative "vellum_ai/types/model_version_read_status_enum"
|
94
|
+
require_relative "vellum_ai/types/model_version_sandbox_snapshot"
|
95
|
+
require_relative "vellum_ai/types/named_test_case_chat_history_variable_value_request"
|
96
|
+
require_relative "vellum_ai/types/named_test_case_error_variable_value_request"
|
97
|
+
require_relative "vellum_ai/types/named_test_case_json_variable_value_request"
|
98
|
+
require_relative "vellum_ai/types/named_test_case_number_variable_value_request"
|
99
|
+
require_relative "vellum_ai/types/named_test_case_search_results_variable_value_request"
|
100
|
+
require_relative "vellum_ai/types/named_test_case_string_variable_value_request"
|
101
|
+
require_relative "vellum_ai/types/named_test_case_variable_value_request"
|
102
|
+
require_relative "vellum_ai/types/node_input_compiled_chat_history_value"
|
103
|
+
require_relative "vellum_ai/types/node_input_compiled_error_value"
|
104
|
+
require_relative "vellum_ai/types/node_input_compiled_json_value"
|
105
|
+
require_relative "vellum_ai/types/node_input_compiled_number_value"
|
106
|
+
require_relative "vellum_ai/types/node_input_compiled_search_results_value"
|
107
|
+
require_relative "vellum_ai/types/node_input_compiled_string_value"
|
108
|
+
require_relative "vellum_ai/types/node_input_variable_compiled_value"
|
109
|
+
require_relative "vellum_ai/types/node_output_compiled_chat_history_value"
|
110
|
+
require_relative "vellum_ai/types/node_output_compiled_error_value"
|
111
|
+
require_relative "vellum_ai/types/node_output_compiled_json_value"
|
112
|
+
require_relative "vellum_ai/types/node_output_compiled_number_value"
|
113
|
+
require_relative "vellum_ai/types/node_output_compiled_search_results_value"
|
114
|
+
require_relative "vellum_ai/types/node_output_compiled_string_value"
|
115
|
+
require_relative "vellum_ai/types/node_output_compiled_value"
|
116
|
+
require_relative "vellum_ai/types/normalized_log_probs"
|
117
|
+
require_relative "vellum_ai/types/normalized_token_log_probs"
|
118
|
+
require_relative "vellum_ai/types/number_enum"
|
119
|
+
require_relative "vellum_ai/types/paginated_slim_deployment_read_list"
|
120
|
+
require_relative "vellum_ai/types/paginated_slim_document_list"
|
121
|
+
require_relative "vellum_ai/types/paginated_slim_workflow_deployment_list"
|
122
|
+
require_relative "vellum_ai/types/processing_failure_reason_enum"
|
123
|
+
require_relative "vellum_ai/types/processing_state_enum"
|
124
|
+
require_relative "vellum_ai/types/prompt_deployment_expand_meta_request_request"
|
125
|
+
require_relative "vellum_ai/types/prompt_deployment_input_request"
|
126
|
+
require_relative "vellum_ai/types/prompt_execution_meta"
|
127
|
+
require_relative "vellum_ai/types/prompt_node_result"
|
128
|
+
require_relative "vellum_ai/types/prompt_node_result_data"
|
129
|
+
require_relative "vellum_ai/types/prompt_output"
|
130
|
+
require_relative "vellum_ai/types/prompt_template_block"
|
131
|
+
require_relative "vellum_ai/types/prompt_template_block_data"
|
132
|
+
require_relative "vellum_ai/types/prompt_template_block_data_request"
|
133
|
+
require_relative "vellum_ai/types/prompt_template_block_properties"
|
134
|
+
require_relative "vellum_ai/types/prompt_template_block_properties_request"
|
135
|
+
require_relative "vellum_ai/types/prompt_template_block_request"
|
136
|
+
require_relative "vellum_ai/types/provider_enum"
|
137
|
+
require_relative "vellum_ai/types/raw_prompt_execution_overrides_request"
|
138
|
+
require_relative "vellum_ai/types/register_prompt_error_response"
|
139
|
+
require_relative "vellum_ai/types/register_prompt_model_parameters_request"
|
140
|
+
require_relative "vellum_ai/types/register_prompt_prompt"
|
141
|
+
require_relative "vellum_ai/types/register_prompt_prompt_info_request"
|
142
|
+
require_relative "vellum_ai/types/register_prompt_response"
|
143
|
+
require_relative "vellum_ai/types/registered_prompt_deployment"
|
144
|
+
require_relative "vellum_ai/types/registered_prompt_input_variable_request"
|
145
|
+
require_relative "vellum_ai/types/registered_prompt_model_version"
|
146
|
+
require_relative "vellum_ai/types/registered_prompt_sandbox"
|
147
|
+
require_relative "vellum_ai/types/registered_prompt_sandbox_snapshot"
|
148
|
+
require_relative "vellum_ai/types/rejected_enum"
|
149
|
+
require_relative "vellum_ai/types/rejected_execute_prompt_event"
|
150
|
+
require_relative "vellum_ai/types/rejected_execute_prompt_response"
|
151
|
+
require_relative "vellum_ai/types/rejected_execute_workflow_workflow_result_event"
|
152
|
+
require_relative "vellum_ai/types/rejected_function_call"
|
153
|
+
require_relative "vellum_ai/types/rejected_prompt_execution_meta"
|
154
|
+
require_relative "vellum_ai/types/rejected_workflow_node_result_event"
|
155
|
+
require_relative "vellum_ai/types/sandbox_scenario"
|
156
|
+
require_relative "vellum_ai/types/scenario_input"
|
157
|
+
require_relative "vellum_ai/types/scenario_input_request"
|
158
|
+
require_relative "vellum_ai/types/scenario_input_type_enum"
|
159
|
+
require_relative "vellum_ai/types/search_error_response"
|
160
|
+
require_relative "vellum_ai/types/search_filters_request"
|
161
|
+
require_relative "vellum_ai/types/search_node_result"
|
162
|
+
require_relative "vellum_ai/types/search_node_result_data"
|
163
|
+
require_relative "vellum_ai/types/search_request_options_request"
|
164
|
+
require_relative "vellum_ai/types/search_response"
|
165
|
+
require_relative "vellum_ai/types/search_result"
|
166
|
+
require_relative "vellum_ai/types/search_result_document"
|
167
|
+
require_relative "vellum_ai/types/search_result_document_request"
|
168
|
+
require_relative "vellum_ai/types/search_result_merging_request"
|
169
|
+
require_relative "vellum_ai/types/search_result_request"
|
170
|
+
require_relative "vellum_ai/types/search_results_enum"
|
171
|
+
require_relative "vellum_ai/types/search_weights_request"
|
172
|
+
require_relative "vellum_ai/types/slim_deployment_read"
|
173
|
+
require_relative "vellum_ai/types/slim_document"
|
174
|
+
require_relative "vellum_ai/types/slim_workflow_deployment"
|
175
|
+
require_relative "vellum_ai/types/streaming_enum"
|
176
|
+
require_relative "vellum_ai/types/streaming_execute_prompt_event"
|
177
|
+
require_relative "vellum_ai/types/streaming_prompt_execution_meta"
|
178
|
+
require_relative "vellum_ai/types/streaming_workflow_node_result_event"
|
179
|
+
require_relative "vellum_ai/types/string_chat_message_content"
|
180
|
+
require_relative "vellum_ai/types/string_chat_message_content_request"
|
181
|
+
require_relative "vellum_ai/types/string_enum"
|
182
|
+
require_relative "vellum_ai/types/string_input_request"
|
183
|
+
require_relative "vellum_ai/types/string_variable_value"
|
184
|
+
require_relative "vellum_ai/types/submit_completion_actual_request"
|
185
|
+
require_relative "vellum_ai/types/submit_completion_actuals_error_response"
|
186
|
+
require_relative "vellum_ai/types/submit_workflow_execution_actual_request"
|
187
|
+
require_relative "vellum_ai/types/templating_node_chat_history_result"
|
188
|
+
require_relative "vellum_ai/types/templating_node_error_result"
|
189
|
+
require_relative "vellum_ai/types/templating_node_json_result"
|
190
|
+
require_relative "vellum_ai/types/templating_node_number_result"
|
191
|
+
require_relative "vellum_ai/types/templating_node_result"
|
192
|
+
require_relative "vellum_ai/types/templating_node_result_data"
|
193
|
+
require_relative "vellum_ai/types/templating_node_result_output"
|
194
|
+
require_relative "vellum_ai/types/templating_node_search_results_result"
|
195
|
+
require_relative "vellum_ai/types/templating_node_string_result"
|
196
|
+
require_relative "vellum_ai/types/terminal_node_chat_history_result"
|
197
|
+
require_relative "vellum_ai/types/terminal_node_error_result"
|
198
|
+
require_relative "vellum_ai/types/terminal_node_json_result"
|
199
|
+
require_relative "vellum_ai/types/terminal_node_number_result"
|
200
|
+
require_relative "vellum_ai/types/terminal_node_result"
|
201
|
+
require_relative "vellum_ai/types/terminal_node_result_data"
|
202
|
+
require_relative "vellum_ai/types/terminal_node_result_output"
|
203
|
+
require_relative "vellum_ai/types/terminal_node_search_results_result"
|
204
|
+
require_relative "vellum_ai/types/terminal_node_string_result"
|
205
|
+
require_relative "vellum_ai/types/test_case_chat_history_variable_value"
|
206
|
+
require_relative "vellum_ai/types/test_case_error_variable_value"
|
207
|
+
require_relative "vellum_ai/types/test_case_json_variable_value"
|
208
|
+
require_relative "vellum_ai/types/test_case_number_variable_value"
|
209
|
+
require_relative "vellum_ai/types/test_case_search_results_variable_value"
|
210
|
+
require_relative "vellum_ai/types/test_case_string_variable_value"
|
211
|
+
require_relative "vellum_ai/types/test_case_variable_value"
|
212
|
+
require_relative "vellum_ai/types/test_suite_test_case"
|
213
|
+
require_relative "vellum_ai/types/upload_document_error_response"
|
214
|
+
require_relative "vellum_ai/types/upload_document_response"
|
215
|
+
require_relative "vellum_ai/types/vellum_error"
|
216
|
+
require_relative "vellum_ai/types/vellum_error_code_enum"
|
217
|
+
require_relative "vellum_ai/types/vellum_error_request"
|
218
|
+
require_relative "vellum_ai/types/vellum_image"
|
219
|
+
require_relative "vellum_ai/types/vellum_image_request"
|
220
|
+
require_relative "vellum_ai/types/vellum_variable"
|
221
|
+
require_relative "vellum_ai/types/vellum_variable_type"
|
222
|
+
require_relative "vellum_ai/types/workflow_event_error"
|
223
|
+
require_relative "vellum_ai/types/workflow_execution_actual_chat_history_request"
|
224
|
+
require_relative "vellum_ai/types/workflow_execution_actual_json_request"
|
225
|
+
require_relative "vellum_ai/types/workflow_execution_actual_string_request"
|
226
|
+
require_relative "vellum_ai/types/workflow_execution_event_error_code"
|
227
|
+
require_relative "vellum_ai/types/workflow_execution_event_type"
|
228
|
+
require_relative "vellum_ai/types/workflow_execution_node_result_event"
|
229
|
+
require_relative "vellum_ai/types/workflow_execution_workflow_result_event"
|
230
|
+
require_relative "vellum_ai/types/workflow_node_result_data"
|
231
|
+
require_relative "vellum_ai/types/workflow_node_result_event"
|
232
|
+
require_relative "vellum_ai/types/workflow_node_result_event_state"
|
233
|
+
require_relative "vellum_ai/types/workflow_output"
|
234
|
+
require_relative "vellum_ai/types/workflow_output_chat_history"
|
235
|
+
require_relative "vellum_ai/types/workflow_output_error"
|
236
|
+
require_relative "vellum_ai/types/workflow_output_function_call"
|
237
|
+
require_relative "vellum_ai/types/workflow_output_image"
|
238
|
+
require_relative "vellum_ai/types/workflow_output_json"
|
239
|
+
require_relative "vellum_ai/types/workflow_output_number"
|
240
|
+
require_relative "vellum_ai/types/workflow_output_search_results"
|
241
|
+
require_relative "vellum_ai/types/workflow_output_string"
|
242
|
+
require_relative "vellum_ai/types/workflow_request_chat_history_input_request"
|
243
|
+
require_relative "vellum_ai/types/workflow_request_input_request"
|
244
|
+
require_relative "vellum_ai/types/workflow_request_json_input_request"
|
245
|
+
require_relative "vellum_ai/types/workflow_request_number_input_request"
|
246
|
+
require_relative "vellum_ai/types/workflow_request_string_input_request"
|
247
|
+
require_relative "vellum_ai/types/workflow_result_event"
|
248
|
+
require_relative "vellum_ai/types/workflow_result_event_output_data"
|
249
|
+
require_relative "vellum_ai/types/workflow_result_event_output_data_chat_history"
|
250
|
+
require_relative "vellum_ai/types/workflow_result_event_output_data_error"
|
251
|
+
require_relative "vellum_ai/types/workflow_result_event_output_data_json"
|
252
|
+
require_relative "vellum_ai/types/workflow_result_event_output_data_number"
|
253
|
+
require_relative "vellum_ai/types/workflow_result_event_output_data_search_results"
|
254
|
+
require_relative "vellum_ai/types/workflow_result_event_output_data_string"
|
255
|
+
require_relative "vellum_ai/types/workflow_stream_event"
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../requests"
|
4
|
+
require_relative "types/deployments_list_request_status"
|
5
|
+
require_relative "../types/paginated_slim_deployment_read_list"
|
6
|
+
require_relative "../types/deployment_read"
|
7
|
+
require_relative "../types/prompt_deployment_input_request"
|
8
|
+
require_relative "../types/deployment_provider_payload_response"
|
9
|
+
require "async"
|
10
|
+
|
11
|
+
module Vellum
|
12
|
+
class DeploymentsClient
|
13
|
+
attr_reader :request_client
|
14
|
+
|
15
|
+
# @param request_client [RequestClient]
|
16
|
+
# @return [DeploymentsClient]
|
17
|
+
def initialize(request_client:)
|
18
|
+
# @type [RequestClient]
|
19
|
+
@request_client = request_client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @param limit [Integer] Number of results to return per page.
|
23
|
+
# @param offset [Integer] The initial index from which to return the results.
|
24
|
+
# @param ordering [String] Which field to use when ordering the results.
|
25
|
+
# @param status [DEPLOYMENTS_LIST_REQUEST_STATUS] The current status of the deployment
|
26
|
+
# @param request_options [RequestOptions]
|
27
|
+
# @return [PaginatedSlimDeploymentReadList]
|
28
|
+
def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)
|
29
|
+
response = @request_client.conn.get do |req|
|
30
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
31
|
+
req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
32
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
33
|
+
req.params = {
|
34
|
+
**(request_options&.additional_query_parameters || {}),
|
35
|
+
"limit": limit,
|
36
|
+
"offset": offset,
|
37
|
+
"ordering": ordering,
|
38
|
+
"status": status
|
39
|
+
}.compact
|
40
|
+
req.url "#{@request_client.default_environment[:Default]}/v1/deployments"
|
41
|
+
end
|
42
|
+
PaginatedSlimDeploymentReadList.from_json(json_object: response.body)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Used to retrieve a deployment given its ID or name.
|
46
|
+
#
|
47
|
+
# @param id [String] Either the Deployment's ID or its unique name
|
48
|
+
# @param request_options [RequestOptions]
|
49
|
+
# @return [DeploymentRead]
|
50
|
+
def retrieve(id:, request_options: nil)
|
51
|
+
response = @request_client.conn.get do |req|
|
52
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
53
|
+
req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
54
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
55
|
+
req.url "#{@request_client.default_environment[:Default]}/v1/deployments/#{id}"
|
56
|
+
end
|
57
|
+
DeploymentRead.from_json(json_object: response.body)
|
58
|
+
end
|
59
|
+
|
60
|
+
# @param deployment_id [String] The ID of the deployment. Must provide either this or deployment_name.
|
61
|
+
# @param deployment_name [String] The name of the deployment. Must provide either this or deployment_id.
|
62
|
+
# @param inputs [Array<Hash>] The list of inputs defined in the Prompt's deployment with their corresponding values.Request of type Array<PromptDeploymentInputRequest>, as a Hash
|
63
|
+
# @param request_options [RequestOptions]
|
64
|
+
# @return [DeploymentProviderPayloadResponse]
|
65
|
+
def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, request_options: nil)
|
66
|
+
response = @request_client.conn.post do |req|
|
67
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
68
|
+
req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
69
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
70
|
+
req.body = {
|
71
|
+
**(request_options&.additional_body_parameters || {}),
|
72
|
+
deployment_id: deployment_id,
|
73
|
+
deployment_name: deployment_name,
|
74
|
+
inputs: inputs
|
75
|
+
}.compact
|
76
|
+
req.url "#{@request_client.default_environment[:Default]}/v1/deployments/provider-payload"
|
77
|
+
end
|
78
|
+
DeploymentProviderPayloadResponse.from_json(json_object: response.body)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class AsyncDeploymentsClient
|
83
|
+
attr_reader :request_client
|
84
|
+
|
85
|
+
# @param request_client [AsyncRequestClient]
|
86
|
+
# @return [AsyncDeploymentsClient]
|
87
|
+
def initialize(request_client:)
|
88
|
+
# @type [AsyncRequestClient]
|
89
|
+
@request_client = request_client
|
90
|
+
end
|
91
|
+
|
92
|
+
# @param limit [Integer] Number of results to return per page.
|
93
|
+
# @param offset [Integer] The initial index from which to return the results.
|
94
|
+
# @param ordering [String] Which field to use when ordering the results.
|
95
|
+
# @param status [DEPLOYMENTS_LIST_REQUEST_STATUS] The current status of the deployment
|
96
|
+
# @param request_options [RequestOptions]
|
97
|
+
# @return [PaginatedSlimDeploymentReadList]
|
98
|
+
def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)
|
99
|
+
Async do
|
100
|
+
response = @request_client.conn.get do |req|
|
101
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
102
|
+
req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
103
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
104
|
+
req.params = {
|
105
|
+
**(request_options&.additional_query_parameters || {}),
|
106
|
+
"limit": limit,
|
107
|
+
"offset": offset,
|
108
|
+
"ordering": ordering,
|
109
|
+
"status": status
|
110
|
+
}.compact
|
111
|
+
req.url "#{@request_client.default_environment[:Default]}/v1/deployments"
|
112
|
+
end
|
113
|
+
PaginatedSlimDeploymentReadList.from_json(json_object: response.body)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Used to retrieve a deployment given its ID or name.
|
118
|
+
#
|
119
|
+
# @param id [String] Either the Deployment's ID or its unique name
|
120
|
+
# @param request_options [RequestOptions]
|
121
|
+
# @return [DeploymentRead]
|
122
|
+
def retrieve(id:, request_options: nil)
|
123
|
+
Async do
|
124
|
+
response = @request_client.conn.get do |req|
|
125
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
126
|
+
req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
127
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
128
|
+
req.url "#{@request_client.default_environment[:Default]}/v1/deployments/#{id}"
|
129
|
+
end
|
130
|
+
DeploymentRead.from_json(json_object: response.body)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# @param deployment_id [String] The ID of the deployment. Must provide either this or deployment_name.
|
135
|
+
# @param deployment_name [String] The name of the deployment. Must provide either this or deployment_id.
|
136
|
+
# @param inputs [Array<Hash>] The list of inputs defined in the Prompt's deployment with their corresponding values.Request of type Array<PromptDeploymentInputRequest>, as a Hash
|
137
|
+
# @param request_options [RequestOptions]
|
138
|
+
# @return [DeploymentProviderPayloadResponse]
|
139
|
+
def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, request_options: nil)
|
140
|
+
Async do
|
141
|
+
response = @request_client.conn.post do |req|
|
142
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
143
|
+
req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
144
|
+
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
145
|
+
req.body = {
|
146
|
+
**(request_options&.additional_body_parameters || {}),
|
147
|
+
deployment_id: deployment_id,
|
148
|
+
deployment_name: deployment_name,
|
149
|
+
inputs: inputs
|
150
|
+
}.compact
|
151
|
+
req.url "#{@request_client.default_environment[:Default]}/v1/deployments/provider-payload"
|
152
|
+
end
|
153
|
+
DeploymentProviderPayloadResponse.from_json(json_object: response.body)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|