Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.

Repository from Github https://github.comAzure/azure-sdk-for-jsRepository from Github https://github.comAzure/azure-sdk-for-js

@azure/ai-projects SDK samples: add example of getting usage data

diberry opened this issue · comments

Is your feature request related to a problem? Please describe.
There should be one example of the best/correct way to get usage data from a run. The ref docs and the npm page don't explain how to get that information.

Describe the solution you'd like
An example of when and how to get the usage data from a run.

const completedRun = await client.agents.getRun(thread.id, runId);
console.log("Usage data:", completedRun.usage);

Describe alternatives you've considered
The customers are going to need to know how to monitor usage in real-time. The TPM is too precious to monitor near real-time or periodly.

Additional context
Add any other context or screenshots about the feature request here.

Thanks @diberry, I am tracking the issue. And the pr is ready here
https://github.com/Azure/azure-sdk-for-js/pull/33556/files