I am trying out the semantic kernel in C# for a project. I am using the ChatCompletionService with Azure OpenAI and a few simple plugins that I created. I am not able to figure out how to get the token usage for a query. Any help would be appreciated. For example, in this solution that microsoft has, is there a way to get the token usage after each question (GetStreamingChatMessageContentsAsync)? One link I found was about logging in open telmetry standard. But it does not log the token usage. Any help is appreciated.
Get the token usage from semantic kernel C#
510 Views Asked by buchipper At
1
There are 1 best solutions below
Related Questions in C#
- SQL query: where array is in array
- Image 2x downsampling with Lanczos filter
- Simple Python Median Filter for time series
- Why doesn't this simple NSPredicate filter my array
- Get Exact Frequency From Digital Signal
- jquery filter chained select options
- Owl Carousel 2: filtering items, but keep the sort order using Javascript
- How to filter NSDictionary by value and create new NSDictionary from that?
- Spark: Filtering out aggregated data?
- Importing excel sheet
Related Questions in AZURE-OPENAI
- SQL query: where array is in array
- Image 2x downsampling with Lanczos filter
- Simple Python Median Filter for time series
- Why doesn't this simple NSPredicate filter my array
- Get Exact Frequency From Digital Signal
- jquery filter chained select options
- Owl Carousel 2: filtering items, but keep the sort order using Javascript
- How to filter NSDictionary by value and create new NSDictionary from that?
- Spark: Filtering out aggregated data?
- Importing excel sheet
Related Questions in SEMANTIC-KERNEL
- SQL query: where array is in array
- Image 2x downsampling with Lanczos filter
- Simple Python Median Filter for time series
- Why doesn't this simple NSPredicate filter my array
- Get Exact Frequency From Digital Signal
- jquery filter chained select options
- Owl Carousel 2: filtering items, but keep the sort order using Javascript
- How to filter NSDictionary by value and create new NSDictionary from that?
- Spark: Filtering out aggregated data?
- Importing excel sheet
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Considering the solution link you referenced in your question, one possible way to get this information is by making use of
Metadataproperty ofFunctionResult. Token information is contained inUsagekey in there which is of typeCompletionsUsage.Your code would be something like:
Please note that this information is not available just yet for streaming responses. For more details, please see this issue on GitHub: https://github.com/microsoft/semantic-kernel/issues/4691.