-
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:
NeMo-Guardrails/nemoguardrails/rails/llm/llmrails.py
Line 368 in cb07be6
At this moment, we reset the stats at the beginning of each
generate_async
call:NeMo-Guardrails/nemoguardrails/rails/llm/llmrails.py
Line 336 in cb07be6
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?