File size: 825 Bytes
64e9ead
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# -*- coding: utf-8 -*-
"""

Created on Thu Nov  7 15:38:35 2024



@author: BM109X32G-10GPU-02

"""

from DECIMER import predict_SMILES
from langchain.tools import BaseTool

class graphconverter(BaseTool):
    name: str = "graphconverter"
    description: str = (
        "Input graph path , returns SMILES."
        "It was used to convert graph/figure/image containing molecule to SMILES"
    )
    def __init__(self):
        super().__init__()
       
    def _run(self, paths: str) -> str:
        
        try:
            SMILES = predict_SMILES(paths)
        except:
            return 'Please recheck the graph path'
        return SMILES
 
    async def _arun(self, smiles: str) -> str:
        """Use the tool asynchronously."""
        raise NotImplementedError()