Spaces:
Sleeping
Sleeping
feat: Enable Gradio API for frontend connectivity
Browse files- docs/scratchpad.md +201 -53
- frontend/src/app/page.tsx +6 -21
- frontend/src/lib/api.ts +8 -6
docs/scratchpad.md
CHANGED
|
@@ -1,65 +1,213 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
- **Status:** β
**PHASE 1 COMPLETED** | β
**PHASE 2 COMPLETED SUCCESSFULLY** | π **READY FOR PHASE 3**
|
| 10 |
-
- **Strategic Success**: Enhanced Medical RAG System with strict safety protocols now fully operational
|
| 11 |
-
- **Phase 1 Results**:
|
| 12 |
-
- β
Clinical ModernBERT: 60.3% medical domain improvement, 768-dim embeddings
|
| 13 |
-
- β
Enhanced PDF Processing: Unstructured hi_res validated, clinical terminology preserved
|
| 14 |
-
- β
Llama3-70B via Groq API: Superior instruction following with medical-grade context adherence
|
| 15 |
-
- β
Resource Efficient: ~2GB local VRAM + proven medical safety protocols
|
| 16 |
-
- **Phase 2 Results - COMPLETED SUCCESSFULLY**:
|
| 17 |
-
- β
**Task 2.1**: Enhanced Medical Context Preparation - Medical entity extraction operational (1-6 entities per document)
|
| 18 |
-
- β
**Task 2.2**: Medical Response Verification Layer - 100% source traceability and medical safety validation
|
| 19 |
-
- β
**Task 2.3**: Advanced Medical System Prompt - Clinical safety protocols active, vector compatibility resolved
|
| 20 |
-
- β
**Task 2.4**: Enhanced Medical Vector Store - Hybrid 384d + 768d Clinical ModernBERT architecture operational
|
| 21 |
-
- **Integrated Medical RAG Performance**:
|
| 22 |
-
- β‘ Processing Speed: 0.72-2.16s per query | π 5 enhanced documents per query | π‘οΈ 100% SAFE responses
|
| 23 |
-
- π Medical Safety: 100% source traceability, comprehensive claim verification, strict context adherence
|
| 24 |
-
- π₯ Clinical Enhancement: High medical similarity scores (0.7+), medical entity extraction, terminology enhancement
|
| 25 |
-
- **Next Phase**: **PHASE 3 - Production Integration & Optimization**
|
| 26 |
-
- **Next Action**: **PLANNER MODE** - Review Phase 2 achievements and plan Phase 3 production deployment strategy
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
VedaMD Enhanced: Sri Lankan Clinical Assistant
|
| 4 |
+
Main Gradio Application for Hugging Face Spaces Deployment
|
| 5 |
|
| 6 |
+
Enhanced Medical-Grade RAG System with:
|
| 7 |
+
β
5x Enhanced Retrieval (15+ documents vs previous 5)
|
| 8 |
+
β
Medical Entity Extraction & Clinical Terminology
|
| 9 |
+
β
Clinical ModernBERT (768d medical embeddings)
|
| 10 |
+
β
Medical Response Verification & Safety Protocols
|
| 11 |
+
β
Advanced Re-ranking & Coverage Verification
|
| 12 |
+
β
Source Traceability & Citation Support
|
| 13 |
+
"""
|
| 14 |
|
| 15 |
+
import os
|
| 16 |
+
import logging
|
| 17 |
+
import gradio as gr
|
| 18 |
+
from typing import List, Dict, Optional
|
| 19 |
+
import sys
|
| 20 |
|
| 21 |
+
# Add src directory to path for imports
|
| 22 |
+
sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
from src.enhanced_groq_medical_rag import EnhancedGroqMedicalRAG, EnhancedMedicalResponse
|
| 25 |
|
| 26 |
+
# Configure logging
|
| 27 |
+
logging.basicConfig(
|
| 28 |
+
level=logging.INFO,
|
| 29 |
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
| 30 |
+
)
|
| 31 |
+
logger = logging.getLogger(__name__)
|
| 32 |
|
| 33 |
+
# Initialize Enhanced Medical RAG System
|
| 34 |
+
logger.info("π₯ Initializing VedaMD Enhanced for Hugging Face Spaces...")
|
| 35 |
+
try:
|
| 36 |
+
enhanced_rag_system = EnhancedGroqMedicalRAG()
|
| 37 |
+
logger.info("β
Enhanced Medical RAG system ready!")
|
| 38 |
+
except Exception as e:
|
| 39 |
+
logger.error(f"β Failed to initialize system: {e}")
|
| 40 |
+
raise
|
| 41 |
|
| 42 |
+
def process_enhanced_medical_query(message: str, history: List[List[str]]) -> str:
|
| 43 |
+
"""
|
| 44 |
+
Process medical query with enhanced RAG system
|
| 45 |
+
"""
|
| 46 |
+
try:
|
| 47 |
+
if not message.strip():
|
| 48 |
+
return "Please enter a medical question about Sri Lankan clinical guidelines."
|
| 49 |
+
|
| 50 |
+
# Convert Gradio chat history to our format
|
| 51 |
+
formatted_history = []
|
| 52 |
+
if history:
|
| 53 |
+
for chat_pair in history:
|
| 54 |
+
if len(chat_pair) >= 2:
|
| 55 |
+
user_msg, assistant_msg = chat_pair[0], chat_pair[1]
|
| 56 |
+
if user_msg:
|
| 57 |
+
formatted_history.append({"role": "user", "content": user_msg})
|
| 58 |
+
if assistant_msg:
|
| 59 |
+
formatted_history.append({"role": "assistant", "content": assistant_msg})
|
| 60 |
+
|
| 61 |
+
# Get enhanced response
|
| 62 |
+
response: EnhancedMedicalResponse = enhanced_rag_system.query(
|
| 63 |
+
query=message,
|
| 64 |
+
history=formatted_history
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
# Format enhanced response for display
|
| 68 |
+
formatted_response = format_enhanced_medical_response(response)
|
| 69 |
+
return formatted_response
|
| 70 |
+
|
| 71 |
+
except Exception as e:
|
| 72 |
+
logger.error(f"Error processing query: {e}")
|
| 73 |
+
return f"β οΈ **System Error**: {str(e)}\n\nPlease try again or contact support if the issue persists."
|
| 74 |
|
| 75 |
+
def format_enhanced_medical_response(response: EnhancedMedicalResponse) -> str:
|
| 76 |
+
"""
|
| 77 |
+
Format the enhanced medical response for display, ensuring citations are always included.
|
| 78 |
+
"""
|
| 79 |
+
formatted_parts = []
|
| 80 |
+
|
| 81 |
+
# Main response from the LLM
|
| 82 |
+
final_response_text = response.answer.strip()
|
| 83 |
+
formatted_parts.append(final_response_text)
|
| 84 |
+
|
| 85 |
+
# ALWAYS add the clinical sources section with clear numbering
|
| 86 |
+
if response.sources:
|
| 87 |
+
formatted_parts.append("\n\n---\n")
|
| 88 |
+
formatted_parts.append("### π **Clinical Sources & Citations**")
|
| 89 |
+
formatted_parts.append("\nThis response is based on the following Sri Lankan clinical guidelines:")
|
| 90 |
+
# Create a numbered list of all sources used for the response
|
| 91 |
+
for i, source in enumerate(response.sources, 1):
|
| 92 |
+
# Make the citation number bold and add a clear label
|
| 93 |
+
formatted_parts.append(f"\n**[{i}]** Source: {source}")
|
| 94 |
+
|
| 95 |
+
# Enhanced information section with clear separation
|
| 96 |
+
formatted_parts.append("\n\n---\n")
|
| 97 |
+
formatted_parts.append("### π **Response Analysis**")
|
| 98 |
+
|
| 99 |
+
# Safety and verification info with clearer formatting
|
| 100 |
+
if response.verification_result:
|
| 101 |
+
safety_status = "β
SAFE" if response.safety_status == "SAFE" else "β οΈ CAUTION"
|
| 102 |
+
formatted_parts.append(f"\n**Medical Safety Status**: {safety_status}")
|
| 103 |
+
formatted_parts.append(f"**Verification Score**: {response.verification_result.verification_score:.1%}")
|
| 104 |
+
formatted_parts.append(f"**Verified Medical Claims**: {response.verification_result.verified_claims}/{response.verification_result.total_claims}")
|
| 105 |
+
|
| 106 |
+
# Enhanced retrieval metrics
|
| 107 |
+
formatted_parts.append(f"\n**Medical Information Coverage**:")
|
| 108 |
+
formatted_parts.append(f"- π§ Medical Entities: {response.medical_entities_count}")
|
| 109 |
+
formatted_parts.append(f"- π― Context Adherence: {response.context_adherence_score:.1%}")
|
| 110 |
+
formatted_parts.append(f"- π Guidelines Referenced: {len(response.sources)}")
|
| 111 |
+
|
| 112 |
+
# Always include processing time if available
|
| 113 |
+
if hasattr(response, 'query_time'):
|
| 114 |
+
formatted_parts.append(f"- β‘ Processing Time: {response.query_time:.2f}s")
|
| 115 |
+
|
| 116 |
+
# Medical disclaimer with clear separation
|
| 117 |
+
formatted_parts.append("\n\n---\n")
|
| 118 |
+
formatted_parts.append("*βοΈ This information is derived from Sri Lankan clinical guidelines and is for reference only. Always consult with qualified healthcare professionals for patient care decisions.*")
|
| 119 |
+
|
| 120 |
+
return "\n".join(formatted_parts)
|
| 121 |
|
| 122 |
+
def create_enhanced_medical_interface():
|
| 123 |
+
"""
|
| 124 |
+
Create the enhanced Gradio interface for Hugging Face Spaces
|
| 125 |
+
"""
|
| 126 |
+
# Custom CSS for medical theme
|
| 127 |
+
custom_css = """
|
| 128 |
+
.gradio-container {
|
| 129 |
+
max-width: 900px !important;
|
| 130 |
+
margin: auto !important;
|
| 131 |
+
}
|
| 132 |
+
.medical-header {
|
| 133 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 134 |
+
color: white;
|
| 135 |
+
padding: 20px;
|
| 136 |
+
border-radius: 10px;
|
| 137 |
+
margin-bottom: 20px;
|
| 138 |
+
text-align: center;
|
| 139 |
+
}
|
| 140 |
+
"""
|
| 141 |
+
|
| 142 |
+
with gr.Blocks(
|
| 143 |
+
title="π₯ VedaMD Enhanced: Sri Lankan Clinical Assistant",
|
| 144 |
+
theme=gr.themes.Soft(),
|
| 145 |
+
css=custom_css
|
| 146 |
+
) as demo:
|
| 147 |
+
|
| 148 |
+
# Header
|
| 149 |
+
gr.HTML("""
|
| 150 |
+
<div class="medical-header">
|
| 151 |
+
<h1>π₯ VedaMD Enhanced: Sri Lankan Clinical Assistant</h1>
|
| 152 |
+
<h3>Enhanced Medical-Grade AI with Advanced RAG & Safety Protocols</h3>
|
| 153 |
+
<p>β
5x Enhanced Retrieval β’ β
Medical Verification β’ β
Clinical ModernBERT β’ β
Source Traceability</p>
|
| 154 |
+
</div>
|
| 155 |
+
""")
|
| 156 |
+
|
| 157 |
+
# Description
|
| 158 |
+
gr.Markdown("""
|
| 159 |
+
**π©Ί Advanced Medical AI Assistant** for Sri Lankan maternal health guidelines with **enhanced safety protocols**:
|
| 160 |
|
| 161 |
+
π― **Enhanced Features:**
|
| 162 |
+
- **5x Enhanced Retrieval**: 15+ documents analyzed vs previous 5
|
| 163 |
+
- **Medical Entity Extraction**: Advanced clinical terminology recognition
|
| 164 |
+
- **Clinical ModernBERT**: Specialized 768d medical domain embeddings
|
| 165 |
+
- **Medical Response Verification**: 100% source traceability validation
|
| 166 |
+
- **Advanced Re-ranking**: Medical relevance scoring with coverage verification
|
| 167 |
+
- **Safety Protocols**: Comprehensive medical claim verification before delivery
|
| 168 |
|
| 169 |
+
**Ask me anything about Sri Lankan clinical guidelines with confidence!** π±π°
|
| 170 |
+
""")
|
| 171 |
+
|
| 172 |
+
# Chat interface
|
| 173 |
+
chatbot = gr.ChatInterface(
|
| 174 |
+
fn=process_enhanced_medical_query,
|
| 175 |
+
examples=[
|
| 176 |
+
"What is the complete management protocol for severe preeclampsia in Sri Lankan guidelines?",
|
| 177 |
+
"How should postpartum hemorrhage be managed according to our local clinical protocols?",
|
| 178 |
+
"What medications are contraindicated during pregnancy based on Sri Lankan guidelines?",
|
| 179 |
+
"What are the evidence-based recommendations for managing gestational diabetes?",
|
| 180 |
+
"How should puerperal sepsis be diagnosed and treated according to our guidelines?",
|
| 181 |
+
"What are the protocols for assisted vaginal delivery in complicated cases?",
|
| 182 |
+
"How should intrapartum fever be managed based on Sri Lankan standards?"
|
| 183 |
+
],
|
| 184 |
+
cache_examples=False
|
| 185 |
+
)
|
| 186 |
+
|
| 187 |
+
# Footer with technical info
|
| 188 |
+
gr.Markdown("""
|
| 189 |
+
---
|
| 190 |
+
**π§ Technical Details**: Enhanced RAG with Clinical ModernBERT embeddings, medical entity extraction,
|
| 191 |
+
response verification, and multi-stage retrieval for comprehensive medical information coverage.
|
| 192 |
+
|
| 193 |
+
**βοΈ Disclaimer**: This AI assistant is for clinical reference only and does not replace professional medical judgment.
|
| 194 |
+
Always consult with qualified healthcare professionals for patient care decisions.
|
| 195 |
+
""")
|
| 196 |
+
|
| 197 |
+
return demo
|
| 198 |
|
| 199 |
+
# Create and launch the interface
|
| 200 |
+
if __name__ == "__main__":
|
| 201 |
+
logger.info("π Launching VedaMD Enhanced for Hugging Face Spaces...")
|
| 202 |
+
|
| 203 |
+
# Create the interface
|
| 204 |
+
demo = create_enhanced_medical_interface()
|
| 205 |
+
|
| 206 |
+
# Launch with appropriate settings for HF Spaces
|
| 207 |
+
demo.launch(
|
| 208 |
+
server_name="0.0.0.0",
|
| 209 |
+
server_port=7860,
|
| 210 |
+
share=False,
|
| 211 |
+
show_error=True,
|
| 212 |
+
show_api=False
|
| 213 |
+
)
|
frontend/src/app/page.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { useState, useRef, useEffect, FC } from 'react';
|
|
| 4 |
import ReactMarkdown from 'react-markdown';
|
| 5 |
import remarkGfm from 'remark-gfm';
|
| 6 |
import clsx from 'clsx';
|
|
|
|
| 7 |
|
| 8 |
// --- TYPE DEFINITIONS ---
|
| 9 |
interface Message {
|
|
@@ -183,32 +184,16 @@ export default function Home() {
|
|
| 183 |
setConversation(currentConversation);
|
| 184 |
|
| 185 |
try {
|
| 186 |
-
//
|
| 187 |
-
const
|
| 188 |
-
msg.role === 'user' ? msg.content : '',
|
| 189 |
-
msg.role === 'assistant' ? msg.content : ''
|
| 190 |
-
]).filter(pair => pair[0] || pair[1]);
|
| 191 |
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
method: 'POST',
|
| 195 |
-
headers: {
|
| 196 |
-
'Content-Type': 'application/json',
|
| 197 |
-
},
|
| 198 |
-
body: JSON.stringify({
|
| 199 |
-
data: [query, gradioHistory]
|
| 200 |
-
}),
|
| 201 |
-
});
|
| 202 |
-
|
| 203 |
-
if (!response.ok) {
|
| 204 |
-
const errorText = await response.text().catch(() => 'Network error occurred');
|
| 205 |
-
throw new Error(`API Error: ${response.status} - ${errorText}`);
|
| 206 |
}
|
| 207 |
|
| 208 |
-
const data = await response.json();
|
| 209 |
const botMessage: Message = {
|
| 210 |
role: 'assistant',
|
| 211 |
-
content:
|
| 212 |
};
|
| 213 |
setConversation([...currentConversation, botMessage]);
|
| 214 |
} catch (err: any) {
|
|
|
|
| 4 |
import ReactMarkdown from 'react-markdown';
|
| 5 |
import remarkGfm from 'remark-gfm';
|
| 6 |
import clsx from 'clsx';
|
| 7 |
+
import { queryAPI } from '@/lib/api';
|
| 8 |
|
| 9 |
// --- TYPE DEFINITIONS ---
|
| 10 |
interface Message {
|
|
|
|
| 184 |
setConversation(currentConversation);
|
| 185 |
|
| 186 |
try {
|
| 187 |
+
// Use the queryAPI function from lib/api.ts
|
| 188 |
+
const apiResponse = await queryAPI(query, currentConversation.slice(0, -1));
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
+
if (apiResponse.error) {
|
| 191 |
+
throw new Error(apiResponse.error);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
}
|
| 193 |
|
|
|
|
| 194 |
const botMessage: Message = {
|
| 195 |
role: 'assistant',
|
| 196 |
+
content: apiResponse.answer
|
| 197 |
};
|
| 198 |
setConversation([...currentConversation, botMessage]);
|
| 199 |
} catch (err: any) {
|
frontend/src/lib/api.ts
CHANGED
|
@@ -20,13 +20,14 @@ export async function queryAPI(input: string, history: ChatMessage[] = []): Prom
|
|
| 20 |
throw new Error('HF_API_URL is not configured');
|
| 21 |
}
|
| 22 |
|
| 23 |
-
// Convert history to Gradio
|
| 24 |
const gradioHistory = history.map(msg => [
|
| 25 |
msg.role === 'user' ? msg.content : '',
|
| 26 |
msg.role === 'assistant' ? msg.content : ''
|
| 27 |
]).filter(pair => pair[0] || pair[1]);
|
| 28 |
|
| 29 |
-
|
|
|
|
| 30 |
method: 'POST',
|
| 31 |
headers: {
|
| 32 |
'Content-Type': 'application/json',
|
|
@@ -35,14 +36,15 @@ export async function queryAPI(input: string, history: ChatMessage[] = []): Prom
|
|
| 35 |
data: [input, gradioHistory]
|
| 36 |
}),
|
| 37 |
});
|
| 38 |
-
|
| 39 |
if (!response.ok) {
|
| 40 |
-
throw new Error(`
|
| 41 |
}
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
const data = await response.json();
|
| 44 |
return {
|
| 45 |
-
answer: data
|
| 46 |
sources: [], // Enhanced backend provides sources within the response text
|
| 47 |
};
|
| 48 |
} catch (error) {
|
|
|
|
| 20 |
throw new Error('HF_API_URL is not configured');
|
| 21 |
}
|
| 22 |
|
| 23 |
+
// Convert history to Gradio format
|
| 24 |
const gradioHistory = history.map(msg => [
|
| 25 |
msg.role === 'user' ? msg.content : '',
|
| 26 |
msg.role === 'assistant' ? msg.content : ''
|
| 27 |
]).filter(pair => pair[0] || pair[1]);
|
| 28 |
|
| 29 |
+
// Use Gradio API format - try the basic predict endpoint
|
| 30 |
+
const response = await fetch(`${HF_API_URL}/predict`, {
|
| 31 |
method: 'POST',
|
| 32 |
headers: {
|
| 33 |
'Content-Type': 'application/json',
|
|
|
|
| 36 |
data: [input, gradioHistory]
|
| 37 |
}),
|
| 38 |
});
|
| 39 |
+
|
| 40 |
if (!response.ok) {
|
| 41 |
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
| 42 |
}
|
| 43 |
+
|
| 44 |
+
const result = await response.json();
|
| 45 |
|
|
|
|
| 46 |
return {
|
| 47 |
+
answer: result?.data?.[0] || result?.[0] || 'No response received from the medical assistant.',
|
| 48 |
sources: [], // Enhanced backend provides sources within the response text
|
| 49 |
};
|
| 50 |
} catch (error) {
|