Spaces:
Sleeping
Sleeping
Commit ·
ccd9d86
1
Parent(s): 8e0613c
change made in the Prompt for better optimization of RAG search
Browse files
main.py
CHANGED
|
@@ -82,8 +82,10 @@ You are a query analysis agent. Your task is to transform a user's query into a
|
|
| 82 |
**User's Query:** "{{user_query}}"
|
| 83 |
**Your Task:**
|
| 84 |
1. Rephrase the user's query into a clear, keyword-focused English question suitable for a database search.
|
| 85 |
-
2.
|
| 86 |
-
3.
|
|
|
|
|
|
|
| 87 |
"""
|
| 88 |
ANSWER_SYSTEM_PROMPT = """
|
| 89 |
You are an expert AI assistant for a premier real estate developer.
|
|
@@ -146,7 +148,7 @@ async def get_agent_response(user_text: str) -> str:
|
|
| 146 |
logging.info("Initial search returned no results. Performing a broader fallback search.")
|
| 147 |
retrieved_docs = vector_store.similarity_search(search_query, k=3) # No filter this time
|
| 148 |
# --- END OF MODIFICATION ---
|
| 149 |
-
|
| 150 |
context_text = "\n\n".join([doc.page_content for doc in retrieved_docs])
|
| 151 |
logging.info(f"Retrieved Context: {context_text[:500]}...")
|
| 152 |
|
|
|
|
| 82 |
**User's Query:** "{{user_query}}"
|
| 83 |
**Your Task:**
|
| 84 |
1. Rephrase the user's query into a clear, keyword-focused English question suitable for a database search.
|
| 85 |
+
2. Analyze the user's query for keywords indicating project status (e.g., "ongoing", "under construction", "completed", "finished", "upcoming", "new launch").
|
| 86 |
+
3. If such status keywords are present, identify the single most relevant table from the list above to filter by.
|
| 87 |
+
4. If no specific status keywords are mentioned (e.g., the user asks generally about projects in a location), set the filter table to null.
|
| 88 |
+
5. Respond ONLY with a JSON object containing "search_query" and "filter_table" (which should be the table name string or null).
|
| 89 |
"""
|
| 90 |
ANSWER_SYSTEM_PROMPT = """
|
| 91 |
You are an expert AI assistant for a premier real estate developer.
|
|
|
|
| 148 |
logging.info("Initial search returned no results. Performing a broader fallback search.")
|
| 149 |
retrieved_docs = vector_store.similarity_search(search_query, k=3) # No filter this time
|
| 150 |
# --- END OF MODIFICATION ---
|
| 151 |
+
|
| 152 |
context_text = "\n\n".join([doc.page_content for doc in retrieved_docs])
|
| 153 |
logging.info(f"Retrieved Context: {context_text[:500]}...")
|
| 154 |
|