Class: RubyLLM::Providers::Voyage
- Inherits:
-
Provider
- Object
- Provider
- RubyLLM::Providers::Voyage
- Includes:
- Voyage::ContextualizedEmbeddings, Voyage::Embeddings, Voyage::Files, Voyage::Reranking
- Defined in:
- lib/ruby_llm/providers/voyage.rb,
lib/ruby_llm/providers/voyage/files.rb,
lib/ruby_llm/providers/voyage/reranking.rb,
lib/ruby_llm/providers/voyage/embeddings.rb,
lib/ruby_llm/providers/voyage/contextualized_embeddings.rb
Overview
Voyage retrieval API provider for RubyLLM.
Most applications should use RubyLLM.embed or
Voyage.embed instead of instantiating this class directly.
Defined Under Namespace
Modules: ContextualizedEmbeddings, Embeddings, Files, Reranking
Class Method Summary collapse
-
.assume_models_exist? ⇒ Boolean
Indicates that Voyage model IDs can be used without registry entries.
-
.configuration_options ⇒ Array<Symbol>
private
Lists configuration keys registered for the Voyage provider.
-
.configuration_requirements ⇒ Array<Symbol>
private
Lists configuration keys required to use the Voyage provider.
Instance Method Summary collapse
-
#api_base ⇒ String
Returns the configured Voyage API base URL.
-
#embed(text, model:, dimensions: nil, provider_options: {}, **options) ⇒ RubyLLM::Embedding
private
RubyLLM 1.x does not expose per-request provider options for embeddings, so the extension's facade calls this richer provider method directly.
-
#headers ⇒ Hash{String => String}
Returns authentication headers for Voyage requests.
Class Method Details
.assume_models_exist? ⇒ Boolean
Indicates that Voyage model IDs can be used without registry entries.
74 75 76 |
# File 'lib/ruby_llm/providers/voyage.rb', line 74 def assume_models_exist? true end |
.configuration_options ⇒ Array<Symbol>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Lists configuration keys registered for the Voyage provider.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ruby_llm/providers/voyage.rb', line 53 def %i[ voyage_api_key voyage_api_base voyage_default_input_type voyage_default_truncation voyage_default_output_dimension voyage_default_output_dtype voyage_default_encoding_format ] end |
.configuration_requirements ⇒ Array<Symbol>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Lists configuration keys required to use the Voyage provider.
68 69 70 |
# File 'lib/ruby_llm/providers/voyage.rb', line 68 def configuration_requirements %i[voyage_api_key] end |
Instance Method Details
#api_base ⇒ String
Returns the configured Voyage API base URL.
23 24 25 |
# File 'lib/ruby_llm/providers/voyage.rb', line 23 def api_base @config.voyage_api_base || 'https://api.voyageai.com/v1' end |
#embed(text, model:, dimensions: nil, provider_options: {}, **options) ⇒ RubyLLM::Embedding
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
RubyLLM 1.x does not expose per-request provider options for embeddings, so the extension's facade calls this richer provider method directly.
42 43 44 45 46 47 |
# File 'lib/ruby_llm/providers/voyage.rb', line 42 def (text, model:, dimensions: nil, provider_options: {}, **) payload = (text, model:, dimensions:, **) .merge(.transform_keys(&:to_sym)) response = @connection.post((model:), payload) (response, model:, text:, output_dtype: payload[:output_dtype]) end |
#headers ⇒ Hash{String => String}
Returns authentication headers for Voyage requests.
29 30 31 |
# File 'lib/ruby_llm/providers/voyage.rb', line 29 def headers { 'Authorization' => "Bearer #{@config.voyage_api_key}" } end |