Class: Vellum::Client
- Inherits:
-
Object
- Object
- Vellum::Client
- Defined in:
- lib/vellum_ai.rb
Instance Attribute Summary collapse
- #ad_hoc ⇒ Vellum::AdHocClient readonly
- #container_images ⇒ Vellum::ContainerImagesClient readonly
- #deployments ⇒ Vellum::DeploymentsClient readonly
- #document_indexes ⇒ Vellum::DocumentIndexesClient readonly
- #documents ⇒ Vellum::DocumentsClient readonly
- #environments ⇒ Vellum::EnvironmentsClient readonly
- #events ⇒ Vellum::EventsClient readonly
- #folder_entities ⇒ Vellum::FolderEntitiesClient readonly
- #integration_auth_configs ⇒ Vellum::IntegrationAuthConfigsClient readonly
- #integration_providers ⇒ Vellum::IntegrationProvidersClient readonly
- #integrations ⇒ Vellum::IntegrationsClient readonly
- #metric_definitions ⇒ Vellum::MetricDefinitionsClient readonly
- #ml_models ⇒ Vellum::MlModelsClient readonly
- #organizations ⇒ Vellum::OrganizationsClient readonly
- #prompts ⇒ Vellum::PromptsClient readonly
- #sandboxes ⇒ Vellum::SandboxesClient readonly
- #test_suite_runs ⇒ Vellum::TestSuiteRunsClient readonly
- #test_suites ⇒ Vellum::TestSuitesClient readonly
- #uploaded_files ⇒ Vellum::UploadedFilesClient readonly
- #workflow_deployments ⇒ Vellum::WorkflowDeploymentsClient readonly
- #workflow_executions ⇒ Vellum::WorkflowExecutionsClient readonly
- #workflow_sandboxes ⇒ Vellum::WorkflowSandboxesClient readonly
- #workflows ⇒ Vellum::WorkflowsClient readonly
- #workspace_secrets ⇒ Vellum::WorkspaceSecretsClient readonly
- #workspaces ⇒ Vellum::WorkspacesClient readonly
Instance Method Summary collapse
-
#execute_api(url:, method: nil, body: nil, headers: nil, bearer_token: nil, request_options: nil) ⇒ Object
api.execute_api(url: "x").
-
#execute_code(code:, runtime:, input_values:, packages:, output_type:, request_options: nil) ⇒ Object
).
-
#execute_prompt(inputs:, prompt_deployment_id: nil, prompt_deployment_name: nil, release_tag: nil, external_id: nil, expand_meta: nil, raw_overrides: nil, expand_raw: nil, metadata: nil, request_options: nil) ⇒ Object
api.execute_prompt(inputs: [{ name: "x", type: "STRING", value: "value" }, { name: "x", type: "STRING", value: "value" }]).
-
#execute_workflow(inputs:, expand_meta: nil, workflow_deployment_id: nil, workflow_deployment_name: nil, release_tag: nil, external_id: nil, metadata: nil, previous_execution_id: nil, request_options: nil) ⇒ Object
api.execute_workflow(inputs: [{ name: "x", type: "STRING", value: "value" }, { name: "x", type: "STRING", value: "value" }]).
-
#execute_workflow_async(inputs:, workflow_deployment_id: nil, workflow_deployment_name: nil, release_tag: nil, external_id: nil, previous_execution_id: nil, metadata: nil, request_options: nil) ⇒ Object
api.execute_workflow_async(inputs: [{ name: "x", type: "STRING", value: "value" }, { name: "x", type: "STRING", value: "value" }]).
-
#generate(deployment_id: nil, deployment_name: nil, requests:, options: nil, request_options: nil) ⇒ Object
api.generate(requests: [{ input_values: { "input_values": "key":"value" } }, { input_values: { "input_values": "key":"value" } }]).
- #initialize(base_url: nil, environment: Vellum::Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil, api_key:, api_version: nil) ⇒ Vellum::Client constructor
-
#search(index_id: nil, index_name: nil, query:, options: nil, document_index: nil, request_options: nil) ⇒ Object
api.search(query: "x").
-
#submit_completion_actuals(deployment_id: nil, deployment_name: nil, actuals:, request_options: nil) ⇒ Object
api.submit_completion_actuals(actuals: [{ }, { }]).
-
#submit_workflow_execution_actuals(actuals:, execution_id: nil, external_id: nil, request_options: nil) ⇒ Object
api.submit_workflow_execution_actuals(actuals: [{ output_type: "STRING" }, { output_type: "STRING" }]).
Constructor Details
#initialize(base_url: nil, environment: Vellum::Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil, api_key:, api_version: nil) ⇒ Vellum::Client
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/vellum_ai.rb', line 118 def initialize(base_url: nil, environment: Vellum::Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil, api_key:, api_version: nil) @request_client = Vellum::RequestClient.new( base_url: base_url, environment: environment, max_retries: max_retries, timeout_in_seconds: timeout_in_seconds, api_key: api_key, api_version: api_version ) @integrations = Vellum::IntegrationsClient.new(request_client: @request_client) @events = Vellum::EventsClient.new(request_client: @request_client) @ad_hoc = Vellum::AdHocClient.new(request_client: @request_client) @container_images = Vellum::ContainerImagesClient.new(request_client: @request_client) @deployments = Vellum::DeploymentsClient.new(request_client: @request_client) @document_indexes = Vellum::DocumentIndexesClient.new(request_client: @request_client) @documents = Vellum::DocumentsClient.new(request_client: @request_client) @environments = Vellum::EnvironmentsClient.new(request_client: @request_client) @folder_entities = Vellum::FolderEntitiesClient.new(request_client: @request_client) @integration_auth_configs = Vellum::IntegrationAuthConfigsClient.new(request_client: @request_client) @integration_providers = Vellum::IntegrationProvidersClient.new(request_client: @request_client) @metric_definitions = Vellum::MetricDefinitionsClient.new(request_client: @request_client) @ml_models = Vellum::MlModelsClient.new(request_client: @request_client) @organizations = Vellum::OrganizationsClient.new(request_client: @request_client) @prompts = Vellum::PromptsClient.new(request_client: @request_client) @sandboxes = Vellum::SandboxesClient.new(request_client: @request_client) @test_suite_runs = Vellum::TestSuiteRunsClient.new(request_client: @request_client) @test_suites = Vellum::TestSuitesClient.new(request_client: @request_client) @uploaded_files = Vellum::UploadedFilesClient.new(request_client: @request_client) @workflow_deployments = Vellum::WorkflowDeploymentsClient.new(request_client: @request_client) @workflow_executions = Vellum::WorkflowExecutionsClient.new(request_client: @request_client) @workflow_sandboxes = Vellum::WorkflowSandboxesClient.new(request_client: @request_client) @workflows = Vellum::WorkflowsClient.new(request_client: @request_client) @workspace_secrets = Vellum::WorkspaceSecretsClient.new(request_client: @request_client) @workspaces = Vellum::WorkspacesClient.new(request_client: @request_client) end |
Instance Attribute Details
#ad_hoc ⇒ Vellum::AdHocClient (readonly)
64 65 66 |
# File 'lib/vellum_ai.rb', line 64 def ad_hoc @ad_hoc end |
#container_images ⇒ Vellum::ContainerImagesClient (readonly)
66 67 68 |
# File 'lib/vellum_ai.rb', line 66 def container_images @container_images end |
#deployments ⇒ Vellum::DeploymentsClient (readonly)
68 69 70 |
# File 'lib/vellum_ai.rb', line 68 def deployments @deployments end |
#document_indexes ⇒ Vellum::DocumentIndexesClient (readonly)
70 71 72 |
# File 'lib/vellum_ai.rb', line 70 def document_indexes @document_indexes end |
#documents ⇒ Vellum::DocumentsClient (readonly)
72 73 74 |
# File 'lib/vellum_ai.rb', line 72 def documents @documents end |
#environments ⇒ Vellum::EnvironmentsClient (readonly)
74 75 76 |
# File 'lib/vellum_ai.rb', line 74 def environments @environments end |
#events ⇒ Vellum::EventsClient (readonly)
62 63 64 |
# File 'lib/vellum_ai.rb', line 62 def events @events end |
#folder_entities ⇒ Vellum::FolderEntitiesClient (readonly)
76 77 78 |
# File 'lib/vellum_ai.rb', line 76 def folder_entities @folder_entities end |
#integration_auth_configs ⇒ Vellum::IntegrationAuthConfigsClient (readonly)
78 79 80 |
# File 'lib/vellum_ai.rb', line 78 def integration_auth_configs @integration_auth_configs end |
#integration_providers ⇒ Vellum::IntegrationProvidersClient (readonly)
80 81 82 |
# File 'lib/vellum_ai.rb', line 80 def integration_providers @integration_providers end |
#integrations ⇒ Vellum::IntegrationsClient (readonly)
60 61 62 |
# File 'lib/vellum_ai.rb', line 60 def integrations @integrations end |
#metric_definitions ⇒ Vellum::MetricDefinitionsClient (readonly)
82 83 84 |
# File 'lib/vellum_ai.rb', line 82 def metric_definitions @metric_definitions end |
#ml_models ⇒ Vellum::MlModelsClient (readonly)
84 85 86 |
# File 'lib/vellum_ai.rb', line 84 def ml_models @ml_models end |
#organizations ⇒ Vellum::OrganizationsClient (readonly)
86 87 88 |
# File 'lib/vellum_ai.rb', line 86 def organizations @organizations end |
#prompts ⇒ Vellum::PromptsClient (readonly)
88 89 90 |
# File 'lib/vellum_ai.rb', line 88 def prompts @prompts end |
#sandboxes ⇒ Vellum::SandboxesClient (readonly)
90 91 92 |
# File 'lib/vellum_ai.rb', line 90 def sandboxes @sandboxes end |
#test_suite_runs ⇒ Vellum::TestSuiteRunsClient (readonly)
92 93 94 |
# File 'lib/vellum_ai.rb', line 92 def test_suite_runs @test_suite_runs end |
#test_suites ⇒ Vellum::TestSuitesClient (readonly)
94 95 96 |
# File 'lib/vellum_ai.rb', line 94 def test_suites @test_suites end |
#uploaded_files ⇒ Vellum::UploadedFilesClient (readonly)
96 97 98 |
# File 'lib/vellum_ai.rb', line 96 def uploaded_files @uploaded_files end |
#workflow_deployments ⇒ Vellum::WorkflowDeploymentsClient (readonly)
98 99 100 |
# File 'lib/vellum_ai.rb', line 98 def workflow_deployments @workflow_deployments end |
#workflow_executions ⇒ Vellum::WorkflowExecutionsClient (readonly)
100 101 102 |
# File 'lib/vellum_ai.rb', line 100 def workflow_executions @workflow_executions end |
#workflow_sandboxes ⇒ Vellum::WorkflowSandboxesClient (readonly)
102 103 104 |
# File 'lib/vellum_ai.rb', line 102 def workflow_sandboxes @workflow_sandboxes end |
#workflows ⇒ Vellum::WorkflowsClient (readonly)
104 105 106 |
# File 'lib/vellum_ai.rb', line 104 def workflows @workflows end |
#workspace_secrets ⇒ Vellum::WorkspaceSecretsClient (readonly)
106 107 108 |
# File 'lib/vellum_ai.rb', line 106 def workspace_secrets @workspace_secrets end |
#workspaces ⇒ Vellum::WorkspacesClient (readonly)
108 109 110 |
# File 'lib/vellum_ai.rb', line 108 def workspaces @workspaces end |
Instance Method Details
#execute_api(url:, method: nil, body: nil, headers: nil, bearer_token: nil, request_options: nil) ⇒ Object
api.execute_api(url: "x")
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/vellum_ai.rb', line 167 def execute_api(url:, method: nil, body: nil, headers: nil, bearer_token: nil, request_options: nil) response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.api_key.nil? req.headers["X-API-KEY"] = .api_key end unless &.api_version.nil? req.headers["X-API-Version"] = .api_version else req.headers["X-API-Version"] = "2025-07-30" end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), url: url, method: method, body: body, headers: headers, bearer_token: bearer_token }.compact req.url "#{@request_client.get_url(environment: Default, request_options: )}/v1/execute-api" end Vellum::ExecuteApiResponse.from_json(json_object: response.body) end |
#execute_code(code:, runtime:, input_values:, packages:, output_type:, request_options: nil) ⇒ Object
)
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/vellum_ai.rb', line 212 def execute_code(code:, runtime:, input_values:, packages:, output_type:, request_options: nil) response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.api_key.nil? req.headers["X-API-KEY"] = .api_key end unless &.api_version.nil? req.headers["X-API-Version"] = .api_version else req.headers["X-API-Version"] = "2025-07-30" end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), code: code, runtime: runtime, input_values: input_values, packages: packages, output_type: output_type }.compact req.url "#{@request_client.get_url(environment: Predict, request_options: )}/v1/execute-code" end Vellum::CodeExecutorResponse.from_json(json_object: response.body) end |
#execute_prompt(inputs:, prompt_deployment_id: nil, prompt_deployment_name: nil, release_tag: nil, external_id: nil, expand_meta: nil, raw_overrides: nil, expand_raw: nil, metadata: nil, request_options: nil) ⇒ Object
api.execute_prompt(inputs: [{ name: "x", type: "STRING", value: "value" }, { name: "x", type: "STRING", value: "value" }])
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/vellum_ai.rb', line 276 def execute_prompt(inputs:, prompt_deployment_id: nil, prompt_deployment_name: nil, release_tag: nil, external_id: nil, expand_meta: nil, raw_overrides: nil, expand_raw: nil, metadata: nil, request_options: nil) response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.api_key.nil? req.headers["X-API-KEY"] = .api_key end unless &.api_version.nil? req.headers["X-API-Version"] = .api_version else req.headers["X-API-Version"] = "2025-07-30" end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), inputs: inputs, prompt_deployment_id: prompt_deployment_id, prompt_deployment_name: prompt_deployment_name, release_tag: release_tag, external_id: external_id, expand_meta: , raw_overrides: raw_overrides, expand_raw: , metadata: }.compact req.url "#{@request_client.get_url(environment: Predict, request_options: )}/v1/execute-prompt" end Vellum::ExecutePromptResponse.from_json(json_object: response.body) end |
#execute_workflow(inputs:, expand_meta: nil, workflow_deployment_id: nil, workflow_deployment_name: nil, release_tag: nil, external_id: nil, metadata: nil, previous_execution_id: nil, request_options: nil) ⇒ Object
api.execute_workflow(inputs: [{ name: "x", type: "STRING", value: "value" }, { name: "x", type: "STRING", value: "value" }])
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'lib/vellum_ai.rb', line 330 def execute_workflow(inputs:, expand_meta: nil, workflow_deployment_id: nil, workflow_deployment_name: nil, release_tag: nil, external_id: nil, metadata: nil, previous_execution_id: nil, request_options: nil) response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.api_key.nil? req.headers["X-API-KEY"] = .api_key end unless &.api_version.nil? req.headers["X-API-Version"] = .api_version else req.headers["X-API-Version"] = "2025-07-30" end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), inputs: inputs, expand_meta: , workflow_deployment_id: workflow_deployment_id, workflow_deployment_name: workflow_deployment_name, release_tag: release_tag, external_id: external_id, metadata: , previous_execution_id: previous_execution_id }.compact req.url "#{@request_client.get_url(environment: Predict, request_options: )}/v1/execute-workflow" end Vellum::ExecuteWorkflowResponse.from_json(json_object: response.body) end |
#execute_workflow_async(inputs:, workflow_deployment_id: nil, workflow_deployment_name: nil, release_tag: nil, external_id: nil, previous_execution_id: nil, metadata: nil, request_options: nil) ⇒ Object
api.execute_workflow_async(inputs: [{ name: "x", type: "STRING", value: "value" }, { name: "x", type: "STRING", value: "value" }])
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/vellum_ai.rb', line 377 def execute_workflow_async(inputs:, workflow_deployment_id: nil, workflow_deployment_name: nil, release_tag: nil, external_id: nil, previous_execution_id: nil, metadata: nil, request_options: nil) response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.api_key.nil? req.headers["X-API-KEY"] = .api_key end unless &.api_version.nil? req.headers["X-API-Version"] = .api_version else req.headers["X-API-Version"] = "2025-07-30" end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), inputs: inputs, workflow_deployment_id: workflow_deployment_id, workflow_deployment_name: workflow_deployment_name, release_tag: release_tag, external_id: external_id, previous_execution_id: previous_execution_id, metadata: }.compact req.url "#{@request_client.get_url(environment: Predict, request_options: )}/v1/execute-workflow-async" end Vellum::ExecuteWorkflowAsyncResponse.from_json(json_object: response.body) end |
#generate(deployment_id: nil, deployment_name: nil, requests:, options: nil, request_options: nil) ⇒ Object
api.generate(requests: [{ input_values: { "input_values": "key":"value" } }, { input_values: { "input_values": "key":"value" } }])
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/vellum_ai.rb', line 422 def generate(deployment_id: nil, deployment_name: nil, requests:, options: nil, request_options: nil) response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.api_key.nil? req.headers["X-API-KEY"] = .api_key end unless &.api_version.nil? req.headers["X-API-Version"] = .api_version else req.headers["X-API-Version"] = "2025-07-30" end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), deployment_id: deployment_id, deployment_name: deployment_name, requests: requests, options: }.compact req.url "#{@request_client.get_url(environment: Predict, request_options: )}/v1/generate" end Vellum::GenerateResponse.from_json(json_object: response.body) end |
#search(index_id: nil, index_name: nil, query:, options: nil, document_index: nil, request_options: nil) ⇒ Object
api.search(query: "x")
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'lib/vellum_ai.rb', line 472 def search(index_id: nil, index_name: nil, query:, options: nil, document_index: nil, request_options: nil) response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.api_key.nil? req.headers["X-API-KEY"] = .api_key end unless &.api_version.nil? req.headers["X-API-Version"] = .api_version else req.headers["X-API-Version"] = "2025-07-30" end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), index_id: index_id, index_name: index_name, query: query, options: , document_index: document_index }.compact req.url "#{@request_client.get_url(environment: Predict, request_options: )}/v1/search" end Vellum::SearchResponse.from_json(json_object: response.body) end |
#submit_completion_actuals(deployment_id: nil, deployment_name: nil, actuals:, request_options: nil) ⇒ Object
api.submit_completion_actuals(actuals: [{ }, { }])
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 |
# File 'lib/vellum_ai.rb', line 515 def submit_completion_actuals(deployment_id: nil, deployment_name: nil, actuals:, request_options: nil) response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.api_key.nil? req.headers["X-API-KEY"] = .api_key end unless &.api_version.nil? req.headers["X-API-Version"] = .api_version else req.headers["X-API-Version"] = "2025-07-30" end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), deployment_id: deployment_id, deployment_name: deployment_name, actuals: actuals }.compact req.url "#{@request_client.get_url(environment: Predict, request_options: )}/v1/submit-completion-actuals" end end |
#submit_workflow_execution_actuals(actuals:, execution_id: nil, external_id: nil, request_options: nil) ⇒ Object
api.submit_workflow_execution_actuals(actuals: [{ output_type: "STRING" }, { output_type: "STRING" }])
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
# File 'lib/vellum_ai.rb', line 555 def submit_workflow_execution_actuals(actuals:, execution_id: nil, external_id: nil, request_options: nil) response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.api_key.nil? req.headers["X-API-KEY"] = .api_key end unless &.api_version.nil? req.headers["X-API-Version"] = .api_version else req.headers["X-API-Version"] = "2025-07-30" end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), actuals: actuals, execution_id: execution_id, external_id: external_id }.compact req.url "#{@request_client.get_url(environment: Predict, request_options: )}/v1/submit-workflow-execution-actuals" end end |