Class AzureOpenAiUsage
java.lang.Object
org.springframework.ai.azure.openai.metadata.AzureOpenAiUsage
- All Implemented Interfaces:
Usage
Usage
implementation for Microsoft Azure OpenAI Service.- Since:
- 0.7.0
- Author:
- John Blum
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AzureOpenAiUsage
from
(com.azure.ai.openai.models.ChatCompletions chatCompletions) static AzureOpenAiUsage
from
(com.azure.ai.openai.models.CompletionsUsage usage) Returns the number of tokens returned in the generation (aka completion) of the AI's response.Returns the number of tokens used in the prompt of the AI request.Return the total number of tokens from both the prompt of an AI request and generation of the AI's response.protected com.azure.ai.openai.models.CompletionsUsage
getUsage()
toString()
-
Constructor Details
-
AzureOpenAiUsage
public AzureOpenAiUsage(com.azure.ai.openai.models.CompletionsUsage usage)
-
-
Method Details
-
from
-
from
-
getUsage
protected com.azure.ai.openai.models.CompletionsUsage getUsage() -
getPromptTokens
Description copied from interface:Usage
Returns the number of tokens used in the prompt of the AI request.- Specified by:
getPromptTokens
in interfaceUsage
- Returns:
- an
Long
with the number of tokens used in the prompt of the AI request. - See Also:
-
getGenerationTokens
Description copied from interface:Usage
Returns the number of tokens returned in the generation (aka completion) of the AI's response.- Specified by:
getGenerationTokens
in interfaceUsage
- Returns:
- an
Long
with the number of tokens returned in the generation (aka completion) of the AI's response. - See Also:
-
getTotalTokens
Description copied from interface:Usage
Return the total number of tokens from both the prompt of an AI request and generation of the AI's response.- Specified by:
getTotalTokens
in interfaceUsage
- Returns:
- the total number of tokens from both the prompt of an AI request and generation of the AI's response.
- See Also:
-
toString
-