chore: handle missing finish_reason

# What does this PR do?
Sometimes the stream don't have chunks with finish_reason, e.g. canceled stream, which throws a pydantic error as OpenAIChoice.finish_reason: str

## Test Plan
observe no more such error when benchmarking
This commit is contained in:
Eric Huang 2025-09-03 21:54:45 -07:00
parent 02f6e0f531
commit df873b8b27

View file

@ -755,7 +755,7 @@ class InferenceRouter(Inference):
choices_data[idx] = {
"content_parts": [],
"tool_calls_builder": {},
"finish_reason": None,
"finish_reason": "stop",
"logprobs_content_parts": [],
}
current_choice_data = choices_data[idx]