Fix local LLM development setup: env loading, vector dimensions, and gitignore#44
Open
androemeda wants to merge 1 commit intovirtualcell:mainfrom
Open
Fix local LLM development setup: env loading, vector dimensions, and gitignore#44androemeda wants to merge 1 commit intovirtualcell:mainfrom
androemeda wants to merge 1 commit intovirtualcell:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #43
Summary
Fixes issues that prevent the backend from running correctly when using the local LLM setup (Ollama) as described in
SETUP.md.Changes
1.
backend/app/core/config.pyProblem
Settings(BaseSettings)does not load the.envfile when running the backend directly with:It only reads from OS environment variables, which works with Docker Compose (via
env_file:) but fails during local development.Fix
Added:
so Pydantic automatically loads variables from the
.envfile.2.
backend/app/services/knowledge_base_service.pyProblem
The Qdrant collection is hardcoded with:
This matches Azure OpenAI’s
text-embedding-ada-002, butnomic-embed-text(recommended inSETUP.mdfor local use) produces 768-dimensional vectors.This causes the following error when uploading PDFs:
Fix
Set
vector_sizedynamically based on thePROVIDERsetting:nomic-embed-text)text-embedding-ada-002)3.
.gitignoreProblem
The
qdrant_storage/directory (created when running Qdrant with a local volume mount as described inSETUP.md) is not ignored and may accidentally be committed.Fix
Added:
to
.gitignore.Before
PROVIDER=local.envvariables are not loaded when running withuvicornqdrant_storage/files can accidentally be committedAfter
.envSETUP.mdnomic-embed-textembeddingsTesting
/kb/upload-pdfworks withnomic-embed-textembeddings (768 dimensions)/biomodelendpoint returns data correctlyNotes for Reviewers
The vector dimension logic assumes:
768for local embeddings (nomic-embed-text)1536for Azure embeddings (text-embedding-ada-002)If additional embedding providers are added in the future, this logic may need to be extended.
Happy to make any changes if needed. Thanks for reviewing!