Class: Vellum::WorkflowsClient
- Inherits:
-
Object
- Object
- Vellum::WorkflowsClient
- Defined in:
- lib/vellum_ai/workflows/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #initialize(request_client:) ⇒ Vellum::WorkflowsClient constructor
- #pull(id:, exclude_code: nil, exclude_display: nil, include_json: nil, include_sandbox: nil, strict: nil, request_options: nil, &on_data) ⇒ Void
- #push(exec_config:, workflow_sandbox_id: nil, deployment_config: nil, artifact: nil, dry_run: nil, strict: nil, request_options: nil) ⇒ Vellum::WorkflowPushResponse
Constructor Details
#initialize(request_client:) ⇒ Vellum::WorkflowsClient
18 19 20 |
# File 'lib/vellum_ai/workflows/client.rb', line 18 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Vellum::RequestClient (readonly)
13 14 15 |
# File 'lib/vellum_ai/workflows/client.rb', line 13 def request_client @request_client end |
Instance Method Details
#pull(id:, exclude_code: nil, exclude_display: nil, include_json: nil, include_sandbox: nil, strict: nil, request_options: nil, &on_data) ⇒ Void
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/vellum_ai/workflows/client.rb', line 33 def pull(id:, exclude_code: nil, exclude_display: nil, include_json: nil, include_sandbox: nil, strict: nil, request_options: nil, &on_data) 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, "strict": strict }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(environment: Default, request_options: )}/v1/workflows/#{id}/pull" end end |
#push(exec_config:, workflow_sandbox_id: nil, deployment_config: nil, artifact: nil, dry_run: nil, strict: nil, request_options: nil) ⇒ Vellum::WorkflowPushResponse
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/vellum_ai/workflows/client.rb', line 67 def push(exec_config:, workflow_sandbox_id: nil, deployment_config: nil, artifact: nil, dry_run: nil, strict: 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 || {}), 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, dry_run: dry_run, strict: strict }.compact req.url "#{@request_client.get_url(environment: Default, request_options: )}/v1/workflows/push" end Vellum::WorkflowPushResponse.from_json(json_object: response.body) end |