tooluniverse.chem_tool 模块¶
ChEMBL API Tools
This module provides tools for accessing the ChEMBL database: - ChEMBLTool: Specialized tool for similarity search - ChEMBLRESTTool: Generic REST API tool for ChEMBL endpoints
- class tooluniverse.chem_tool.ChEMBLRESTTool[源代码]¶
基类:
BaseToolGeneric ChEMBL REST API tool. Wrapper for ChEMBL API endpoints defined in chembl_tools.json. Supports all ChEMBL data resources: molecules, targets, assays, activities, drugs, etc.
- _lookup_chembl_id_by_name(drug_name)[源代码]¶
Look up a ChEMBL molecule ID by preferred name (case-insensitive).
Feature-79B-001: Uses icontains first (most reliable), then iexact as fallback. The iexact and search endpoints frequently timeout for newer drugs. Returns the ChEMBL ID of the first matching molecule, or None.
- class tooluniverse.chem_tool.ChEMBLTool[源代码]¶
基类:
BaseTool使用 ChEMBL Web Services API,根据给定的化合物名称或 SMILES 搜索相似分子的工具。
Note: This tool is designed for small molecule compounds only. Biologics (antibodies, proteins, oligonucleotides, etc.) do not have SMILES structures and cannot be used for structure-based similarity search. The tool will provide detailed error messages when biologics are queried, explaining the reason and suggesting alternative tools.
- run(arguments)[源代码]¶
执行该工具。
默认的 BaseTool 实现接受一个可选的参数映射,以符合大多数具体工具实现所期望的输入字典。
- 参数:
arguments (
dict, optional) – 工具专用参数stream_callback (
callable, optional) – 用于流式响应的回调use_cache (
bool, optional) – 是否启用了结果缓存validate (
bool, optional) – 是否已执行参数验证
备注
这些附加参数(stream_callback、use_cache、validate)从 run_one_function() 传递,用于提供有关执行的上下文。工具可以利用这些参数进行优化或特殊处理。
为了向后兼容,不接受这些参数的工具仍然可以正常运行——它们只会接收到 arguments 参数。