tooluniverse.chem_tool module

class tooluniverse.chem_tool.ChEMBLTool[source]

Bases: BaseTool

Tool to search for molecules similar to a given compound name or SMILES using the ChEMBL Web Services API.

__init__(tool_config, base_url='https://www.ebi.ac.uk/chembl/api/data')[source]
run(arguments)[source]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

Parameters:
  • arguments (dict, optional) – Tool-specific arguments

  • stream_callback (callable, optional) – Callback for streaming responses

  • use_cache (bool, optional) – Whether result caching is enabled

  • validate (bool, optional) – Whether parameter validation was performed

Note

These additional parameters (stream_callback, use_cache, validate) are passed from run_one_function() to provide context about the execution. Tools can use these for optimization or special handling.

For backward compatibility, tools that don’t accept these parameters will still work - they will only receive the arguments parameter.

get_chembl_id_by_name(compound_name)[source]

Search ChEMBL for a compound by name and return the ChEMBL ID of the first match.

get_smiles_pref_name_by_chembl_id(query)[source]

Given a ChEMBL ID, return a dict with canonical SMILES and preferred name.

get_chembl_smiles_pref_name_id_by_name(compound_name)[source]

Search ChEMBL for a compound by name and return a list of dicts with ChEMBL ID, canonical SMILES, and preferred name for the top 5 matches.

_search_similar_molecules(query, similarity_threshold, max_results)[source]