When trying to deploy with Docker, the precompile step seems to initialize the application and it's calling the initializer, which if you're setting the key using the ENV hash, it will raise an exception.
I'm putting a check around it, but maybe that's not the best option?
if key = ENV["OPENAI_API_KEY"]
LangchainrbRails.configure do |config|
config.vectorsearch = Langchain::Vectorsearch::Pgvector.new(
llm: Langchain::LLM::OpenAI.new(api_key: key)
)
end
end
@chalmagean We can try using dotenv and Dotenv.require_keys("OPENAI_API_KEY") but .env is not necessarily the only way people will be setting env vars.
When trying to deploy with Docker, the precompile step seems to initialize the application and it's calling the initializer, which if you're setting the key using the ENV hash, it will raise an exception.
I'm putting a check around it, but maybe that's not the best option?