abishek-official commited on
Commit
37b28e0
·
verified ·
1 Parent(s): cec6e68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -22,17 +22,20 @@ hf = HuggingFaceHub(
22
 
23
  from langchain.memory import ConversationBufferWindowMemory
24
 
25
- memory = ConversationBufferWindowMemory(k=2)
26
- history =[]
27
 
28
  template = """
29
  You are Abi, a useful AI assistant and answer for user questions.
30
-
31
  Question: {question}
32
  Answer:
33
  """
34
  # prompt = PromptTemplate.from_template(template)
35
- promt = PromptTemplate(template = template, input_variables=['question'])
 
 
 
 
36
  llm_chain = LLMChain(llm=hf, prompt=promt, memory= memory,verbose = False)
37
 
38
  def ask_bot(query,hist = history):
 
22
 
23
  from langchain.memory import ConversationBufferWindowMemory
24
 
25
+
 
26
 
27
  template = """
28
  You are Abi, a useful AI assistant and answer for user questions.
29
+ {chat_history}
30
  Question: {question}
31
  Answer:
32
  """
33
  # prompt = PromptTemplate.from_template(template)
34
+ promt = PromptTemplate(template = template, input_variables=['chat_history','question'])
35
+
36
+ memory = ConversationBufferMemory(memory_key="chat_history")
37
+ history =[]
38
+
39
  llm_chain = LLMChain(llm=hf, prompt=promt, memory= memory,verbose = False)
40
 
41
  def ask_bot(query,hist = history):