Update app.py
Browse files
app.py
CHANGED
@@ -154,12 +154,12 @@ def thread_response(msg_history: str, msg_prompt: str) -> dict:
|
|
154 |
|
155 |
generation_params = {"do_sample": True,"temperature": 0.7,"top_p": 0.95,"top_k": 40,"max_new_tokens": 512,"repetition_penalty": 1.1}
|
156 |
pipe = pipeline("text-generation",model=model, tokenizer=tokenizer, **generation_params)
|
157 |
-
|
158 |
|
159 |
-
if
|
160 |
|
161 |
prompt_template=f'''
|
162 |
-
<|im_start|>system{system_message}{
|
163 |
<|im_start|>user {msg_prompt}<|im_end|>
|
164 |
<|im_start|>assistant
|
165 |
'''
|
@@ -202,12 +202,12 @@ def chat_thread_response(ai_persona: str,msg_history: str, msg_prompt: str) -> d
|
|
202 |
|
203 |
generation_params = {"do_sample": True,"temperature": 0.7,"top_p": 0.95,"top_k": 40,"max_new_tokens": 512,"repetition_penalty": 1.1}
|
204 |
pipe = pipeline("text-generation",model=model, tokenizer=tokenizer, **generation_params)
|
205 |
-
|
206 |
|
207 |
-
if
|
208 |
|
209 |
prompt_template=f'''
|
210 |
-
<|im_start|>system{ai_persona}{
|
211 |
<|im_start|>user {msg_prompt}<|im_end|>
|
212 |
<|im_start|>assistant
|
213 |
'''
|
|
|
154 |
|
155 |
generation_params = {"do_sample": True,"temperature": 0.7,"top_p": 0.95,"top_k": 40,"max_new_tokens": 512,"repetition_penalty": 1.1}
|
156 |
pipe = pipeline("text-generation",model=model, tokenizer=tokenizer, **generation_params)
|
157 |
+
instructions= f''' incase you are asked about something you talked about the previous days or times or periods, use this as reference to recall {msg_history}. Do not point out everything just major keypoints. If nothing is mentioned about the past conversation ingore this. '''
|
158 |
|
159 |
+
if msg_history:
|
160 |
|
161 |
prompt_template=f'''
|
162 |
+
<|im_start|>system{system_message}{instructions}<|im_end|>
|
163 |
<|im_start|>user {msg_prompt}<|im_end|>
|
164 |
<|im_start|>assistant
|
165 |
'''
|
|
|
202 |
|
203 |
generation_params = {"do_sample": True,"temperature": 0.7,"top_p": 0.95,"top_k": 40,"max_new_tokens": 512,"repetition_penalty": 1.1}
|
204 |
pipe = pipeline("text-generation",model=model, tokenizer=tokenizer, **generation_params)
|
205 |
+
instructions= f''' Incase you are asked about something you talked about the previous days or times or periods, use this as reference to recall {msg_history}. Do not point out everything just major keypoints. If nothing is mentioned about the past conversation ingore this. '''
|
206 |
|
207 |
+
if msg_history:
|
208 |
|
209 |
prompt_template=f'''
|
210 |
+
<|im_start|>system{ai_persona}{instructions}<|im_end|>
|
211 |
<|im_start|>user {msg_prompt}<|im_end|>
|
212 |
<|im_start|>assistant
|
213 |
'''
|