mirror of
https://github.com/velocitatem/raccoon.git
synced 2026-05-31 16:53:37 +00:00
23 lines
579 B
Python
23 lines
579 B
Python
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", "python_repl"], llm=llm)
|
|
|
|
agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
|
|
|
|
def run(prompt):
|
|
return agent(prompt)
|
|
|
|
if __name__ == "__main__":
|
|
while True:
|
|
question = input("Ask a question: ")
|
|
response = agent(question)
|
|
print(response)
|