xuqinyang commited on
Commit
3b01ff0
1 Parent(s): 3529567

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +3 -1
model.py CHANGED
@@ -19,9 +19,11 @@ def run(message: str,
19
  top_p: float = 0.95,
20
  top_k: int = 50) -> Iterator[str]:
21
  history = []
 
22
  for i in chat_history:
23
  history.append({"role": "user", "content": i[0]})
24
  history.append({"role": "assistant", "content": i[1]})
25
  for response in llm.create_chat_completion(history,stream=True,max_tokens=-1,temperature=0.3,top_k=5,top_p=0.85,repeat_penalty=1.1):
26
  if "content" in response["choices"][0]["delta"]:
27
- yield response["choices"][0]["delta"]["content"]
 
 
19
  top_p: float = 0.95,
20
  top_k: int = 50) -> Iterator[str]:
21
  history = []
22
+ result=""
23
  for i in chat_history:
24
  history.append({"role": "user", "content": i[0]})
25
  history.append({"role": "assistant", "content": i[1]})
26
  for response in llm.create_chat_completion(history,stream=True,max_tokens=-1,temperature=0.3,top_k=5,top_p=0.85,repeat_penalty=1.1):
27
  if "content" in response["choices"][0]["delta"]:
28
+ result = result + response["choices"][0]["delta"]["content"]
29
+ yield result