Refactor text_generation.py, add support for custom generation functions (#1817)
This commit is contained in:
parent
876fbb97c0
commit
8aafb1f796
12 changed files with 289 additions and 195 deletions
|
@ -266,8 +266,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||
stopping_strings += standard_stopping_strings
|
||||
req_params['custom_stopping_strings'] = stopping_strings
|
||||
|
||||
shared.args.no_stream = not req_params['stream']
|
||||
if not shared.args.no_stream:
|
||||
if req_params['stream']:
|
||||
shared.args.chat = True
|
||||
# begin streaming
|
||||
chunk = {
|
||||
|
@ -337,7 +336,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||
if buffer_and_continue:
|
||||
continue
|
||||
|
||||
if not shared.args.no_stream:
|
||||
if req_params['stream']:
|
||||
# Streaming
|
||||
new_content = answer[len_seen:]
|
||||
|
||||
|
@ -365,7 +364,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||
self.wfile.write(response.encode('utf-8'))
|
||||
completion_token_count += len(encode(new_content)[0])
|
||||
|
||||
if not shared.args.no_stream:
|
||||
if req_params['stream']:
|
||||
chunk = {
|
||||
"id": cmpl_id,
|
||||
"object": stream_object_type,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue