joelg commited on
Commit
abdb11b
·
1 Parent(s): e17ceac

FIX more details when generation is failing

Browse files
Files changed (2) hide show
  1. app.py +3 -1
  2. rag_system.py +5 -1
app.py CHANGED
@@ -60,7 +60,9 @@ def perform_query(
60
  return chunks_display, prompt, answer, ""
61
 
62
  except Exception as e:
63
- return "", "", "", f"Error: {str(e)}"
 
 
64
 
65
  def format_chunks(results):
66
  """Format retrieved chunks with scores for display"""
 
60
  return chunks_display, prompt, answer, ""
61
 
62
  except Exception as e:
63
+ import traceback
64
+ error_details = traceback.format_exc()
65
+ return "", "", "", f"❌ Error: {str(e)}\n\nFull traceback:\n{error_details}"
66
 
67
  def format_chunks(results):
68
  """Format retrieved chunks with scores for display"""
rag_system.py CHANGED
@@ -355,7 +355,9 @@ Answer:"""
355
  return answer, prompt
356
 
357
  except Exception as e:
358
- return f"Error generating response: {str(e)}", prompt
 
 
359
 
360
  def _process_reasoning_output(self, text: str) -> str:
361
  """Process output from reasoning models to separate thinking from answer"""
@@ -465,7 +467,9 @@ Generate exactly {num_questions} questions, one per line, without numbering:"""
465
  return questions[:num_questions] if questions else self._default_questions()
466
 
467
  except Exception as e:
 
468
  print(f"Error generating questions: {e}")
 
469
  return self._default_questions()
470
 
471
  def _default_questions(self) -> List[str]:
 
355
  return answer, prompt
356
 
357
  except Exception as e:
358
+ import traceback
359
+ error_details = traceback.format_exc()
360
+ return f"Error generating response: {str(e)}\n\nDetails:\n{error_details}", prompt
361
 
362
  def _process_reasoning_output(self, text: str) -> str:
363
  """Process output from reasoning models to separate thinking from answer"""
 
467
  return questions[:num_questions] if questions else self._default_questions()
468
 
469
  except Exception as e:
470
+ import traceback
471
  print(f"Error generating questions: {e}")
472
+ print(f"Traceback: {traceback.format_exc()}")
473
  return self._default_questions()
474
 
475
  def _default_questions(self) -> List[str]: