Skip to content

Missing API KEY when using Docker #61

@chalmagean

Description

@chalmagean

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions