이 노트북은 agent와 함께 arxiv tool을 사용하는 방법을 다룹니다. 먼저, arxiv python package를 설치해야 합니다.
pip install -qU  langchain-community arxiv
from langchain_classic import hub
from langchain.agents import AgentExecutor, create_agent, load_tools
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(temperature=0.0)
tools = load_tools(
    ["arxiv"],
)
prompt = hub.pull("hwchase17/react")

agent = create_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
agent_executor.invoke(
    {
        "input": "What's the paper 1605.08386 about?",
    }
)
> Entering new AgentExecutor chain...
I should use the arxiv tool to search for the paper with the given identifier.
Action: arxiv
Action Input: 1605.08386Published: 2016-05-26
Title: Heat-bath random walks with Markov bases
Authors: Caprice Stanley, Tobias Windisch
Summary: Graphs on lattice points are studied whose edges come from a finite set of
allowed moves of arbitrary length. We show that the diameter of these graphs on
fibers of a fixed integer matrix can be bounded from above by a constant. We
then study the mixing behaviour of heat-bath random walks on these graphs. We
also state explicit conditions on the set of moves so that the heat-bath random
walk, a generalization of the Glauber dynamics, is an expander in fixed
dimension.The paper "1605.08386" is titled "Heat-bath random walks with Markov bases" and is authored by Caprice Stanley and Tobias Windisch. It was published on May 26, 2016. The paper discusses the study of graphs on lattice points with edges coming from a finite set of allowed moves. It explores the diameter of these graphs and the mixing behavior of heat-bath random walks on them. The paper also discusses conditions for the heat-bath random walk to be an expander in fixed dimension.
Final Answer: The paper "1605.08386" is about heat-bath random walks with Markov bases.

> Finished chain.
{'input': "What's the paper 1605.08386 about?",
 'output': 'The paper "1605.08386" is about heat-bath random walks with Markov bases.'}

ArXiv API Wrapper

이 tool은 API Wrapper를 사용합니다. 아래에서 제공하는 몇 가지 기능을 살펴봅니다.
from langchain_community.utilities import ArxivAPIWrapper
ArxivAPIWrapper를 사용하여 과학 논문에 대한 정보를 얻을 수 있습니다. query text는 300자로 제한됩니다. ArxivAPIWrapper는 다음 논문 필드를 반환합니다:
  • Publishing date
  • Title
  • Authors
  • Summary
다음 query는 arxiv ID “1605.08386”을 가진 논문 하나에 대한 정보를 반환합니다.
arxiv = ArxivAPIWrapper()
docs = arxiv.run("1605.08386")
docs
'Published: 2016-05-26\nTitle: Heat-bath random walks with Markov bases\nAuthors: Caprice Stanley, Tobias Windisch\nSummary: Graphs on lattice points are studied whose edges come from a finite set of\nallowed moves of arbitrary length. We show that the diameter of these graphs on\nfibers of a fixed integer matrix can be bounded from above by a constant. We\nthen study the mixing behaviour of heat-bath random walks on these graphs. We\nalso state explicit conditions on the set of moves so that the heat-bath random\nwalk, a generalization of the Glauber dynamics, is an expander in fixed\ndimension.'
이제 한 명의 저자인 Caprice Stanley에 대한 정보를 얻고자 합니다. 이 query는 세 개의 논문에 대한 정보를 반환합니다. 기본적으로 query는 상위 세 개의 논문에 대한 정보만 반환합니다.
docs = arxiv.run("Caprice Stanley")
docs
'Published: 2017-10-10\nTitle: On Mixing Behavior of a Family of Random Walks Determined by a Linear Recurrence\nAuthors: Caprice Stanley, Seth Sullivant\nSummary: We study random walks on the integers mod $G_n$ that are determined by an\ninteger sequence $\\{ G_n \\}_{n \\geq 1}$ generated by a linear recurrence\nrelation. Fourier analysis provides explicit formulas to compute the\neigenvalues of the transition matrices and we use this to bound the mixing time\nof the random walks.\n\nPublished: 2016-05-26\nTitle: Heat-bath random walks with Markov bases\nAuthors: Caprice Stanley, Tobias Windisch\nSummary: Graphs on lattice points are studied whose edges come from a finite set of\nallowed moves of arbitrary length. We show that the diameter of these graphs on\nfibers of a fixed integer matrix can be bounded from above by a constant. We\nthen study the mixing behaviour of heat-bath random walks on these graphs. We\nalso state explicit conditions on the set of moves so that the heat-bath random\nwalk, a generalization of the Glauber dynamics, is an expander in fixed\ndimension.\n\nPublished: 2003-03-18\nTitle: Calculation of fluxes of charged particles and neutrinos from atmospheric showers\nAuthors: V. Plyaskin\nSummary: The results on the fluxes of charged particles and neutrinos from a\n3-dimensional (3D) simulation of atmospheric showers are presented. An\nagreement of calculated fluxes with data on charged particles from the AMS and\nCAPRICE detectors is demonstrated. Predictions on neutrino fluxes at different\nexperimental sites are compared with results from other calculations.'
이제 존재하지 않는 논문에 대한 정보를 찾으려고 합니다. 이 경우 응답은 “No good Arxiv Result was found”입니다.
docs = arxiv.run("1605.08386WWW")
docs
'No good Arxiv Result was found'

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I