Spaces:
Build error
Build error
Commit
·
200f9e3
1
Parent(s):
e6f3166
update callback
Browse files
app.py
CHANGED
|
@@ -17,6 +17,8 @@ from langchain.agents import Tool
|
|
| 17 |
from langchain.tools import BaseTool
|
| 18 |
from langchain.memory import ConversationBufferWindowMemory
|
| 19 |
from langchain.prompts import MessagesPlaceholder
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
global CurrentAgent
|
|
@@ -183,6 +185,7 @@ agent_STRUCTURED_ZEROSHOT_REACT = initialize_agent(tools_remote, GPTfake,
|
|
| 183 |
agent = agent_STRUCTURED_ZEROSHOT_REACT
|
| 184 |
|
| 185 |
|
|
|
|
| 186 |
st.title("STLA-BABY")
|
| 187 |
|
| 188 |
msgs = StreamlitChatMessageHistory()
|
|
@@ -203,6 +206,7 @@ if prompt := st.chat_input(placeholder="Input Your Request"):
|
|
| 203 |
|
| 204 |
with st.chat_message("assistant"):
|
| 205 |
# response = GPTfake(prompt)
|
| 206 |
-
|
|
|
|
| 207 |
st.write(response)
|
| 208 |
print(msgs.messages)
|
|
|
|
| 17 |
from langchain.tools import BaseTool
|
| 18 |
from langchain.memory import ConversationBufferWindowMemory
|
| 19 |
from langchain.prompts import MessagesPlaceholder
|
| 20 |
+
from langchain.agents import ConversationalChatAgent, AgentExecutor
|
| 21 |
+
from langchain.callbacks import StreamlitCallbackHandler
|
| 22 |
|
| 23 |
|
| 24 |
global CurrentAgent
|
|
|
|
| 185 |
agent = agent_STRUCTURED_ZEROSHOT_REACT
|
| 186 |
|
| 187 |
|
| 188 |
+
|
| 189 |
st.title("STLA-BABY")
|
| 190 |
|
| 191 |
msgs = StreamlitChatMessageHistory()
|
|
|
|
| 206 |
|
| 207 |
with st.chat_message("assistant"):
|
| 208 |
# response = GPTfake(prompt)
|
| 209 |
+
st_cb = StreamlitCallbackHandler(st.container(), expand_new_thoughts=False)
|
| 210 |
+
response = agent(prompt, callbacks=[st_cb])
|
| 211 |
st.write(response)
|
| 212 |
print(msgs.messages)
|