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

#http_delete, #http_get, #http_streamed_download, #initialize, #json_post, #multipart_post

Constructor Details

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

Instance Method Details

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

Calls the /embeddings POST endpoint with the specified parameters.

Parameters:

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

    the set of parameters being passed to the API

Raises:



12
13
14
15
16
17
# File 'lib/asimov/api_v1/embeddings.rb', line 12

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

  json_post(path: "/embeddings", parameters: parameters.merge({ model: model, input: input }))
end