Skip to content

Conversation

@vnlitvinov
Copy link

This fixes #55 for a case when OpenAI-compatible server sends empty choices (according to OpenAI docs, this could happen for last chunk if certain stream_options are set).

This fixes ray-project#55

Signed-off-by: Vasily Litvinov <[email protected]>
generated_text += delta["content"]

if data["choices"]:
delta = data["choices"][0]["delta"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, sometimes I just get choices: [{}] from openai.

                        delta = data["choices"][0].get("delta", {})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Divide by zero: request_metrics[common_metrics.REQ_OUTPUT_THROUGHPUT] = num_output_tokens / request_metrics[common_metrics.E2E_LAT]

2 participants