Class: Vellum::AsyncDeploymentsClient
- Inherits:
-
Object
- Object
- Vellum::AsyncDeploymentsClient
- 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:) ⇒ AsyncDeploymentsClient 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:) ⇒ AsyncDeploymentsClient
90 91 92 93 |
# File 'lib/vellum_ai/deployments/client.rb', line 90 def initialize(request_client:) # @type [AsyncRequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
86 87 88 |
# File 'lib/vellum_ai/deployments/client.rb', line 86 def request_client @request_client end |
Instance Method Details
#list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) ⇒ PaginatedSlimDeploymentReadList
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/vellum_ai/deployments/client.rb', line 101 def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) Async do 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 end |
#retrieve(id:, request_options: nil) ⇒ DeploymentRead
Used to retrieve a deployment given its ID or name.
125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/vellum_ai/deployments/client.rb', line 125 def retrieve(id:, request_options: nil) Async do 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 end |
#retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, release_tag: nil, request_options: nil) ⇒ DeploymentProviderPayloadResponse
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/vellum_ai/deployments/client.rb', line 143 def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, release_tag: nil, request_options: nil) Async do 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 end |