Skip to content
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

[OpenAI] Support token calculation in streaming API #40791

Open
mssfang opened this issue Jun 24, 2024 · 0 comments
Open

[OpenAI] Support token calculation in streaming API #40791

mssfang opened this issue Jun 24, 2024 · 0 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. OpenAI

Comments

@mssfang
Copy link
Member

mssfang commented Jun 24, 2024

OpenAI starts to support stream_options in the chat completion API.

We should look into how to support it in Azure OpenAI SDK for Java.

curl payload looks like below, it includes the "usage":{"prompt_tokens":11,"completion_tokens":60,"total_tokens":71}

data: {"id":"xxxW","object":"chat.completion.chunk","created":1719256033,"model":"gpt-3.5-turbo-0125","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"I"},"logprobs":null,"finish_reason":null}],"usage":null}


.......

data: {"id":"xxxW","object":"chat.completion.chunk","created":1719256033,"model":"gpt-3.5-turbo-0125","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}],"usage":null}

data: {"id":"xxxW","object":"chat.completion.chunk","created":1719256033,"model":"gpt-3.5-turbo-0125","system_fingerprint":null,"choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null}

data: {"id":"xxxW","object":"chat.completion.chunk","created":1719256033,"model":"gpt-3.5-turbo-0125","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":11,"completion_tokens":60,"total_tokens":71}}

data: [DONE]
@mssfang mssfang added Client This issue points to a problem in the data-plane of the library. OpenAI labels Jun 24, 2024
@mssfang mssfang self-assigned this Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. OpenAI
Projects
None yet
Development

No branches or pull requests

1 participant