florentgbelidji HF staff commited on
Commit
b16bcc2
·
1 Parent(s): 1427002

Changed thinking streaming

Browse files
Files changed (1) hide show
  1. src/gradio_utils.py +1 -1
src/gradio_utils.py CHANGED
@@ -92,7 +92,6 @@ def update_map_on_selection(row: pd.Series, df_routes: gr.State) -> Map:
92
 
93
  def pull_messages_from_step(step_log, test_mode: bool = True):
94
  """Extract ChatMessage objects from agent steps"""
95
- accumulated_thoughts = ""
96
  if isinstance(step_log, ActionStep):
97
  yield (step_log.llm_output, "")
98
  if step_log.tool_calls is not None:
@@ -145,6 +144,7 @@ def stream_to_gradio(
145
  accumulated_thoughts = ""
146
  accumulated_errors = ""
147
  for step_log in agent.run(task, stream=True, reset=reset_agent_memory, **kwargs):
 
148
  for (obs, error) in pull_messages_from_step(step_log, test_mode=test_mode):
149
 
150
  if len(obs)>0:
 
92
 
93
  def pull_messages_from_step(step_log, test_mode: bool = True):
94
  """Extract ChatMessage objects from agent steps"""
 
95
  if isinstance(step_log, ActionStep):
96
  yield (step_log.llm_output, "")
97
  if step_log.tool_calls is not None:
 
144
  accumulated_thoughts = ""
145
  accumulated_errors = ""
146
  for step_log in agent.run(task, stream=True, reset=reset_agent_memory, **kwargs):
147
+ print(pull_messages_from_step(step_log, test_mode=test_mode))
148
  for (obs, error) in pull_messages_from_step(step_log, test_mode=test_mode):
149
 
150
  if len(obs)>0: