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.
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in AZURE-OPENAI
- Azure openai load testing mode
- Azure Open AI Embedding Skillset - Error in skill 'Azure OpenAI Embedding skill': 'uri' parameter cannot be null or empty
- Implement filtering in RetrievalQA chain
- How to invoke multiple LLM model in single chain or invoke multiple LLM model parallelly in Langchain?
- How to trace back content origin within a document from the query response of Azure AI Search?
- Open AI API Key missing
- Can't embed with model in Azure AI Studio
- Azure OpenAI and load balancer configuration using APIM
- Issues with File Parsing in Azure OpenAI Assistant
- Remove/exclude default response from langserve chain response while invoke method curl or postman with Pydantic Output Parser
- Azure OpenAI Service REST API
- How to use PandasAI with azure managed identity?
- unable to add SerpConnection for promptflow in VSCode
- Having Problems with AzureChatOpenAI()
- How to enable cross-language query search in Azure Cognitive Search with Ada Embeddings?
Related Questions in SEMANTIC-KERNEL
- How to Test GPT-4 LLM Response in a C# .NET Application Without Using Prompt Flow?
- Method not found exception when using Semantic Kernel in an Azure Functions app
- System.TypeLoadException: 'Could not load type 'Microsoft.SemanticKernel.Http.HttpOperationException
- Get the token usage from semantic kernel C#
- Semantic-Kernel throwing error when calling local Plugin
- Semantic Kernel Version 1.0.1
- StepWisePlanner is not compatible with the latest version of Microsoft.SemanticKernel (1.0.1)
- Semantic Kernel RAG Pattern Azure Open AI - Only Query Against My Data
- How to intercept generated prompts of kernel in SemanticKernel?
- SemanticKernel throws "Unrecognized request argument supplied: tools"
- Resource not found error when running miscrosoft semantic-kernel
- Semantic Kernel: The integration of chat and text completion services into the context does not utilize the models as expected
- Enabling Cognitive Search in Microsoft Chat Copilot / Semantic Kernel
- Loading a Huggingface Model with Microsofts Semantic Kernel in C# / VB.NET
- Python chatbot using semantic-kernel
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?
Popular Tags
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)
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.