class L::OpenAI

def embeddings(chunks)

and large distances suggest low relatedness.
numbers. The distance between two vectors measures their relatedness. Small distances suggest high relatedness
OpenAI’s text embeddings measure the relatedness of text strings. An embedding is a vector of floating point
def embeddings(chunks)
  responses = chunks.map do |chunk|
    response = client.embeddings(
      parameters: { model: settings[:model], dimensions: settings[:dimensions], input: chunk }
    )
    response.dig('data', 0, 'embedding')
  end
  responses.one? ? responses.first : responses
end