CCockrum commited on
Commit
7541ec0
·
verified ·
1 Parent(s): f9c30bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -81,9 +81,10 @@ def respond(message, history, level, max_tokens, temperature, top_p):
81
  # Generate response
82
  response = ""
83
  try:
84
- for msg in client.chat_completion(
85
- messages, max_tokens=max_tokens, stream=True, temperature=temperature, top_p=top_p
86
- ):
 
87
  token = msg.choices[0].delta.content
88
  if token is not None: # Handle None tokens
89
  response += token
 
81
  # Generate response
82
  response = ""
83
  try:
84
+ prompt = "\n".join([f"{m['role'].capitalize()}: {m['content']}" for m in messages])
85
+ for token in client.text_generation(prompt, max_new_tokens=max_tokens, stream=True, temperature=temperature, top_p=top_p):
86
+ response += token
87
+ yield response
88
  token = msg.choices[0].delta.content
89
  if token is not None: # Handle None tokens
90
  response += token