talsen89 commited on
Commit
d37cb1f
·
verified ·
1 Parent(s): cd6b6b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
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 = "google/gemma-2-27b-it"
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 an AI assistant with access to a vector database of legal knowledge containing court rulings from various cases.
40
- Your task is to retrieve relevant rulings from this database to answer questions posed by users.
41
- If the question cannot be answered based on the information in the vector database, respond with "I do not know."
42
- Your role is to provide factual information based on the rulings in the vector database.
43
- You are an AI assistant with access to a vector database of legal knowledge containing court rulings from various cases.
44
- Your task is to retrieve relevant rulings from this database to answer questions posed by users.
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)