rwitz commited on
Commit
45d1701
1 Parent(s): 8e00642

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -82,24 +82,20 @@ import os
82
 
83
 
84
  # Function to get bot response
85
- def format_alpaca_prompt(state):
86
- alpaca_prompt = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
87
- alpaca_prompt2 = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
88
  for message in state["history"][0]:
89
- j=""
90
- if message['role']=='user':
91
- j="### Instruction:\n"
92
  else:
93
- j="### Response:\n"
94
- alpaca_prompt += j+ message['content']+"\n\n"
95
  for message in state["history"][1]:
96
- j=""
97
- if message['role']=='user':
98
- j="### Instruction:\n"
99
  else:
100
- j="### Response:\n"
101
- alpaca_prompt2 += j+ message['content']+"\n\n"
102
- return [alpaca_prompt+"### Response:\n",alpaca_prompt2+"### Response:\n"]
103
  import aiohttp
104
  import asyncio
105
  from tenacity import retry, stop_after_attempt, wait_exponential
 
82
 
83
 
84
  # Function to get bot response
85
+ def format_chatml_prompt(state):
86
+ chatml_prompt = "<|im_start|>system You are a helpful assistant, who can think outside the box.<|im_end|>"
87
+ chatml_prompt2 = "<|im_start|>system You are a helpful assistant, who can think outside the box.<|im_end|>"
88
  for message in state["history"][0]:
89
+ if message['role'] == 'user':
90
+ chatml_prompt += "\n<|im_start|>user " + message['content'] + "<|im_end|>"
 
91
  else:
92
+ chatml_prompt += "\n<|im_start|>assistant " + message['content'] + "<|im_end|>"
 
93
  for message in state["history"][1]:
94
+ if message['role'] == 'user':
95
+ chatml_prompt2 += "\n<|im_start|>user " + message['content'] + "<|im_end|>"
 
96
  else:
97
+ chatml_prompt2 += "\n<|im_start|>assistant " + message['content'] + "<|im_end|>"
98
+ return [chatml_prompt + "\n<|im_start|>assistant", chatml_prompt2 + "\n<|im_start|>assistant"]
 
99
  import aiohttp
100
  import asyncio
101
  from tenacity import retry, stop_after_attempt, wait_exponential