chaskiq / plain

100 stars 4 forks source link

`rails plain:load` error #1

Closed erikjenks closed 1 year ago

erikjenks commented 1 year ago

I saw the post on reddit about this project and I wanted to try it out, but I'm running into issues setting it up in my project.

Environment Information:

When trying to run rails plain:load is see the following error:

➜ rails plain:load

loading contents of the project
/Users/Erik/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/bundler/gems/plain-e1cab4e39570/app/services/plain/ai_docs.rb:28: warning: already initialized constant Langchain::Processors::JSON::EXTENSIONS
/Users/Erik/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/langchainrb-0.6.12/lib/langchain/processors/json.rb:6: warning: previous definition of EXTENSIONS was here
/Users/Erik/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/bundler/gems/plain-e1cab4e39570/app/services/plain/ai_docs.rb:29: warning: already initialized constant Langchain::Processors::JSON::CONTENT_TYPES
/Users/Erik/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/langchainrb-0.6.12/lib/langchain/processors/json.rb:7: warning: previous definition of CONTENT_TYPES was here
rails aborted!
LoadError: Could not load ruby-openai. Please ensure that the ruby-openai gem is installed.

What's strange is the LoadError: Could not load ruby-openai. Please ensure that the ruby-openai gem is installed.. I tried installing the ruby-openai gem globally as well to see if that was the issue, but still received the error you see above.

michelson commented 1 year ago

Hi there, please try to add this two gems to your gemfile:

gem "ruby-openai", "~> 4.2"
gem "qdrant-ruby", "~> 0.9.2"
erikjenks commented 1 year ago

Thank you. I was able to execute the rails plain:load command with the warnings:

/Users/Erik/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/bundler/gems/plain-e1cab4e39570/app/services/plain/ai_docs.rb:28: warning: already initialized constant Langchain::Processors::JSON::EXTENSIONS
/Users/Erik/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/langchainrb-0.6.12/lib/langchain/processors/json.rb:6: warning: previous definition of EXTENSIONS was here
/Users/Erik/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/bundler/gems/plain-e1cab4e39570/app/services/plain/ai_docs.rb:29: warning: already initialized constant Langchain::Processors::JSON::CONTENT_TYPES
/Users/Erik/.asdf/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/langchainrb-0.6.12/lib/langchain/processors/json.rb:7: warning: previous definition of CONTENT_TYPES was here

Thanks!

michelson commented 1 year ago

I have already proposed some solution to the depends_on https://github.com/andreibondarev/langchainrb/issues/296