Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,7 +40,7 @@ class QASystem:
|
|
| 40 |
self.memory = None
|
| 41 |
self.embeddings = None
|
| 42 |
self.client = None
|
| 43 |
-
self.pdf_dir = "
|
| 44 |
|
| 45 |
def load_pdf_documents(self):
|
| 46 |
documents = []
|
|
@@ -120,12 +120,12 @@ class QASystem:
|
|
| 120 |
if retrieved_docs:
|
| 121 |
context = ' '.join(m.content for m in retrieved_docs)
|
| 122 |
else:
|
| 123 |
-
context = "
|
| 124 |
|
| 125 |
system_prompt = (
|
| 126 |
-
"You are
|
| 127 |
-
"Always provide
|
| 128 |
-
"If the user query is not
|
| 129 |
f"\n\nContext:\n{context}"
|
| 130 |
)
|
| 131 |
|
|
@@ -139,11 +139,11 @@ class QASystem:
|
|
| 139 |
def generate(state: MessagesState):
|
| 140 |
retrieved_docs = [m for m in reversed(state["messages"]) if m.type == "tool"][::-1]
|
| 141 |
|
| 142 |
-
context = ' '.join(m.content for m in retrieved_docs) if retrieved_docs else "
|
| 143 |
|
| 144 |
system_prompt = (
|
| 145 |
-
"You are
|
| 146 |
-
"Your responses MUST be
|
| 147 |
f"\n\nContext:\n{context}"
|
| 148 |
)
|
| 149 |
|
|
|
|
| 40 |
self.memory = None
|
| 41 |
self.embeddings = None
|
| 42 |
self.client = None
|
| 43 |
+
self.pdf_dir = "pdfss"
|
| 44 |
|
| 45 |
def load_pdf_documents(self):
|
| 46 |
documents = []
|
|
|
|
| 120 |
if retrieved_docs:
|
| 121 |
context = ' '.join(m.content for m in retrieved_docs)
|
| 122 |
else:
|
| 123 |
+
context = "mountain bicycle technical knowledge"
|
| 124 |
|
| 125 |
system_prompt = (
|
| 126 |
+
"You are an AI assistant embedded within the Interactive Electronic Technical Manual (IETM) for Mountain Cycles.. "
|
| 127 |
+
"Always provide accurate responses with references to provided data. "
|
| 128 |
+
"If the user query is not technical-specific, still respond from a technical perspective."
|
| 129 |
f"\n\nContext:\n{context}"
|
| 130 |
)
|
| 131 |
|
|
|
|
| 139 |
def generate(state: MessagesState):
|
| 140 |
retrieved_docs = [m for m in reversed(state["messages"]) if m.type == "tool"][::-1]
|
| 141 |
|
| 142 |
+
context = ' '.join(m.content for m in retrieved_docs) if retrieved_docs else "mountain bicycle technical knowledge"
|
| 143 |
|
| 144 |
system_prompt = (
|
| 145 |
+
"You are an AI assistant embedded within the Interactive Electronic Technical Manual (IETM) for Mountain Cycles. "
|
| 146 |
+
"Your responses MUST be accurate, concise (5 sentences max)."
|
| 147 |
f"\n\nContext:\n{context}"
|
| 148 |
)
|
| 149 |
|