Class: RubyCanUseLLM::Providers::Voyage

Inherits:
Base
  • Object
show all
Defined in:
lib/rubycanusellm/providers/voyage.rb

Constant Summary collapse

API_URL =
"https://api.voyageai.com/v1/embeddings"

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from RubyCanUseLLM::Providers::Base

Instance Method Details

#chat(_messages, **_options) ⇒ Object

Raises:



11
12
13
# File 'lib/rubycanusellm/providers/voyage.rb', line 11

def chat(_messages, **_options)
  raise Error, "Voyage AI only supports embeddings, not chat completions"
end

#embed(text, **options) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/rubycanusellm/providers/voyage.rb', line 15

def embed(text, **options)
  body = {
    model: options[:model] || "voyage-3.5",
    input: text
  }
  response = embedding_request(body)
  parse_embedding(response)
end