-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何在自己定义的role引入自己编写的tool? #1646
Comments
可以继承DataInterpreter,然后tools传入你的工具 |
但是DataInterpreter的一些功能我不需要,并且写了新的提示词后还是会执行一些我不需要的步骤,所以怎样自己创建一个新的role然后可以使用tools |
DI的用法有示例:https://github.com/geekan/MetaGPT/blob/main/examples/di/crawl_webpage.py
di = DataInterpreter(tools=["scrape_web_playwright"])
@register_tool(tags=["web scraping", "web"])
async def scrape_web_playwright(url: str):
"""
Asynchronously Scrape and save the HTML structure and inner text content of a web page using Playwright.
Args:
url (str): The main URL to fetch inner text from.
Returns:
dict: The inner text content and html structure of the web page, keys are 'inner_text', 'html'.
"""
...... 如果还要更进一步的改造,DI的调用模式是: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
官方示例docs中用写好的DataInterpreter这个role进行tool的使用,但是我想自己创建一个class role来使用自定义的tool,要如何做呢
The text was updated successfully, but these errors were encountered: