Soumik555 commited on
Commit
1c52a22
·
1 Parent(s): e62d265

modifies orchestrator,add code_exec tool, openai_chat (later we add chat)

Browse files
Files changed (1) hide show
  1. orchestrator_functions.py +2 -3
orchestrator_functions.py CHANGED
@@ -603,17 +603,16 @@ async def csv_chart(csv_url: str, query: str):
603
  try:
604
  # --- 1. First Attempt: OpenAI ---
605
  openai_result = await asyncio.to_thread(openai_chart, csv_url, query)
606
- logger.info("OpenAI chart result:", openai_result)
607
 
608
  if openai_result and openai_result != 'Chart not generated':
609
  return await upload_and_return(openai_result)
610
 
611
- print("OpenAI failed, Failed for: ", openai_result)
612
  raise Exception("OpenAI failed to generate chart")
613
 
614
  except Exception as openai_error:
615
  logger.info(f"OpenAI failed ({str(openai_error)}), trying raw Groq...")
616
- return "Sorry, I couldn't generate a chart..."
617
  # --- 2. Second Attempt: Raw Groq ---
618
  try:
619
  groq_result = await asyncio.to_thread(groq_chart, csv_url, query)
 
603
  try:
604
  # --- 1. First Attempt: OpenAI ---
605
  openai_result = await asyncio.to_thread(openai_chart, csv_url, query)
606
+ logger.info(f"OpenAI chart result:", openai_result)
607
 
608
  if openai_result and openai_result != 'Chart not generated':
609
  return await upload_and_return(openai_result)
610
 
 
611
  raise Exception("OpenAI failed to generate chart")
612
 
613
  except Exception as openai_error:
614
  logger.info(f"OpenAI failed ({str(openai_error)}), trying raw Groq...")
615
+ return 'Sorry, I could not generate a chart...'
616
  # --- 2. Second Attempt: Raw Groq ---
617
  try:
618
  groq_result = await asyncio.to_thread(groq_chart, csv_url, query)