Skip to content

Commit

Permalink
Removed timeout from queue on demo gradio to prevent long function ca…
Browse files Browse the repository at this point in the history
…lls from timing out with streaming
  • Loading branch information
VRSEN committed Mar 26, 2024
1 parent 96171d4 commit 20b7e09
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions agency_swarm/agency/agency.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ def on_run_step_done(self, run_step: RunStep) -> None:
if tool_call.function.name == "SendMessage":
continue

self.message_output = None
chatbot_queue.put("[new_message]")

self.message_output = MessageOutput("function_output", tool_call.function.name,
self.recipient_agent_name,
tool_call.function.output)
Expand Down Expand Up @@ -301,7 +304,7 @@ def bot(original_message, history):
new_message = True
while True:
try:
bot_message = chatbot_queue.get(block=True, timeout=10)
bot_message = chatbot_queue.get(block=True)

if bot_message == "[end]":
completion_thread.join()
Expand Down Expand Up @@ -362,7 +365,7 @@ def _setup_autocomplete(self):
try:
import pyreadline as readline
except ImportError:
print("Module 'readline' not found. Autocomplete will not work. If you are using Windows, try installing 'pyreadline'.")
print("Module 'readline' not found. Autocomplete will not work. If you are using Windows, try installing 'pyreadline3'.")
return

if not readline:
Expand All @@ -372,7 +375,7 @@ def _setup_autocomplete(self):
readline.set_completer(self._recipient_agent_completer)
readline.parse_and_bind('tab: complete')
except Exception as e:
print(f"Error setting up autocomplete for agents in terminal: {e}")
print(f"Error setting up autocomplete for agents in terminal: {e}. Autocomplete will not work.")

def run_demo(self):
"""
Expand Down

0 comments on commit 20b7e09

Please sign in to comment.