tooluniverse.dataset_tool 模块

class tooluniverse.dataset_tool.DatasetTool[源代码]

基类:BaseTool

用于搜索和筛选DrugBank词汇数据集的工具。提供按名称、ID、同义词搜索药物及按多种条件筛选的功能。

__init__(tool_config)[源代码]
_load_dataset()[源代码]

加载 drugbank 词汇表 CSV 数据集。

run(arguments)[源代码]

工具的主要入口点。

通过名称、ID、同义词或其他字段使用基于文本的查询搜索药物。

此功能专用于在指定字段中进行基于文本的搜索。它根据用户偏好执行子字符串匹配或精确匹配。

参数:

arguments (dict) – 搜索参数包括: - query (str):搜索文本 - search_fields (list):搜索字段 - case_sensitive (bool):是否区分大小写 - exact_match (bool):是否进行精确匹配 - limit (int):最大结果数量

返回值

dict: Search results with matched records and metadata

_drugbank_filter(arguments)[源代码]

根据特定条件和字段条件筛选药物。

此功能专用于基于条件的筛选,使用简单的字段-条件-值参数。支持的筛选类型包括:包含(contains)、以…开头(starts_with)、以…结尾(ends_with)、精确匹配(exact)、非空(not_empty)。

参数:

arguments (dict) – 过滤参数包括: - field (str):用于过滤的字段名称 - condition (str):条件类型(包含 contains、以…开头 starts_with、以…结尾 ends_with、精确匹配 exact、非空 not_empty) - value (str):用于过滤的值(对于非空 not_empty 条件可选) - limit (int):结果的最大数量

返回值

dict: Filtered results with matched records and applied filters

get_dataset_info()[源代码]

获取有关已加载数据集的信息。