Class: LangchainrbRails::Generators::BaseGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/langchainrb_rails/generators/langchainrb_rails/base_generator.rb

Constant Summary collapse

LLMS =

Available LLM providers to be passed in as –llm option

{
  "cohere" => "Langchain::LLM::Cohere",
  "google_palm" => "Langchain::LLM::GooglePalm",
  "hugging_face" => "Langchain::LLM::HuggingFace",
  "llama_cpp" => "Langchain::LLM::LlamaCpp",
  "ollama" => "Langchain::LLM::Ollama",
  "openai" => "Langchain::LLM::OpenAI",
  "replicate" => "Langchain::LLM::Replicate"
}

Instance Method Summary collapse

Instance Method Details

#post_install_messageObject



23
24
25
26
27
28
29
30
# File 'lib/langchainrb_rails/generators/langchainrb_rails/base_generator.rb', line 23

def post_install_message
  say "Please do the following to start Q&A with your #{model_name} records:", :green
  say "1. Run `bundle install` to install the new gems."
  say "2. Set an environment variable ENV['#{llm.upcase}_API_KEY'] for your #{llm_class}."
  say "3. Run `rails db:migrate` to apply the database migrations to enable pgvector and add the embedding column."
  say "4. In Rails console, run `#{model_name}.embed!` to set the embeddings for all records."
  say "5. Ask a question in the Rails console, ie: `#{model_name}.ask('[YOUR QUESTION]')`"
end