Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain. agents import load_tools
|
2 |
+
from langchain.agents import initialize agent
|
3 |
+
from langchain. agents import AgentType
|
4 |
+
from langchain.memory import ConversationBufferMemory
|
5 |
+
from langchain. chat_models import ChatOpenAI
|
6 |
+
memory = ConversationBufferMemory()
|
7 |
+
(lm = ChatOpenAI()
|
8 |
+
tools = load tools (I
|
9 |
+
'wikipedia'
|
10 |
+
'Ilm-math',
|
11 |
+
'qoogle-search'
|
12 |
+
'python_repl'
|
13 |
+
'wolfram-alpha'
|
14 |
+
"terminal'
|
15 |
+
"news-api
|
16 |
+
"podcast-api'
|
17 |
+
'openweathermap-api'
|
18 |
+
1, 11m=11m)
|
19 |
+
agent = initialize agent
|
20 |
+
tools,
|
21 |
+
Ilm,
|
22 |
+
agent=AgentType.CONVERSATIONAL_REACT_DESCRIPTION,
|
23 |
+
verbose=True,
|
24 |
+
memory=memory
|
25 |
+
agent.run("What's up ChatGPT?")
|