from langchain_openai import ChatOpenAI from browser_use import Agent import asyncio from dotenv import load_dotenv load_dotenv() from langchain.tools import BaseTool class SMILES2Weight(BaseTool): name: str = "webuse" description: str = ("Calling the browser to search for information " "input query, return the searching results") def __init__( self, ): super().__init__() async def _run(self, task: str) -> str: agent = Agent( task="Go to Reddit, search for 'browser-use', click on the first post and return the first comment.", llm = ChatOpenAI(model="gpt-4o-2024-11-20",api_key='sk-itPrztYm9F6XZZpsBMJB9O7Vq0pYUABVVBSoThuBxEGTnDik', base_url="https://www.dmxapi.com/v1"), ) result = await agent.run() return result async def _arun(self, smiles: str) -> str: """Use the tool asynchronously.""" raise NotImplementedError()