Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,28 @@
|
|
| 1 |
-
from langchain.
|
| 2 |
-
from langchain.agents import
|
| 3 |
-
from langchain.
|
| 4 |
from langchain.memory import ConversationBufferMemory
|
| 5 |
-
from langchain.
|
|
|
|
| 6 |
memory = ConversationBufferMemory()
|
| 7 |
-
|
| 8 |
-
tools =
|
| 9 |
-
'wikipedia'
|
| 10 |
-
'
|
| 11 |
-
'
|
| 12 |
-
'python_repl'
|
| 13 |
-
'wolfram-alpha'
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
'openweathermap-api'
|
| 18 |
-
|
| 19 |
-
agent =
|
| 20 |
-
tools,
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
verbose=True,
|
| 24 |
-
memory=memory
|
|
|
|
|
|
|
| 25 |
agent.run("What's up ChatGPT?")
|
|
|
|
| 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 |
+
|
| 7 |
memory = ConversationBufferMemory()
|
| 8 |
+
lm = ChatOpenAI()
|
| 9 |
+
tools = load_tools([
|
| 10 |
+
'wikipedia',
|
| 11 |
+
'ilm-math',
|
| 12 |
+
'google-search',
|
| 13 |
+
'python_repl',
|
| 14 |
+
'wolfram-alpha',
|
| 15 |
+
'terminal',
|
| 16 |
+
'news-api',
|
| 17 |
+
'podcast-api',
|
| 18 |
+
'openweathermap-api'
|
| 19 |
+
])
|
| 20 |
+
agent = initialize_agent(
|
| 21 |
+
tools,
|
| 22 |
+
lm,
|
| 23 |
+
agent_type=AgentType.CONVERSATIONAL_REACT_DESCRIPTION,
|
| 24 |
+
verbose=True,
|
| 25 |
+
memory=memory
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
agent.run("What's up ChatGPT?")
|