ArturG9 commited on
Commit
e3d0a33
·
verified ·
1 Parent(s): 9246848

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -17,7 +17,7 @@ from langchain_community.document_loaders.directory import DirectoryLoader
17
  from langchain_core.output_parsers import StrOutputParser
18
  from langchain_core.runnables import RunnablePassthrough
19
  from langchain_experimental.chat_models import Llama2Chat
20
- from langchain_experimental.chat_models.system_messages import SystemMessage
21
 
22
  lang_api_key = os.getenv("lang_api_key")
23
 
@@ -176,7 +176,9 @@ def create_conversational_rag_chain(retriever):
176
 
177
  model = Llama2Chat(
178
  llm=llm,
179
- system_message=SystemMessage(content="You are a legal assistant providing concise, formal, and professional responses based on legal documents. Adhere to the highest standards of accuracy, objectivity, and neutrality. Avoid making assumptions or expressing personal opinions. If a query is unclear or lacks sufficient detail, politely request clarification. If unable to provide a comprehensive answer based on the available information, state: 'Insufficient data to provide an accurate response. Please rephrase the question or provide additional context.'")
 
 
180
  )
181
 
182
  template = """Answer the question in a natural language, based only on the following context:
 
17
  from langchain_core.output_parsers import StrOutputParser
18
  from langchain_core.runnables import RunnablePassthrough
19
  from langchain_experimental.chat_models import Llama2Chat
20
+
21
 
22
  lang_api_key = os.getenv("lang_api_key")
23
 
 
176
 
177
  model = Llama2Chat(
178
  llm=llm,
179
+ system_message={
180
+ "content": "You are a legal assistant providing concise, formal, and professional responses based on legal documents. Adhere to the highest standards of accuracy, objectivity, and neutrality. Avoid making assumptions or expressing personal opinions. If a query is unclear or lacks sufficient detail, politely request clarification. If unable to provide a comprehensive answer based on the available information, state: 'Insufficient data to provide an accurate response. Please rephrase the question or provide additional context.'"
181
+ }
182
  )
183
 
184
  template = """Answer the question in a natural language, based only on the following context: