-
| Hi guys, I am building a product that uses OpenAI API. For the usage & consumption information for user I need to retrieve the input and output tokens from OpenAI API response. Currently I have a microservice built in node and I retrieve the information from usage from OpenAI API response (below response from documentation). I want to implement guardrails in other service that I will call from my node.js one just for the completion but I need this info, is there any way I can retrieve this information from guardrails?  | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
| Hi @JesusMF23 , We have LLM stats for each call, see here how it is used: At this moment, we reset the stats at the beginning of each  But you can easily get the stats after each call and monitor the total usage for an app. Is this what you are looking for? | 
Beta Was this translation helpful? Give feedback.
Hi @JesusMF23 ,
We have LLM stats for each call, see here how it is used:
https://github.com/NVIDIA/NeMo-Guardrails/blob/cb07be6e04f345905d6cef03daf0c7ea8e11a372/nemoguardrails/rails/llm/llmrails.py#L368
At this moment, we reset the stats at the beginning of each
generate_asynccall:https://github.com/NVIDIA/NeMo-Guardrails/blob/cb07be6e04f345905d6cef03daf0c7ea8e11a372/nemoguardrails/rails/llm/llmrails.py#L336
But you can easily get the stats after each call and monitor the total usage for an app. Is this what you are looking for?