Class: Vellum::WorkflowDeploymentsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/workflow_deployments/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ WorkflowDeploymentsClient

Parameters:



15
16
17
18
# File 'lib/vellum_ai/workflow_deployments/client.rb', line 15

def initialize(request_client:)
  # @type [RequestClient]
  @request_client = request_client
end

Instance Attribute Details

#request_clientObject (readonly)

Returns the value of attribute request_client.



11
12
13
# File 'lib/vellum_ai/workflow_deployments/client.rb', line 11

def request_client
  @request_client
end

Instance Method Details

#list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) ⇒ PaginatedSlimWorkflowDeploymentList

Parameters:

  • limit (Integer) (defaults to: nil)

    Number of results to return per page.

  • offset (Integer) (defaults to: nil)

    The initial index from which to return the results.

  • ordering (String) (defaults to: nil)

    Which field to use when ordering the results.

  • status (WORKFLOW_DEPLOYMENTS_LIST_REQUEST_STATUS) (defaults to: nil)

    status

  • request_options (RequestOptions) (defaults to: nil)

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/vellum_ai/workflow_deployments/client.rb', line 26

def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "limit": limit,
      "offset": offset,
      "ordering": ordering,
      "status": status
    }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/workflow-deployments"
  end
  PaginatedSlimWorkflowDeploymentList.from_json(json_object: response.body)
end

#retrieve(id:, request_options: nil) ⇒ WorkflowDeploymentRead

Used to retrieve a workflow deployment given its ID or name.

Parameters:

  • id (String)

    Either the Workflow Deployment’s ID or its unique name

  • request_options (RequestOptions) (defaults to: nil)

Returns:



48
49
50
51
52
53
54
55
56
# File 'lib/vellum_ai/workflow_deployments/client.rb', line 48

def retrieve(id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/workflow-deployments/#{id}"
  end
  WorkflowDeploymentRead.from_json(json_object: response.body)
end