Skip to content

feat: read repo list and model name from config files, defaulting to prior hardcoded behavior - #10

Merged
man4ish merged 1 commit into
mainfrom
feat/wire-configs-into-build-index
Sep 1, 2026
Merged

feat: read repo list and model name from config files, defaulting to prior hardcoded behavior#10
man4ish merged 1 commit into
mainfrom
feat/wire-configs-into-build-index

Conversation

@man4ish

@man4ish man4ish commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

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.

  1. scripts/build_index.py now reads the repo list from configs/repos.yaml (a repos: list of names) if the file exists, parses, and is non-empty. The old hardcoded 19-repo list is kept in place, unchanged, as HARDCODED_REPO_NAMES — used whenever the YAML is missing, empty, or fails to parse.
  2. requirements.txt: added PyYAML==6.0.2, pinned to the version actually installed and working in this environment (checked via pip freeze, same pinning approach as PR chore: pin requirements.txt to known-working versions #9 — not guessed).
  3. rag/engine.py: the hardcoded "llama3" at ollama_generate()'s default arg (was line 83) and in stream_llm()'s payload dict (was line 274) now both read from a single LLM_MODEL module-level constant, resolved once at import via _load_llm_model(), which reads llm_model: from configs/index_config.yaml. If the file is missing, empty, fails to parse, or doesn't set llm_model, it falls back to "llama3" — same pattern already used for OLLAMA_URL via os.environ.get(..., default).
  4. configs/index_config.yaml (previously empty) now contains llm_model: llama3 — i.e. today's value, made explicit and editable.

This is designed to be a no-op today

Both configs/repos.yaml and configs/index_config.yaml already 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() (with load_documents monkey-patched to just record repo paths instead of doing real I/O/embedding) twice:

  • With configs/repos.yaml present (its current, unmodified form): 19 repos resolved, in order.
  • With configs/repos.yaml temporarily renamed away (forcing the hardcoded fallback — confirmed by the ⚠️ Could not read ... falling back to hardcoded repo list warning firing): 19 repos resolved, in order.

diff between 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 status confirms no stray changes).

pytest results vs. 174-test baseline

  • Baseline (this session, prior to any change): 174 passed
  • After this change: 174 passed

Identical — no new failures, no new skips.

Manual /rag/query test

1. Default config (llm_model: llama3, i.e. unset/prior behavior): started the API for real (existing FAISS index, live Ollama), POSTed a real query:

POST /rag/query {"query": "What model does the streaming endpoint use for generation?"}
→ HTTP 200, full grounded answer + 5 sources, context_used: 5

Confirms nothing broke relative to the pre-change baseline.

2. Override test: temporarily edited configs/index_config.yaml to llm_model: llama3.1:8b-instruct-q4_K_M (a different model actually loaded in this Ollama instance), confirmed rag.engine.LLM_MODEL picked it up at import (llama3.1:8b-instruct-q4_K_M), restarted the API, and queried:

POST /rag/query {"query": "Say the word BANANA and nothing else."}
→ HTTP 200, answer: "BANANA."

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: llama3 before 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.

⚠️ Do not auto-merge

Per instructions, this PR is not to be merged automatically — same as PR #9. Results reported above for review; merge only after explicit confirmation.

…prior hardcoded behavior

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012RttwcxBgsnXH2TwQGQsrp
@man4ish
man4ish merged commit 8c3eb81 into main Sep 1, 2026
1 check failed
@man4ish
man4ish deleted the feat/wire-configs-into-build-index branch September 1, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant