Ashad001 commited on
Commit
236aaba
·
1 Parent(s): e1b464c
Files changed (2) hide show
  1. agents.py +1 -2
  2. format_response.py +1 -1
agents.py CHANGED
@@ -423,13 +423,12 @@ class auto_analyst(dspy.Module):
423
  yield name, result
424
  except Exception as e:
425
  yield agent_name, {"error": str(e)}
426
-
427
  # Execute code combiner after all agents complete
428
  code_list = [result['code'] for _, result in completed_results if 'code' in result]
429
  with dspy.settings.context(lm=dspy.LM(model="anthropic/claude-3-5-sonnet-latest", max_tokens=8000, temperature=1.0)):
430
  combiner_result = self.code_combiner_agent(agent_code_list=str(code_list), dataset=dict_['dataset'])
 
431
  yield 'code_combiner_agent', dict(combiner_result)
432
-
433
 
434
  # Agent to make a Chat history name from a query
435
  class chat_history_name_agent(dspy.Signature):
 
423
  yield name, result
424
  except Exception as e:
425
  yield agent_name, {"error": str(e)}
 
426
  # Execute code combiner after all agents complete
427
  code_list = [result['code'] for _, result in completed_results if 'code' in result]
428
  with dspy.settings.context(lm=dspy.LM(model="anthropic/claude-3-5-sonnet-latest", max_tokens=8000, temperature=1.0)):
429
  combiner_result = self.code_combiner_agent(agent_code_list=str(code_list), dataset=dict_['dataset'])
430
+ # print("combiner_result", str(combiner_result))
431
  yield 'code_combiner_agent', dict(combiner_result)
 
432
 
433
  # Agent to make a Chat history name from a query
434
  class chat_history_name_agent(dspy.Signature):
format_response.py CHANGED
@@ -179,7 +179,7 @@ def format_response_to_markdown(api_response, agent_name = None, dataframe=None)
179
  logger.error(f"Error in format_response_to_markdown: {str(e)}")
180
  return f"**Error**: {str(e)}"
181
 
182
- if not markdown:
183
  return "Please provide a valid query..."
184
 
185
  return '\n'.join(markdown)
 
179
  logger.error(f"Error in format_response_to_markdown: {str(e)}")
180
  return f"**Error**: {str(e)}"
181
 
182
+ if not markdown or len(markdown) <= 1:
183
  return "Please provide a valid query..."
184
 
185
  return '\n'.join(markdown)