Fix 5 bugs: PDF crash, unused env var, missing state field, hardcoded model, typo#260
Open
sanjibani wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Open
Conversation
- Fix UnboundLocalError crash in process_pdf_docs when PDF is corrupted: return empty list on PdfStreamError instead of referencing unassigned `documents` variable. - Honor FAISS_DB_PATH env var in FAISSVectorDatabase.get_db_path() instead of always using a hardcoded relative path. - Add missing `context_list` field to AgentState TypedDict so retriever tool output is no longer silently dropped. - Read GOOGLE_GEMINI env var in helpers.py instead of hardcoding gemini-2.0-flash, keeping model choice consistent with the main conversations endpoint. - Fix typo "avaiable" -> "available" in the summarise prompt template. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Fixes #259 — five bugs found during code review, all small and isolated.
process_pdf_docs()hitsUnboundLocalErrorwhen a corrupted PDF raisesPdfStreamError— the except block didn't return, sodocumentswas used unassigned. Now returns[].FAISS_DB_PATHwas defined in.env.examplebutget_db_path()always used a hardcoded path. Now reads the env var first, falls back to the computed path.context_listwas returned by retriever tool nodes but wasn't in theAgentStateTypedDict, so LangGraph silently dropped it. Added the field.helpers.pyhardcodedgemini-2.0-flashinstead of readingGOOGLE_GEMINIenv var like the main endpoint does. Now uses the same model mapping."avaiable"→"available"(plus grammar fix) in the main RAG prompt.Also updates
test_faiss_vectorstore.pyto test both the default path and the env var path.Test plan
FAISS_DB_PATH=/custom/path— vectorstore should use that pathGOOGLE_GEMINI=2.5_flash— helpers endpoint should use gemini-2.5-flash🤖 Generated with Claude Code