liunux4odoo 9818bd2a88
- 重写 tool 部分: (#3553)
- 简化 tool 的定义方式
    - 所有 tool 和 tool_config 支持热加载
    - 修复:json_schema_extra warning
2024-03-28 13:08:51 +08:00

11 lines
367 B
Python

from chatchat.server.pydantic_v1 import Field
from .tools_registry import regist_tool
@regist_tool
def search_youtube(query: str = Field(description="Query for Videos search")):
'''use this tools_factory to search youtube videos'''
from langchain_community.tools import YouTubeSearchTool
tool = YouTubeSearchTool()
return tool.run(tool_input=query)