mirror of
https://github.com/velocitatem/raccoon.git
synced 2026-05-31 16:53:37 +00:00
Add LangChain Agent with tools to visit websites and extract text
This commit is contained in:
19
playground/langchain-web.py
Normal file
19
playground/langchain-web.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# create a langchain implementation which can visit websites
|
||||
# and extract text from them
|
||||
|
||||
|
||||
from langchain.utilities import RequestsWrapper, BashProcess
|
||||
from langchain.agents import load_tools
|
||||
from langchain.agents import initialize_agent
|
||||
from langchain.llms import OpenAI
|
||||
|
||||
llm = OpenAI(temperature=0)
|
||||
|
||||
# load the tools
|
||||
|
||||
|
||||
tools = load_tools(["requests", "terminal"], llm=llm)
|
||||
|
||||
agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
|
||||
|
||||
agent.run("http://localhost:3000/exp use this resource to find out: what is the square root of 2?")
|
||||
Reference in New Issue
Block a user