Class CompletionUsage
java.lang.Object
com.sap.ai.sdk.foundationmodels.openai.generated.model.CompletionUsage
Usage statistics for the completion request.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompletionTokens(Integer completionTokens) Set the completionTokens of thisCompletionUsageinstance and return the same instance.completionTokensDetails(CompletionUsageCompletionTokensDetails completionTokensDetails) Set the completionTokensDetails of thisCompletionUsageinstance and return the same instance.booleanNumber of tokens in the generated completion.Get completionTokensDetailsgetCustomField(String name) Deprecated.Get the names of the unrecognizable properties of theCompletionUsage.Number of tokens in the prompt.Total number of tokens used in the request (prompt + completion).inthashCode()promptTokens(Integer promptTokens) Set the promptTokens of thisCompletionUsageinstance and return the same instance.voidsetCompletionTokens(Integer completionTokens) Set the completionTokens of thisCompletionUsageinstance.voidsetCompletionTokensDetails(CompletionUsageCompletionTokensDetails completionTokensDetails) Set the completionTokensDetails of thisCompletionUsageinstance.voidsetCustomField(String customFieldName, Object customFieldValue) Set an unrecognizable property of thisCompletionUsageinstance.voidsetPromptTokens(Integer promptTokens) Set the promptTokens of thisCompletionUsageinstance.voidsetTotalTokens(Integer totalTokens) Set the totalTokens of thisCompletionUsageinstance.toMap()Get the value of all properties of thisCompletionUsageinstance including unrecognized properties.toString()totalTokens(Integer totalTokens) Set the totalTokens of thisCompletionUsageinstance and return the same instance.
-
Constructor Details
-
CompletionUsage
public CompletionUsage()
-
-
Method Details
-
promptTokens
Set the promptTokens of thisCompletionUsageinstance and return the same instance.- Parameters:
promptTokens- Number of tokens in the prompt.- Returns:
- The same instance of this
CompletionUsageclass
-
getPromptTokens
Number of tokens in the prompt.- Returns:
- promptTokens The promptTokens of this
CompletionUsageinstance.
-
setPromptTokens
Set the promptTokens of thisCompletionUsageinstance.- Parameters:
promptTokens- Number of tokens in the prompt.
-
completionTokens
Set the completionTokens of thisCompletionUsageinstance and return the same instance.- Parameters:
completionTokens- Number of tokens in the generated completion.- Returns:
- The same instance of this
CompletionUsageclass
-
getCompletionTokens
Number of tokens in the generated completion.- Returns:
- completionTokens The completionTokens of this
CompletionUsageinstance.
-
setCompletionTokens
Set the completionTokens of thisCompletionUsageinstance.- Parameters:
completionTokens- Number of tokens in the generated completion.
-
totalTokens
Set the totalTokens of thisCompletionUsageinstance and return the same instance.- Parameters:
totalTokens- Total number of tokens used in the request (prompt + completion).- Returns:
- The same instance of this
CompletionUsageclass
-
getTotalTokens
Total number of tokens used in the request (prompt + completion).- Returns:
- totalTokens The totalTokens of this
CompletionUsageinstance.
-
setTotalTokens
Set the totalTokens of thisCompletionUsageinstance.- Parameters:
totalTokens- Total number of tokens used in the request (prompt + completion).
-
completionTokensDetails
@Nonnull public CompletionUsage completionTokensDetails(@Nullable CompletionUsageCompletionTokensDetails completionTokensDetails) Set the completionTokensDetails of thisCompletionUsageinstance and return the same instance.- Parameters:
completionTokensDetails- The completionTokensDetails of thisCompletionUsage- Returns:
- The same instance of this
CompletionUsageclass
-
getCompletionTokensDetails
Get completionTokensDetails- Returns:
- completionTokensDetails The completionTokensDetails of this
CompletionUsageinstance.
-
setCompletionTokensDetails
public void setCompletionTokensDetails(@Nullable CompletionUsageCompletionTokensDetails completionTokensDetails) Set the completionTokensDetails of thisCompletionUsageinstance.- Parameters:
completionTokensDetails- The completionTokensDetails of thisCompletionUsage
-
getCustomFieldNames
Get the names of the unrecognizable properties of theCompletionUsage.- Returns:
- The set of properties names
-
getCustomField
@Nullable @Deprecated public Object getCustomField(@Nonnull String name) throws NoSuchElementException Deprecated.UsetoMap()instead.Get the value of an unrecognizable property of thisCompletionUsageinstance.- Parameters:
name- The name of the property- Returns:
- The value of the property
- Throws:
NoSuchElementException- If no property with the given name could be found.
-
toMap
Get the value of all properties of thisCompletionUsageinstance including unrecognized properties.- Returns:
- The map of all properties
-
setCustomField
Set an unrecognizable property of thisCompletionUsageinstance. If the map previously contained a mapping for the key, the old value is replaced by the specified value.- Parameters:
customFieldName- The name of the propertycustomFieldValue- The value of the property
-
equals
-
hashCode
public int hashCode() -
toString
-
toMap()instead.