Update app.py
Browse files
app.py
CHANGED
|
@@ -197,15 +197,18 @@ class HybridRetriever(BaseRetriever):
|
|
| 197 |
|
| 198 |
# --- SYSTEM PROMPT & PROMPT TEMPLATE
|
| 199 |
system_prompt = (
|
| 200 |
-
"You are a JSON data assistant. Always
|
| 201 |
-
"If
|
| 202 |
-
"
|
|
|
|
|
|
|
| 203 |
)
|
| 204 |
prompt = ChatPromptTemplate.from_messages([
|
| 205 |
("system", system_prompt),
|
| 206 |
-
("human", "
|
| 207 |
])
|
| 208 |
|
|
|
|
| 209 |
llm = ChatOpenAI(model="gpt-4.1", openai_api_key=OPENAI_API_KEY, temperature=0)
|
| 210 |
|
| 211 |
retriever = HybridRetriever(top_k=5)
|
|
|
|
| 197 |
|
| 198 |
# --- SYSTEM PROMPT & PROMPT TEMPLATE
|
| 199 |
system_prompt = (
|
| 200 |
+
"You are a JSON data assistant. Always answer using only the provided context records. "
|
| 201 |
+
"If a question mentions a person or entity (e.g. 'Johnny'), find all records where any field includes that name "
|
| 202 |
+
"(including as part of an email or username, e.g. customer_name: johnny, customer: johnny.appleseed@gmail.com). "
|
| 203 |
+
"If you find a relevant record, answer as directly as possible using its fields (e.g. 'Johnny spent $100'). "
|
| 204 |
+
"If you cannot find the answer, reply: 'I don’t have that information.'"
|
| 205 |
)
|
| 206 |
prompt = ChatPromptTemplate.from_messages([
|
| 207 |
("system", system_prompt),
|
| 208 |
+
("human", "Here are the most relevant records:\n{context}\n\nQuestion: {question}")
|
| 209 |
])
|
| 210 |
|
| 211 |
+
|
| 212 |
llm = ChatOpenAI(model="gpt-4.1", openai_api_key=OPENAI_API_KEY, temperature=0)
|
| 213 |
|
| 214 |
retriever = HybridRetriever(top_k=5)
|