Skip to content

fix(usage): handle open ai usage with choices: [] #757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2025
Merged

Conversation

MarcMcIntosh
Copy link
Contributor

openai response stream can have choices: [] with usage.

@MarcMcIntosh MarcMcIntosh marked this pull request as ready for review May 6, 2025 13:08
@MarcMcIntosh MarcMcIntosh requested a review from alashchev17 May 6, 2025 13:09
export function mergeUsages(usages: (Usage | undefined)[]): Usage | undefined {
export function mergeUsages(
usages: (Usage | undefined | null)[],
): Usage | undefined | null {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we return Usage | undefined | null in mergeUsages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@MarcMcIntosh MarcMcIntosh merged commit ca76162 into dev May 8, 2025
2 checks passed
@MarcMcIntosh MarcMcIntosh deleted the openai-usage branch May 8, 2025 08:11
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.

2 participants