Class: Vellum::AsyncModelVersionsClient

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ AsyncModelVersionsClient

Parameters:



39
40
41
42
# File 'lib/vellum_ai/model_versions/client.rb', line 39

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

Instance Attribute Details

#request_clientObject (readonly)

Returns the value of attribute request_client.



35
36
37
# File 'lib/vellum_ai/model_versions/client.rb', line 35

def request_client
  @request_client
end

Instance Method Details

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

Deprecated. Use the ‘deployments/provider-payload` endpoint to fetch information that we send to Model providers.

Parameters:

  • id (String)

    A UUID string identifying this model version.

  • request_options (RequestOptions) (defaults to: nil)

Returns:



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/vellum_ai/model_versions/client.rb', line 49

def retrieve(id:, request_options: nil)
  Async do
    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/model-versions/#{id}"
    end
    ModelVersionRead.from_json(json_object: response.body)
  end
end