feat: read repo list and model name from config files, defaulting to prior hardcoded behavior - #10
Merged
Merged
Conversation
…prior hardcoded behavior Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012RttwcxBgsnXH2TwQGQsrp
This was referenced Sep 1, 2026
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.
What
Wires two existing-but-unused config files into the code, with the current hardcoded behavior kept as the fallback in both cases. Designed to be functionally identical to today's behavior — nothing changes unless someone explicitly edits a config file.
scripts/build_index.pynow reads the repo list fromconfigs/repos.yaml(arepos:list of names) if the file exists, parses, and is non-empty. The old hardcoded 19-repo list is kept in place, unchanged, asHARDCODED_REPO_NAMES— used whenever the YAML is missing, empty, or fails to parse.requirements.txt: addedPyYAML==6.0.2, pinned to the version actually installed and working in this environment (checked viapip freeze, same pinning approach as PR chore: pin requirements.txt to known-working versions #9 — not guessed).rag/engine.py: the hardcoded"llama3"atollama_generate()'s default arg (was line 83) and instream_llm()'s payload dict (was line 274) now both read from a singleLLM_MODELmodule-level constant, resolved once at import via_load_llm_model(), which readsllm_model:fromconfigs/index_config.yaml. If the file is missing, empty, fails to parse, or doesn't setllm_model, it falls back to"llama3"— same pattern already used forOLLAMA_URLviaos.environ.get(..., default).configs/index_config.yaml(previously empty) now containsllm_model: llama3— i.e. today's value, made explicit and editable.This is designed to be a no-op today
Both
configs/repos.yamlandconfigs/index_config.yamlalready existed in the repo (the former already listed the same 19 repos in the same order; the latter was empty). This PR doesn't change their content in a way that alters behavior — it just makes the code actually read them, with fallbacks that reproduce the prior hardcoded behavior exactly.Repo-list before/after comparison
Ran
build_index.build_index()(withload_documentsmonkey-patched to just record repo paths instead of doing real I/O/embedding) twice:configs/repos.yamlpresent (its current, unmodified form): 19 repos resolved, in order.configs/repos.yamltemporarily renamed away (forcing the hardcoded fallback — confirmed by the⚠️ Could not read ... falling back to hardcoded repo listwarning firing): 19 repos resolved, in order.diffbetween the two captured lists: identical, byte-for-byte, all 19 repos, same order. The YAML was restored to its original location/content immediately after the test (git statusconfirms no stray changes).pytest results vs. 174-test baseline
Identical — no new failures, no new skips.
Manual
/rag/querytest1. Default config (
llm_model: llama3, i.e. unset/prior behavior): started the API for real (existing FAISS index, live Ollama), POSTed a real query:Confirms nothing broke relative to the pre-change baseline.
2. Override test: temporarily edited
configs/index_config.yamltollm_model: llama3.1:8b-instruct-q4_K_M(a different model actually loaded in this Ollama instance), confirmedrag.engine.LLM_MODELpicked it up at import (llama3.1:8b-instruct-q4_K_M), restarted the API, and queried:No crash, and the terse instruct-tuned response (vs. the more verbose base-model answer in test 1) confirms the override model was actually invoked, not silently ignored. Config reverted back to
llm_model: llama3before committing — the committed value reproduces prior behavior exactly.Scope
4 files touched:
configs/index_config.yaml,rag/engine.py,requirements.txt,scripts/build_index.py. No other files changed.Per instructions, this PR is not to be merged automatically — same as PR #9. Results reported above for review; merge only after explicit confirmation.