Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ class LegalChatBot:
|
|
| 24 |
db = FAISS.load_local(DB_FAISS_PATH, embeddings, allow_dangerous_deserialization=True)
|
| 25 |
|
| 26 |
# Load LLM strictly for formatting responses (not generating new facts)
|
| 27 |
-
repo_id = "
|
| 28 |
llm = HuggingFaceEndpoint(
|
| 29 |
repo_id=repo_id,
|
| 30 |
task="text-generation",
|
|
@@ -36,14 +36,12 @@ class LegalChatBot:
|
|
| 36 |
|
| 37 |
# Strict fact-based legal prompt
|
| 38 |
prompt_template = """
|
| 39 |
-
You are
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
If the question cannot be answered based on the information in the vector database, respond with "I do not know."
|
| 46 |
-
Your role is to provide factual information based on the rulings in the vector database.
|
| 47 |
"""
|
| 48 |
|
| 49 |
prompt = ChatPromptTemplate.from_template(prompt_template)
|
|
|
|
| 24 |
db = FAISS.load_local(DB_FAISS_PATH, embeddings, allow_dangerous_deserialization=True)
|
| 25 |
|
| 26 |
# Load LLM strictly for formatting responses (not generating new facts)
|
| 27 |
+
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 28 |
llm = HuggingFaceEndpoint(
|
| 29 |
repo_id=repo_id,
|
| 30 |
task="text-generation",
|
|
|
|
| 36 |
|
| 37 |
# Strict fact-based legal prompt
|
| 38 |
prompt_template = """
|
| 39 |
+
You are a teacher. The students will ask you a questions about their life. Use following piece of context to answer the question.
|
| 40 |
+
If you don't know the answer, just say you don't know.
|
| 41 |
+
You answer with short and concise answer and donot leave any sentence hanging.
|
| 42 |
+
Context: {context}
|
| 43 |
+
Question: {question}
|
| 44 |
+
Answer:
|
|
|
|
|
|
|
| 45 |
"""
|
| 46 |
|
| 47 |
prompt = ChatPromptTemplate.from_template(prompt_template)
|