edouardlgp commited on
Commit
ab8a52c
Β·
verified Β·
1 Parent(s): 9049d6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py CHANGED
@@ -68,6 +68,37 @@ except Exception as e:
68
  raise
69
 
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
  def extract_text_from_pdf_url(url, debug_state):
73
  """Extract text from PDF with debug logging"""
 
68
  raise
69
 
70
 
71
+ ## Let's a do simple test from the doc --
72
+
73
+ # Define query and sources
74
+ query = "What is the capital of France?"
75
+ log_debug(f"πŸ” Test Query: {query}")
76
+
77
+ sources = [
78
+ {
79
+ "text": "Paris is the capital and most populous city of France.",
80
+ "metadata": {"source": "Geographic Encyclopedia", "reliability": "high"}
81
+ },
82
+ {
83
+ "text": "The Eiffel Tower is located in Paris, France.",
84
+ "metadata": {"source": "Travel Guide", "year": 2020}
85
+ }
86
+ ]
87
+ log_debug("πŸ“„ Test Sources loaded successfully.")
88
+
89
+ # Generate a response
90
+ try:
91
+ log_debug("🧠 Test rag model on simple example...")
92
+ response = rag.generate(query, sources)
93
+ log_debug("βœ… Test Answer generated successfully.")
94
+ log_debug(response["processed"]["clean_answer"])
95
+ except Exception as e:
96
+ log_debug(f"❌ Test Answer generation failed: {str(e)}")
97
+ raise
98
+
99
+
100
+
101
+
102
 
103
  def extract_text_from_pdf_url(url, debug_state):
104
  """Extract text from PDF with debug logging"""