Update run.py
Browse files
run.py
CHANGED
|
@@ -96,20 +96,41 @@ collection = client.get_collection(name="chromaTS", embedding_function=sentence_
|
|
| 96 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 97 |
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
def format_prompt(message, history):
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
def response(
|
| 115 |
prompt, history,temperature=0.9, max_new_tokens=500, top_p=0.95, repetition_penalty=1.0,
|
|
|
|
| 96 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 97 |
|
| 98 |
|
| 99 |
+
#def format_prompt(message, history):
|
| 100 |
+
#print("HISTORY")
|
| 101 |
+
#print(history)
|
| 102 |
+
#prompt = "" #"<s>"
|
| 103 |
+
#c=1
|
| 104 |
+
#for user_prompt, bot_response in history:
|
| 105 |
+
# if c<2:
|
| 106 |
+
# prompt += f"[INST] {user_prompt} [/INST]"
|
| 107 |
+
# prompt += f" {bot_response}</s> "
|
| 108 |
+
# c=c+1
|
| 109 |
+
#prompt += f"[INST] {message} [/INST]"
|
| 110 |
+
#print("Final P")
|
| 111 |
+
#print(prompt)
|
| 112 |
+
#return prompt
|
| 113 |
+
|
| 114 |
def format_prompt(message, history):
|
| 115 |
+
print("HISTORY")
|
| 116 |
+
print(history)
|
| 117 |
+
|
| 118 |
+
# Initialize prompt with an empty string
|
| 119 |
+
prompt = ""
|
| 120 |
+
|
| 121 |
+
# Check if history is not empty
|
| 122 |
+
if history:
|
| 123 |
+
# Extract the most recent user prompt and bot response
|
| 124 |
+
user_prompt, bot_response = history[-1]
|
| 125 |
+
prompt += f"[INST] {user_prompt} [/INST] {bot_response}</s> "
|
| 126 |
+
|
| 127 |
+
# Add the new message to the prompt
|
| 128 |
+
prompt += f"[INST] {message} [/INST]"
|
| 129 |
+
|
| 130 |
+
print("Final P")
|
| 131 |
+
print(prompt)
|
| 132 |
+
|
| 133 |
+
return prompt
|
| 134 |
|
| 135 |
def response(
|
| 136 |
prompt, history,temperature=0.9, max_new_tokens=500, top_p=0.95, repetition_penalty=1.0,
|