@@ -245,11 +245,12 @@ async def async_request_openai_completions(
245
245
"max_tokens" : request_func_input .output_len ,
246
246
"logprobs" : request_func_input .logprobs ,
247
247
"stream" : True ,
248
- "ignore_eos" : request_func_input .ignore_eos ,
249
248
"stream_options" : {
250
249
"include_usage" : True ,
251
250
},
252
251
}
252
+ if request_func_input .ignore_eos :
253
+ payload ["ignore_eos" ] = request_func_input .ignore_eos
253
254
if request_func_input .extra_body :
254
255
payload .update (request_func_input .extra_body )
255
256
headers = {
@@ -297,7 +298,7 @@ async def async_request_openai_completions(
297
298
most_recent_timestamp )
298
299
299
300
most_recent_timestamp = timestamp
300
- generated_text += text
301
+ generated_text += text or ""
301
302
elif usage := data .get ("usage" ):
302
303
output .output_tokens = usage .get (
303
304
"completion_tokens" )
@@ -348,11 +349,12 @@ async def async_request_openai_chat_completions(
348
349
"temperature" : 0.0 ,
349
350
"max_completion_tokens" : request_func_input .output_len ,
350
351
"stream" : True ,
351
- "ignore_eos" : request_func_input .ignore_eos ,
352
352
"stream_options" : {
353
353
"include_usage" : True ,
354
354
},
355
355
}
356
+ if request_func_input .ignore_eos :
357
+ payload ["ignore_eos" ] = request_func_input .ignore_eos
356
358
if request_func_input .extra_body :
357
359
payload .update (request_func_input .extra_body )
358
360
headers = {
@@ -394,7 +396,7 @@ async def async_request_openai_chat_completions(
394
396
output .itl .append (timestamp -
395
397
most_recent_timestamp )
396
398
397
- generated_text += content
399
+ generated_text += content or ""
398
400
elif usage := data .get ("usage" ):
399
401
output .output_tokens = usage .get (
400
402
"completion_tokens" )
0 commit comments