Skip to content

sanitize error messages in API responses and LLM prompts - #4

Open
thierrypdamiba wants to merge 67 commits into
benitomartin:mainfrom
qdrant-labs:fix/sanitize-neo4j-errors
Open

sanitize error messages in API responses and LLM prompts#4
thierrypdamiba wants to merge 67 commits into
benitomartin:mainfrom
qdrant-labs:fix/sanitize-neo4j-errors

Conversation

@thierrypdamiba

Copy link
Copy Markdown

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 leak str(e) into results[name]
  • server.py: /api/graphrag-query 500 response
  • server.py: /api/neo4j-stats 500 response

mrscoopers and others added 30 commits January 16, 2026 17:24
Add hybrid search, qdrant cloud inference, quantization, and re-ranking models
Diversify data pipeline to ~30k papers
- 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
thierrypdamiba and others added 30 commits January 28, 2026 08:49
- 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
fix MRL dimensions option key, resolved conflict with #13
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.
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.

2 participants