Class: Asimov::ApiV1::Embeddings

Inherits:
Base
  • Object
show all
Defined in:
lib/asimov/api_v1/embeddings.rb

Overview

Class interface for API methods in the “/embeddings” URI subspace.

Instance Method Summary collapse

Methods inherited from Base

#initialize, #rest_create_w_json_params, #rest_create_w_multipart_params, #rest_delete, #rest_get, #rest_get_streamed_download, #rest_index

Constructor Details

This class inherits a constructor from Asimov::ApiV1::Base

Instance Method Details

#create(model:, input:, parameters: {}) ⇒ Object

Creates an embedding resource with the specified parameters.

provided to inform embedding creation.

Parameters:

  • model (String)

    the id for the model used to create the embedding

  • parameters (String) (defaults to: {})

    the (optional) additional parameters being

  • parameters (Hash) (defaults to: {})

    the set of parameters being passed to the API

Raises:



15
16
17
18
19
20
21
22
23
# File 'lib/asimov/api_v1/embeddings.rb', line 15

def create(model:, input:, parameters: {})
  raise MissingRequiredParameterError.new(:model) unless model
  raise MissingRequiredParameterError.new(:input) unless input

  rest_create_w_json_params(resource: "embeddings",
                            parameters: parameters.merge({
                                                           model: model, input: input
                                                         }))
end