SVashishta1
commited on
Commit
·
e5495b5
1
Parent(s):
8207117
Your commit message
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ from langchain_core.prompts import ChatPromptTemplate
|
|
| 9 |
# Add parent directory to path to import backend modules
|
| 10 |
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 11 |
|
| 12 |
-
from backend.main import process_query, upload_document, process_voice
|
| 13 |
from backend.db import SQLiteDB
|
| 14 |
from backend.vector_db import ChromaVectorDB
|
| 15 |
from backend.query_engine import QueryEngine
|
|
@@ -27,6 +27,9 @@ voice_assistant = VoiceAssistant()
|
|
| 27 |
document_parser = DocumentParser()
|
| 28 |
document_agents = DocumentAgents()
|
| 29 |
|
|
|
|
|
|
|
|
|
|
| 30 |
# Define the prompt with examples
|
| 31 |
query_prompt = ChatPromptTemplate.from_messages(
|
| 32 |
[
|
|
@@ -92,11 +95,8 @@ def process_text_query(query, history):
|
|
| 92 |
# Log query to database
|
| 93 |
sqlite_db.log_query(query)
|
| 94 |
|
| 95 |
-
#
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
# Generate response
|
| 99 |
-
response = query_engine.generate_response(query, relevant_docs)
|
| 100 |
|
| 101 |
# Update database with response
|
| 102 |
sqlite_db.log_query(query, response)
|
|
|
|
| 9 |
# Add parent directory to path to import backend modules
|
| 10 |
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 11 |
|
| 12 |
+
from backend.main import process_query, upload_document, process_voice, DocumentAssistant
|
| 13 |
from backend.db import SQLiteDB
|
| 14 |
from backend.vector_db import ChromaVectorDB
|
| 15 |
from backend.query_engine import QueryEngine
|
|
|
|
| 27 |
document_parser = DocumentParser()
|
| 28 |
document_agents = DocumentAgents()
|
| 29 |
|
| 30 |
+
# Initialize DocumentAssistant
|
| 31 |
+
document_assistant = DocumentAssistant()
|
| 32 |
+
|
| 33 |
# Define the prompt with examples
|
| 34 |
query_prompt = ChatPromptTemplate.from_messages(
|
| 35 |
[
|
|
|
|
| 95 |
# Log query to database
|
| 96 |
sqlite_db.log_query(query)
|
| 97 |
|
| 98 |
+
# Use DocumentAssistant to process the query
|
| 99 |
+
response = document_assistant.process_query(query)
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
# Update database with response
|
| 102 |
sqlite_db.log_query(query, response)
|