Chris Alexiuk commited on
Commit
6386ac4
1 Parent(s): bc76327

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -75,8 +75,11 @@ async def init():
75
 
76
  @cl.on_message
77
  async def main(message):
78
- chain = cl.user_session.get("chain")
79
- res = await chain.acall(message)
 
 
 
80
 
81
  answer = res["result"]
82
  source_elements = []
 
75
 
76
  @cl.on_message
77
  async def main(message):
78
+ cb = cl.AsyncLangchainCallbackHandler(
79
+ stream_final_answer=True, answer_prefix_tokens=["FINAL", "ANSWER"]
80
+ )
81
+ cb.answer_reached = True
82
+ res = await chain.acall(message, callbacks=[cb])
83
 
84
  answer = res["result"]
85
  source_elements = []