MD1998 commited on
Commit
5243e66
·
verified ·
1 Parent(s): 1f67093

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -48,6 +48,11 @@ from langchain import PromptTemplate
48
  from langchain import LLMChain
49
  from langchain.llms import CTransformers
50
 
 
 
 
 
 
51
  # Update the model path to use the Hugging Face model identifier
52
  llm = CTransformers(model='TheBloke/Llama-2-7B-Chat-GGML',
53
  model_file='llama-2-7b-chat.ggmlv3.q3_K_S.bin',
@@ -56,6 +61,12 @@ llm = CTransformers(model='TheBloke/Llama-2-7B-Chat-GGML',
56
  'temperature': 0.01}
57
  )
58
 
 
 
 
 
 
 
59
  def greet(my_prompt):
60
 
61
  B_INST, E_INST = "[INST]", "[/INST]"
@@ -90,7 +101,7 @@ def greet(my_prompt):
90
  prompt = PromptTemplate(template=template, input_variables=["text"])
91
 
92
 
93
- LLM_Chain = LLMChain(prompt=prompt, llm=llm)
94
 
95
  # print(LLM_Chain.run("How are you"))
96
 
 
48
  from langchain import LLMChain
49
  from langchain.llms import CTransformers
50
 
51
+ from langchain.memory import ConversationBufferWindowMemory
52
+
53
+ memory = ConversationBufferWindowMemory()
54
+
55
+
56
  # Update the model path to use the Hugging Face model identifier
57
  llm = CTransformers(model='TheBloke/Llama-2-7B-Chat-GGML',
58
  model_file='llama-2-7b-chat.ggmlv3.q3_K_S.bin',
 
61
  'temperature': 0.01}
62
  )
63
 
64
+ # convo = ConversationChain(
65
+ # llm=llm,
66
+ # memory=memory
67
+ # )
68
+ # convo.run("Who won the first cricket world cup?")
69
+
70
  def greet(my_prompt):
71
 
72
  B_INST, E_INST = "[INST]", "[/INST]"
 
101
  prompt = PromptTemplate(template=template, input_variables=["text"])
102
 
103
 
104
+ LLM_Chain = LLMChain(prompt=prompt, llm=llm, memory=memory)
105
 
106
  # print(LLM_Chain.run("How are you"))
107