Class: Vellum::AsyncWorkflowsClient
- Inherits:
-
Object
- Object
- Vellum::AsyncWorkflowsClient
- Defined in:
- lib/vellum_ai/workflows/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#execute_node(files:, node:, inputs: nil, request_options: nil) ⇒ Object
api.workflows.execute_node(files: { "files": "files" }, node: "x").
- #initialize(request_client:) ⇒ Vellum::AsyncWorkflowsClient constructor
- #pull(id:, exclude_code: nil, exclude_display: nil, include_json: nil, include_sandbox: nil, release_tag: nil, strict: nil, version: nil, request_options: nil, &on_data) ⇒ Void
- #push(exec_config: nil, workflow_sandbox_id: nil, deployment_config: nil, artifact: nil, dataset: nil, dry_run: nil, strict: nil, request_options: nil) ⇒ Vellum::WorkflowPushResponse
-
#retrieve_state(span_id:, request_options: nil) ⇒ Object
api.workflows.retrieve_state(span_id: "span_id").
-
#serialize_workflow_files(files:, module_: nil, runner_config: nil, type_checker: nil, request_options: nil) ⇒ Object
api.workflows.serialize_workflow_files(files: { "files": "key":"value" }).
-
#workflow_execution_status(execution_id:, request_options: nil) ⇒ Object
api.workflows.workflow_execution_status(execution_id: "execution_id").
Constructor Details
#initialize(request_client:) ⇒ Vellum::AsyncWorkflowsClient
278 279 280 |
# File 'lib/vellum_ai/workflows/client.rb', line 278 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Vellum::AsyncRequestClient (readonly)
273 274 275 |
# File 'lib/vellum_ai/workflows/client.rb', line 273 def request_client @request_client end |
Instance Method Details
#execute_node(files:, node:, inputs: nil, request_options: nil) ⇒ Object
api.workflows.execute_node(files: { "files": "files" }, node: "x")
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/vellum_ai/workflows/client.rb', line 371 def execute_node(files:, node:, inputs: nil, request_options: nil) Async do 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 || {}), files: files, node: node, inputs: inputs }.compact req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/workflows/execute-node" end Vellum::WorkflowSandboxExecuteNodeResponse.from_json(json_object: response.body) end end |
#pull(id:, exclude_code: nil, exclude_display: nil, include_json: nil, include_sandbox: nil, release_tag: nil, strict: nil, version: nil, request_options: nil, &on_data) ⇒ Void
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/vellum_ai/workflows/client.rb', line 296 def pull(id:, exclude_code: nil, exclude_display: nil, include_json: nil, include_sandbox: nil, release_tag: nil, strict: nil, version: nil, request_options: nil, &on_data) Async do response = @request_client.conn.get 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 req..on_data = on_data req.params = { **(&.additional_query_parameters || {}), "exclude_code": exclude_code, "exclude_display": exclude_display, "include_json": include_json, "include_sandbox": include_sandbox, "release_tag": release_tag, "strict": strict, "version": version }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(environment: Predict, request_options: request_options)}/v1/workflows/#{id}/pull" end end end |
#push(exec_config: nil, workflow_sandbox_id: nil, deployment_config: nil, artifact: nil, dataset: nil, dry_run: nil, strict: nil, request_options: nil) ⇒ Vellum::WorkflowPushResponse
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/vellum_ai/workflows/client.rb', line 455 def push(exec_config: nil, workflow_sandbox_id: nil, deployment_config: nil, artifact: nil, dataset: nil, dry_run: nil, strict: nil, request_options: nil) Async do 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 || {}), exec_config: exec_config, workflow_sandbox_id: workflow_sandbox_id, deployment_config: deployment_config, artifact: unless artifact.nil? Vellum::FileUtilities.as_faraday_multipart(file_like: artifact) end, dataset: dataset, dry_run: dry_run, strict: strict }.compact req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/workflows/push" end Vellum::WorkflowPushResponse.from_json(json_object: response.body) end end |
#retrieve_state(span_id:, request_options: nil) ⇒ Object
api.workflows.retrieve_state(span_id: "span_id")
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/vellum_ai/workflows/client.rb', line 333 def retrieve_state(span_id:, request_options: nil) Async do response = @request_client.conn.get 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 unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(environment: Predict, request_options: request_options)}/v1/workflows/#{span_id}/state" end Vellum::WorkflowResolvedState.from_json(json_object: response.body) end end |
#serialize_workflow_files(files:, module_: nil, runner_config: nil, type_checker: nil, request_options: nil) ⇒ Object
api.workflows.serialize_workflow_files(files: { "files": "key":"value" })
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
# File 'lib/vellum_ai/workflows/client.rb', line 506 def serialize_workflow_files(files:, module_: nil, runner_config: nil, type_checker: nil, request_options: nil) Async do 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 || {}), files: files, module: module_, runner_config: runner_config, type_checker: type_checker }.compact req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/workflows/serialize" end parsed_json = JSON.parse(response.body) parsed_json end end |
#workflow_execution_status(execution_id:, request_options: nil) ⇒ Object
api.workflows.workflow_execution_status(execution_id: "execution_id")
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
# File 'lib/vellum_ai/workflows/client.rb', line 409 def workflow_execution_status(execution_id:, request_options: nil) Async do response = @request_client.conn.get 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 unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(environment: Predict, request_options: request_options)}/v1/workflows/executions/#{execution_id}/status" end Vellum::CheckWorkflowExecutionStatusResponse.from_json(json_object: response.body) end end |