Soumik555 commited on
Commit
a20826a
·
1 Parent(s): 92b1ad1

Lets fix this

Browse files
Files changed (1) hide show
  1. controller.py +3 -3
controller.py CHANGED
@@ -269,7 +269,7 @@ def langchain_csv_chat(csv_url: str, question: str, chart_required: bool):
269
  # if "429" in error_message:
270
  if error_message != "":
271
  with current_langchain_chart_lock:
272
- current_langchain_chart_key_index = (current_langchain_chart_key_index + 1) % len(groq_api_keys)
273
  logger.warning(f"Rate limit exceeded. Switching to next API key: {groq_api_keys[current_langchain_chart_key_index]}")
274
  else:
275
  logger.error(f"Error with API key {api_key}: {error_message}")
@@ -408,7 +408,7 @@ def groq_chart(csv_url: str, question: str):
408
  # if "429" in error:
409
  if error != "":
410
  with current_groq_chart_lock:
411
- current_groq_chart_key_index = (current_groq_chart_key_index + 1) % len(groq_api_keys)
412
  else:
413
  logger.error(f"Chart generation error: {error}")
414
  return {"error": error}
@@ -751,7 +751,7 @@ def langchain_csv_chart(csv_url: str, question: str, chart_required: bool):
751
  error_message = str(e)
752
  if error_message != "":
753
  with current_langchain_chart_lock:
754
- current_langchain_chart_key_index = (current_langchain_chart_key_index + 1) % len(groq_api_keys)
755
  logger.warning(f"Rate limit exceeded. Switching to next API key: {groq_api_keys[current_langchain_chart_key_index]}")
756
  else:
757
  logger.error(f"Error with API key {api_key}: {error_message}")
 
269
  # if "429" in error_message:
270
  if error_message != "":
271
  with current_langchain_chart_lock:
272
+ current_langchain_chart_key_index = (current_langchain_chart_key_index + 1)
273
  logger.warning(f"Rate limit exceeded. Switching to next API key: {groq_api_keys[current_langchain_chart_key_index]}")
274
  else:
275
  logger.error(f"Error with API key {api_key}: {error_message}")
 
408
  # if "429" in error:
409
  if error != "":
410
  with current_groq_chart_lock:
411
+ current_groq_chart_key_index = (current_groq_chart_key_index + 1)
412
  else:
413
  logger.error(f"Chart generation error: {error}")
414
  return {"error": error}
 
751
  error_message = str(e)
752
  if error_message != "":
753
  with current_langchain_chart_lock:
754
+ current_langchain_chart_key_index = (current_langchain_chart_key_index + 1)
755
  logger.warning(f"Rate limit exceeded. Switching to next API key: {groq_api_keys[current_langchain_chart_key_index]}")
756
  else:
757
  logger.error(f"Error with API key {api_key}: {error_message}")