ryan0303 commited on
Commit
3d7bf67
1 Parent(s): cc87f88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -10,7 +10,7 @@ from langchain_community.llms import HuggingFacePipeline
10
  from langchain.chains import ConversationChain
11
  from langchain.memory import ConversationBufferMemory
12
  from langchain_community.llms import HuggingFaceEndpoint
13
- from langchain import PromptTemplate
14
 
15
  from pathlib import Path
16
  import chromadb
@@ -168,12 +168,12 @@ def initialize_llmchain(llm_model, temperature, max_tokens, top_k, vector_db, pr
168
  retriever=vector_db.as_retriever()
169
  progress(0.8, desc="Defining retrieval chain...")
170
 
171
- prompt_template_string = f'''Your task is as follows: 1. Determine if the input {user_message} is compliant with the provided {context}. 2. If the requirement is compliant, report "This requirement is compliant." 3. If the requirement is not compliant report "This requirement is not compliant." 4. If the requirement is not compliant, give the reason for non compliance and return the specific rule or guideline the requirement violates. 5. If the requirement is not compliant, report a refined version of the requirement delimited in quotes that is compliant with the provided {context}.'''
172
 
173
  # Create a PromptTemplate object
174
  prompt_template = PromptTemplate(
175
  template=prompt_template_string,
176
- input_variables=["user_question"]
177
  )
178
 
179
 
 
10
  from langchain.chains import ConversationChain
11
  from langchain.memory import ConversationBufferMemory
12
  from langchain_community.llms import HuggingFaceEndpoint
13
+ from langchain.prompts import PromptTemplate
14
 
15
  from pathlib import Path
16
  import chromadb
 
168
  retriever=vector_db.as_retriever()
169
  progress(0.8, desc="Defining retrieval chain...")
170
 
171
+ prompt_template_string = f'''Your task is as follows: 1. Determine if the input {user_question} is compliant with the provided {context}. 2. If the requirement is compliant, report "This requirement is compliant." 3. If the requirement is not compliant report "This requirement is not compliant." 4. If the requirement is not compliant, give the reason for non compliance and return the specific rule or guideline the requirement violates. 5. If the requirement is not compliant, report a refined version of the requirement delimited in quotes that is compliant with the provided {context}.'''
172
 
173
  # Create a PromptTemplate object
174
  prompt_template = PromptTemplate(
175
  template=prompt_template_string,
176
+ input_variables=["user_question","context"]
177
  )
178
 
179