Saltar para o conteúdo principal
Versão: 21 R3 BETA

OpenAIChatCompletionsResult

Inherits

Propriedades calculadas

PropriedadeTipoDescrição
choicesCollectionRetorna uma coleção de OpenAIChoice da resposta do OpenAI.
choiceOpenAIChoiceRetorna o primeiro OpenAIChoice das opções da coleção.
utilizaçãoObjectReturns token usage information (inherited from OpenAIResult).

utilização

The usage property returns an object containing token usage information for chat completions.

CampoTipoDescrição
prompt_tokensIntegerNumber of tokens in the prompt.
completion_tokensIntegerNumber of tokens in the completion.
total_tokensIntegerTotal tokens used (prompt + completion).
prompt_tokens_detailsObjectBreakdown of prompt tokens (optional).
completion_tokens_detailsObjectBreakdown of completion tokens (optional).

prompt_tokens_details

CampoTipoDescrição
cached_tokensIntegerNumber of tokens served from cache.
audio_tokensIntegerNumber of audio tokens (if applicable).

completion_tokens_details

CampoTipoDescrição
reasoning_tokensIntegerTokens used for reasoning (e.g., o1 models).
audio_tokensIntegerNumber of audio tokens (if applicable).
accepted_prediction_tokensIntegerTokens from accepted predictions.
rejected_prediction_tokensIntegerTokens from rejected predictions.

Example response:

{
"prompt_tokens": 19,
"completion_tokens": 10,
"total_tokens": 29,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
}

Note: The *_tokens_details objects may not be present in all responses or from all providers.

Veja também