File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed
lib/langchainrb_rails/generators/langchainrb_rails Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,15 @@ class BaseGenerator < Rails::Generators::Base
1919 "openai" => "Langchain::LLM::OpenAI" ,
2020 "replicate" => "Langchain::LLM::Replicate"
2121 }
22+
23+ def post_install_message
24+ say "Please do the following to start Q&A with your #{ model_name } records:" , :green
25+ say "1. Run `bundle install` to install the new gems."
26+ say "2. Set an environment variable ENV['#{ llm . upcase } _API_KEY'] for your #{ llm_class } ."
27+ say "3. Run `rails db:migrate` to apply the database migrations to enable pgvector and add the embedding column."
28+ say "4. In Rails console, run `#{ model_name } .embed!` to set the embeddings for all records."
29+ say "5. Ask a question in the Rails console, ie: `#{ model_name } .ask('[YOUR QUESTION]')`"
30+ end
2231 end
2332 end
2433end
Original file line number Diff line number Diff line change @@ -35,15 +35,6 @@ def add_to_gemfile
3535 gem "ruby-openai"
3636 end
3737
38- def post_install_message
39- say "Please do the following to start Q&A with your #{ model_name } records:" , :green
40- say "1. Run `bundle install` to install the new gems."
41- say "2. Set `OPENAI_API_KEY` environment variable to your OpenAI API key."
42- say "3. Run `rails db:migrate` to apply the database migrations to enable pgvector and add the embedding column."
43- say "4. In Rails console, run `#{ model_name } .embed!` to set the embeddings for all records."
44- say "5. Ask a question in the Rails console, ie: `#{ model_name } .ask('[YOUR QUESTION]')`"
45- end
46-
4738 private
4839
4940 # @return [String] Name of the model
Original file line number Diff line number Diff line change 22
33LangchainrbRails.configure do |config|
44 config.vectorsearch = Langchain::Vectorsearch::Pgvector.new(
5- llm: <%= llm_class %>.new(api_key: ENV["OPENAI_API_KEY "])
5+ llm: <%= llm_class %>.new(api_key: ENV["<%= llm.upcase %>_API_KEY "])
66 )
77end
You can’t perform that action at this time.
0 commit comments