sanitize error messages in API responses and LLM prompts - #4
Open
thierrypdamiba wants to merge 67 commits into
Open
sanitize error messages in API responses and LLM prompts#4thierrypdamiba wants to merge 67 commits into
thierrypdamiba wants to merge 67 commits into
Conversation
Add hybrid search, qdrant cloud inference, quantization, and re-ranking models
fixed inference for MRL
Diversify data pipeline to ~30k papers
…3 results from Qdrant, logging tool args
Qdrant tools for agent
Improvements
- Gene API: Chunk requests to 500 IDs with 0.35s delay between batches - Qdrant: Exponential backoff retry (2s -> 32s) with max 5 retries
Frontend now at: github.com/thierrypdamiba/biomedical-graphrag-frontend
- Modified run_tools_sequence_and_summarize to return GraphRAGResult dataclass with summary, qdrant_results, and neo4j_results - Updated server.py to format and return actual search results - Added detailed trace steps for each phase (Qdrant, Neo4j, Fusion) - Results now include both Qdrant and Neo4j data for frontend display
- TraceStep now only contains tool name (no timing) - GraphRAGResult includes trace with tool executions - Limit Qdrant results to 5 - Remove latency/timing from response metadata
- Fix Results tab showing "Untitled" by extracting nested payload data - Add arguments field to ToolExecution and TraceStep for trace visibility - Rename /api/search to /api/graphrag-query - Pass user's limit to Qdrant search, force top_k setting - Limit Neo4j tools to max 2 calls to reduce excessive calls - Change default top_k from 3 to 5 in Qdrant methods - Rename "Biomedical GraphRAG" to "PubMed Navigator" in API
Convert author objects to strings in the API response instead of passing raw dicts from the database payload.
- Extract structured entities (PMIDs, authors, MeSH, genes) from Qdrant - Auto-inject exclude_pmids to filter already-retrieved papers - Score authors by topic-relevant paper count for better tool selection - Convert Cypher queries to parameterized $param syntax - Structured prompt with entity lists instead of raw stringified results
- Remove _batch_link_pubmed and random/Entrez imports from gene_data_collector - Remove link_pubmed from gene_api_client - Remove commented-out semaphore from base.py - Remove commented CitationNetwork code from qdrant_vectorstore - Remove stale TODO/TBD comments from prompts and tool_calling - Remove get_collaborating_institutions from neo4j_query
Simplify backend and add structured responses
- Add API server tests (health endpoint, request validation, response models) - Add domain model tests (GeneRecord, CitationNetwork, Dataset models) - Enable GitHub Actions CI with ruff lint, mypy type check, and pytest - Add httpx test dependency for FastAPI TestClient
rename qdrant_db to qdrant_engine, remove unused query_vectorstore_service
add unit tests and CI
fix MRL dimensions option key, resolved conflict with #13
merge backend-simplify into main
fix graph insights ignored when partial neo4j results
…rompt * stop excluding qdrant-retrieved pmids from collaborator search since the goal is finding people, not new papers * tell the LLM to report empty tool results instead of hiding them * revert the neo4j result filtering so all tool outputs reach the summarizer
fix collaborator query returning 0 due to exclude_pmids
Raw exception strings were being passed to HTTP 500 responses and into the fusion summarization prompt, potentially leaking connection URIs, credentials, or internal stack traces. Errors now return generic messages to clients and the LLM, while full tracebacks are logged server-side via exc_info=True.
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.
Raw exception strings were being passed to HTTP 500 responses and into the fusion summarization prompt, potentially leaking connection URIs, credentials, or internal stack traces.
Fix: errors now return generic messages to clients and the LLM. Full tracebacks are logged server-side via
exc_info=True.Three locations fixed:
tool_calling.py: Neo4j tool errors no longer leakstr(e)intoresults[name]server.py:/api/graphrag-query500 responseserver.py:/api/neo4j-stats500 response