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

Missing usage information in npm azure/openai client response #40

Open
jliong-ch opened this issue Sep 1, 2023 · 1 comment
Open

Missing usage information in npm azure/openai client response #40

jliong-ch opened this issue Sep 1, 2023 · 1 comment

Comments

@jliong-ch
Copy link

jliong-ch commented Sep 1, 2023

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [X] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

On a Javascript application, install the package @azure/openai with npm install @azure/openai
This installs version v1.0.0-beta.5
Within the script, include:

const { OpenAIClient, AzureKeyCredential } = require("@azure/openai");

const client = new OpenAIClient(CHATGPT_EP, new AzureKeyCredential(CHATGPT_KEY));
const deploymentId = "DEPLOYMENT";
const data = await client.getChatCompletions(deploymentId, CHAT_LIST);

console.log(data);

Any log messages given by the failure

image

Expected/desired behavior

I expected the response to include have a field of "usage" (with all the tokens consumption details) as presented in example response in:
https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#example-response-2

OS and Version?

Windows Chrome

Versions

Package version is v1.0.0-beta.5 (azure/openai on npm)

Mention any other details that might be useful

I tried asking in the Microsoft Learn forum but was asked to raise an issue on the github repo, I'm not even sure if this is the right place.
However, I hope to know if it is still possible to somehow get that usage details included within the response without manually adding another tokenization package locally.
Appreciate your assistance.

@Krisell
Copy link

Krisell commented Sep 8, 2023

It seems to be fixed but not yet released
https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/openai/openai/CHANGELOG.md

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

No branches or pull requests

2 participants