Spaces:
Sleeping
Sleeping
Commit ·
b63d969
1
Parent(s): da21908
refine response instructions for unanswered queries in RAGService
Browse files
app/services/RAG_service.py
CHANGED
|
@@ -9,7 +9,6 @@ from app.utils.metadata_utils import MetadataService
|
|
| 9 |
from langchain_core.documents import Document
|
| 10 |
import json
|
| 11 |
from langchain_community.retrievers import BM25Retriever
|
| 12 |
-
from langchain.schema import Document
|
| 13 |
|
| 14 |
# Global model instances (loaded once)
|
| 15 |
_embedding_model = None
|
|
@@ -155,7 +154,8 @@ class RAGService:
|
|
| 155 |
prompt = f"""
|
| 156 |
You are a legal/insurance domain expert and policy analyst.
|
| 157 |
Use the following extracted clauses from policy documents to answer the question.
|
| 158 |
-
If you can't find the answer, say
|
|
|
|
| 159 |
Context clauses:
|
| 160 |
{"".join(context_clauses)}
|
| 161 |
Question: {raw_query}
|
|
|
|
| 9 |
from langchain_core.documents import Document
|
| 10 |
import json
|
| 11 |
from langchain_community.retrievers import BM25Retriever
|
|
|
|
| 12 |
|
| 13 |
# Global model instances (loaded once)
|
| 14 |
_embedding_model = None
|
|
|
|
| 154 |
prompt = f"""
|
| 155 |
You are a legal/insurance domain expert and policy analyst.
|
| 156 |
Use the following extracted clauses from policy documents to answer the question.
|
| 157 |
+
If you can't find the answer, either say it is not available in the provided context or respond with whatever you can find gracefully.
|
| 158 |
+
Provide a concise and clear answer based on the context.
|
| 159 |
Context clauses:
|
| 160 |
{"".join(context_clauses)}
|
| 161 |
Question: {raw_query}
|