File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/flexible_inference_benchmark/engine Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -531,14 +531,14 @@ async def async_request_openai_chat_completions(
531
531
generated_text += reasoning_content
532
532
most_recent_timestamp = timestamp
533
533
534
- if "usage" in data :
535
- if data ["usage" ][ "completion_tokens" ] :
534
+ if "usage" in data and data [ "usage" ] is not None :
535
+ if data ["usage" ]. get ( "completion_tokens" ) :
536
536
output .output_len = int (data ["usage" ]["completion_tokens" ])
537
537
if process_span :
538
538
process_span .set_attribute (
539
539
"fib.completion_tokens" , output .output_len
540
540
)
541
- if data ["usage" ][ "prompt_tokens" ] :
541
+ if data ["usage" ]. get ( "prompt_tokens" ) :
542
542
output .prompt_len = int (data ["usage" ]["prompt_tokens" ])
543
543
if process_span :
544
544
process_span .set_attribute ("fib.prompt_tokens" , output .prompt_len )
You can’t perform that action at this time.
0 commit comments