From 6b28cbe05879c0ea0aa2b349bf367c44a41e4486 Mon Sep 17 00:00:00 2001 From: leo-gan Date: Tue, 25 Apr 2023 08:09:17 -0700 Subject: [PATCH] improved arxiv (#3495) Improved `arxiv/tool.py` by adding more specific information to the `description`. It would help with selecting `arxiv` tool between other tools. Improved `arxiv.ipynb` with more useful descriptions. --- .../modules/agents/tools/examples/arxiv.ipynb | 48 ++++++++++++------- langchain/tools/arxiv/tool.py | 7 ++- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/docs/modules/agents/tools/examples/arxiv.ipynb b/docs/modules/agents/tools/examples/arxiv.ipynb index 91d13e95..04b1cc47 100644 --- a/docs/modules/agents/tools/examples/arxiv.ipynb +++ b/docs/modules/agents/tools/examples/arxiv.ipynb @@ -40,15 +40,19 @@ ] }, { - "cell_type": "code", - "execution_count": 3, - "id": "2a50dd27", - "metadata": { - "tags": [] - }, - "outputs": [], + "cell_type": "markdown", + "id": "c89c110c-96ac-4fe1-ba3e-6056543d1a59", + "metadata": {}, "source": [ - "arxiv = ArxivAPIWrapper()" + "Run a query to get information about some `scientific article`/articles. The query text is limited to 300 characters.\n", + "\n", + "It returns these article fields:\n", + "- Publishing date\n", + "- Title\n", + "- Authors\n", + "- Summary\n", + "\n", + "Next query returns information about one article with arxiv Id equal \"1605.08386\". " ] }, { @@ -75,6 +79,16 @@ "docs" ] }, + { + "cell_type": "markdown", + "id": "840f70c9-8f80-4680-bb38-46198e931bcf", + "metadata": {}, + "source": [ + "Now, we want to get information about one author, `Caprice Stanley`.\n", + "\n", + "This query returns information about three articles. By default, query returns information only about three top articles." + ] + }, { "cell_type": "code", "execution_count": 5, @@ -99,6 +113,14 @@ "docs" ] }, + { + "cell_type": "markdown", + "id": "2d9b6292-a47d-4f99-9827-8e9f244bf887", + "metadata": {}, + "source": [ + "Now, we are trying to find information about non-existing article. In this case, the response is \"No good Arxiv Result was found\"" + ] + }, { "cell_type": "code", "execution_count": 6, @@ -122,14 +144,6 @@ "docs = arxiv.run(\"1605.08386WWW\")\n", "docs" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4f4e9602", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -148,7 +162,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.1" + "version": "3.10.6" } }, "nbformat": 4, diff --git a/langchain/tools/arxiv/tool.py b/langchain/tools/arxiv/tool.py index 2c117c8a..83c21131 100644 --- a/langchain/tools/arxiv/tool.py +++ b/langchain/tools/arxiv/tool.py @@ -9,8 +9,11 @@ class ArxivQueryRun(BaseTool): name = "Arxiv" description = ( - "A wrapper around Arxiv. " - "Useful for getting summary of articles from arxiv.org. " + "A wrapper around Arxiv.org " + "Useful for when you need to answer questions about Physics, Mathematics, " + "Computer Science, Quantitative Biology, Quantitative Finance, Statistics, " + "Electrical Engineering, and Economics " + "from scientific articles on arxiv.org. " "Input should be a search query." ) api_wrapper: ArxivAPIWrapper