Langchain-Chatchat/libs/chatchat-server/chatchat/server/agent/tools_factory/arxiv.py

14 lines
491 B
Python
Raw Normal View History

2024-12-20 16:04:03 +08:00
# LangChain 的 ArxivQueryRun 工具
from chatchat.server.pydantic_v1 import Field
from .tools_registry import BaseToolOutput, regist_tool
2025-02-14 07:40:25 +08:00
# @regist_tool(title="ARXIV论文")
2024-12-20 16:04:03 +08:00
def arxiv(query: str = Field(description="The search query title")):
"""A wrapper around Arxiv.org for searching and retrieving scientific articles in various fields."""
from langchain.tools.arxiv.tool import ArxivQueryRun
tool = ArxivQueryRun()
return BaseToolOutput(tool.run(tool_input=query))