Class: RerankerRuby::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/reranker_ruby/generators/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializer_file ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/reranker_ruby/generators/install_generator.rb', line 10

def create_initializer_file
  create_file "config/initializers/reranker_ruby.rb", <<~RUBY
    # frozen_string_literal: true

    RerankerRuby.configure do |config|
      # Choose your reranking provider: :cohere, :jina, or :onnx
      config.default_provider = :cohere

      # API keys (use credentials or environment variables)
      config.cohere_api_key = ENV["COHERE_API_KEY"]
      # config.jina_api_key = ENV["JINA_API_KEY"]

      # Default number of top results to return
      config.default_top_k = 10

      # Optional: specify a model
      # config.default_model = "rerank-v3.5"

      # Optional: enable caching (:memory or :redis)
      # config.cache_store = :memory
      # config.cache_ttl = 3600

      # Optional: ONNX local model settings
      # config.default_provider = :onnx
      # config.onnx_model = "cross-encoder/ms-marco-MiniLM-L-6-v2"
    end
  RUBY
end