Azure-Samples / Azure-Samples/openai
Missing usage information in npm azure/openai client response
- Dominant language
- Jupyter Notebook
- Stars
- 1.3k
- Forks
- 455
- Avg merge
- 16h 17m
- Merged PRs (30d)
- 1
Description
### 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:
> ``` Javascript
> 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
>

### 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.
Contributor guide
Assessment
This issue has not been assessed yet.