atharva-nlp commited on
Commit
950283a
·
verified ·
1 Parent(s): e5f0fd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -83,12 +83,13 @@ def respond_in_assistant_thread(
83
  # messages_in_thread.append({"role": role, "content": message["text"]})
84
 
85
  # Pass the latest prompt and chat history to the LLM (call_llm is your own code)
86
- returned_message = call_llm(query)
87
 
88
- logging.info(returned_message)
89
-
90
- # Post the result in the assistant thread
91
- say(text=returned_message)
 
92
 
93
  except Exception as e:
94
  logger.exception(f"Failed to respond to an inquiry: {e}")
 
83
  # messages_in_thread.append({"role": role, "content": message["text"]})
84
 
85
  # Pass the latest prompt and chat history to the LLM (call_llm is your own code)
86
+ agent_gen = agent.run(task=query, stream=True)
87
 
88
+ for val in agent_gen:
89
+ if 'final_answer' in val:
90
+ say(val['final_answer'])
91
+ elif 'rationale' in val:
92
+ say(f"Rationale: {val['rationale']}")
93
 
94
  except Exception as e:
95
  logger.exception(f"Failed to respond to an inquiry: {e}")