TogetherAI commited on
Commit
4b145d4
1 Parent(s): 0c2bfe0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -11,20 +11,25 @@ client = InferenceClient(
11
  )
12
 
13
  def format_prompt(message, history):
14
- # Beginn der Eingabeaufforderung mit dem Anfangs-Token
15
- prompt = "<s>[INST] You are Ailex, a clone and close collaborator of Einfach.Alex. As a part of the EinfachChat team, you assist your mentor Alex in a multitude of projects and initiatives. Your expertise is broad and encompasses sales, customer consulting, AI, Prompt Engineering, web design, and media design. Your life motto is 'Simply.Do!'. You communicate exclusively in German. [/INST]"
16
-
17
- # Hinzufügen der Historie der Interaktionen
 
 
 
 
 
18
  for user_prompt, bot_response in history:
19
  prompt += f"[INST] {user_prompt} [/INST]"
20
- prompt += f" {bot_response} </s> " # Beenden jeder Antwort mit End-of-Sentence-Token
21
- prompt += "<s>" # Beginn jeder neuen Aufforderung mit Start-of-Sentence-Token
22
 
23
- # Hinzufügen der aktuellen Benutzereingabe
24
  prompt += f"[INST] {message} [/INST]"
25
 
26
  return prompt
27
 
 
28
  def generate(prompt, history, temperature=0.9, max_new_tokens=512, top_p=0.95, repetition_penalty=1.0):
29
  temperature = float(temperature)
30
  if temperature < 1e-2:
 
11
  )
12
 
13
  def format_prompt(message, history):
14
+ # Definiere den unsichtbaren Anfangsprompt innerhalb der Funktion
15
+ initial_prompt = ("<s>[INST] You are Ailex, a clone and close collaborator of Einfach.Alex. "
16
+ "As a part of the EinfachChat team, you assist your mentor Alex in a multitude of projects "
17
+ "and initiatives. Your expertise is broad and encompasses sales, customer consulting, AI, "
18
+ "Prompt Engineering, web design, and media design. Your life motto is 'Simply.Do!'. You communicate "
19
+ "exclusively in German. [/INST]")
20
+
21
+ # Der Rest des Codes bleibt gleich
22
+ prompt = initial_prompt
23
  for user_prompt, bot_response in history:
24
  prompt += f"[INST] {user_prompt} [/INST]"
25
+ prompt += f" {bot_response} </s> "
26
+ prompt += "<s>"
27
 
 
28
  prompt += f"[INST] {message} [/INST]"
29
 
30
  return prompt
31
 
32
+
33
  def generate(prompt, history, temperature=0.9, max_new_tokens=512, top_p=0.95, repetition_penalty=1.0):
34
  temperature = float(temperature)
35
  if temperature < 1e-2: