Class: Vellum::DeploymentsClient
- Inherits:
-
Object
- Object
- Vellum::DeploymentsClient
- Defined in:
- lib/vellum_ai/deployments/client.rb
Instance Attribute Summary collapse
-
#request_client ⇒ Object
readonly
Returns the value of attribute request_client.
Instance Method Summary collapse
- #initialize(request_client:) ⇒ DeploymentsClient constructor
- #list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) ⇒ PaginatedSlimDeploymentReadList
-
#retrieve(id:, request_options: nil) ⇒ DeploymentRead
Used to retrieve a deployment given its ID or name.
- #retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, release_tag: nil, request_options: nil) ⇒ DeploymentProviderPayloadResponse
Constructor Details
#initialize(request_client:) ⇒ DeploymentsClient
17 18 19 20 |
# File 'lib/vellum_ai/deployments/client.rb', line 17 def initialize(request_client:) # @type [RequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
13 14 15 |
# File 'lib/vellum_ai/deployments/client.rb', line 13 def request_client @request_client end |
Instance Method Details
#list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) ⇒ PaginatedSlimDeploymentReadList
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vellum_ai/deployments/client.rb', line 28 def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X_API_KEY"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "limit": limit, "offset": offset, "ordering": ordering, "status": status }.compact req.url "#{@request_client.default_environment[:Default]}/v1/deployments" end PaginatedSlimDeploymentReadList.from_json(json_object: response.body) end |
#retrieve(id:, request_options: nil) ⇒ DeploymentRead
Used to retrieve a deployment given its ID or name.
50 51 52 53 54 55 56 57 58 |
# File 'lib/vellum_ai/deployments/client.rb', line 50 def retrieve(id:, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X_API_KEY"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.url "#{@request_client.default_environment[:Default]}/v1/deployments/#{id}" end DeploymentRead.from_json(json_object: response.body) end |
#retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, release_tag: nil, request_options: nil) ⇒ DeploymentProviderPayloadResponse
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/vellum_ai/deployments/client.rb', line 66 def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, release_tag: nil, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X_API_KEY"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), deployment_id: deployment_id, deployment_name: deployment_name, inputs: inputs, release_tag: release_tag }.compact req.url "#{@request_client.default_environment[:Default]}/v1/deployments/provider-payload" end DeploymentProviderPayloadResponse.from_json(json_object: response.body) end |