Class: Vellum::WorkflowsClient
- Inherits:
-
Object
- Object
- Vellum::WorkflowsClient
- 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::WorkflowsClient 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::WorkflowsClient
29 30 31 |
# File 'lib/vellum_ai/workflows/client.rb', line 29 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Vellum::RequestClient (readonly)
24 25 26 |
# File 'lib/vellum_ai/workflows/client.rb', line 24 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")
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/vellum_ai/workflows/client.rb', line 118 def execute_node(files:, node:, inputs: 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 || {}), files: files, node: node, inputs: inputs }.compact req.url "#{@request_client.get_url(environment: Default, request_options: )}/v1/workflows/execute-node" end Vellum::WorkflowSandboxExecuteNodeResponse.from_json(json_object: response.body) 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
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/vellum_ai/workflows/client.rb', line 47 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) 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: )}/v1/workflows/#{id}/pull" 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
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/vellum_ai/workflows/client.rb', line 198 def push(exec_config: nil, workflow_sandbox_id: nil, deployment_config: nil, artifact: nil, dataset: 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, dataset: dataset, 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 |
#retrieve_state(span_id:, request_options: nil) ⇒ Object
api.workflows.retrieve_state(span_id: "span_id")
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/vellum_ai/workflows/client.rb', line 82 def retrieve_state(span_id:, request_options: nil) 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: )}/v1/workflows/#{span_id}/state" end Vellum::WorkflowResolvedState.from_json(json_object: response.body) 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" })
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/vellum_ai/workflows/client.rb', line 247 def serialize_workflow_files(files:, module_: nil, runner_config: nil, type_checker: 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 || {}), files: files, module: module_, runner_config: runner_config, type_checker: type_checker }.compact req.url "#{@request_client.get_url(environment: Default, request_options: )}/v1/workflows/serialize" end parsed_json = JSON.parse(response.body) parsed_json end |
#workflow_execution_status(execution_id:, request_options: nil) ⇒ Object
api.workflows.workflow_execution_status(execution_id: "execution_id")
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/vellum_ai/workflows/client.rb', line 154 def workflow_execution_status(execution_id:, request_options: nil) 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: )}/v1/workflows/executions/#{execution_id}/status" end Vellum::CheckWorkflowExecutionStatusResponse.from_json(json_object: response.body) end |