Add agent-backed PubMed fact verifier#9
Open
mindbomber wants to merge 1 commit into
Open
Conversation
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
AgentFactVerifierthat retrieves PubMed abstracts and asks the configured LLM caller for a structured JSON verdict.FactVerifieras the fallback when no LLM caller is configured or the agent path fails.FactCheckConfig.use_agentand wires MedGuard so the agent verifier receives the configured LLM caller.Fixes #1.
Verification
python -m pytest tests\test_fact_check.py tests\test_pipeline.py -q-> 16 passedpython -m ruff check medguard\guardrails\fact_check.py medguard\knowledge\pubmed.py medguard\config.py medguard\core.py tests\test_fact_check.py-> passedpython -m compileall medguard\guardrails\fact_check.py medguard\knowledge\pubmed.py medguard\config.py medguard\core.py tests\test_fact_check.py-> passedgit diff --check-> clean apart from Windows LF/CRLF warningsAANA gate
acceptacceptScope note
The agent verifier is a source-grounding aid, not a medical or compliance authority. It only scores claims against retrieved PubMed abstracts and preserves fallback behavior when evidence or LLM output is unavailable.