BioThings / SmartAPI KPClient tool#277
Open
ahueb wants to merge 10 commits intosnap-stanford:mainfrom
Open
Conversation
Add new tool to query the MyGene.info database using the biothings-client package. Supports querying by Entrez gene IDs to get annotations, or by gene symbols to find gene IDs. Includes support for efficient batch queries. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
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
The Knowledge Provider (KP) tool provides unified access to BioThings Translator / SmartAPI-backed data sources through
KPClient(biomni/tool/kp_tool.py).This PR adds the KPClient tool so the agent can retrieve KG and provider-backed biomedical data (TRAPI + BioThings) through one interface.
Changes Made
Added
biomni/tool/kp_tool.pycontaining theKPClientclass and KP surface functions inbiomni/tool/database.pyand their descriptions inbiomni/tool/tool_description/database.py:ensure_freshlist_kpsdescribe_kpquery_kpbatch_query_kpscroll_kpKP is selected when prompts request data from sources it covers (Reactome, STRING, DGIdb, DrugCentral, MyGene/MyVariant/MyChem/MyDisease, GO/HPO/Mondo/DOID/UBERON, ARAX/BTE/MolePro/SPOKE/COHD/mediKanren/RTX KG2).
Future improvements
Tool choice is LLM-mediated, a future improvement would be an execution-time guardrail that enforces at least one
query_kp/batch_query_kpcall whenever requested data is in KP-covered sources.Testing
✅ Selection testing across the prompt set all passed