jvnickerson commited on
Commit
f282186
·
verified ·
1 Parent(s): 6417feb

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. inf_chat.py +10 -2
inf_chat.py CHANGED
@@ -11,9 +11,17 @@ MODEL_OPTIONS = {
11
 
12
  def generate_text(message, history, model_choice):
13
  model = MODEL_OPTIONS[model_choice]
14
- prompt = f"{history}\nHuman: {message}\nAI:"
 
 
 
 
 
 
 
 
15
  output = client.text_generation(
16
- prompt,
17
  model=model,
18
  max_new_tokens=1000,
19
  temperature=0.8,
 
11
 
12
  def generate_text(message, history, model_choice):
13
  model = MODEL_OPTIONS[model_choice]
14
+
15
+ # Construct the conversation history
16
+ conversation = "You are an AI assistant. Respond to the user's questions accurately and concisely.\n\n"
17
+ for h in history:
18
+ conversation += f"Human: {h[0]}\nAI: {h[1]}\n\n"
19
+
20
+ # Add the current message
21
+ conversation += f"Human: {message}\nAI:"
22
+
23
  output = client.text_generation(
24
+ conversation,
25
  model=model,
26
  max_new_tokens=1000,
27
  temperature=0.8,