pub struct ChatCompletion {Show 16 fields
pub id: String,
pub choices: Vec<Choice>,
pub created: u64,
pub model: String,
pub service_tier: Option<ServiceTier>,
pub system_fingerprint: Option<String>,
pub object: Option<ChatCompletionObject>,
pub usage: Option<CompletionUsage>,
pub moderation: Option<ChatModeration>,
pub prompt_logprobs: Option<Vec<Option<HashMap<u32, Logprob>>>>,
pub prompt_token_ids: Option<Vec<u32>>,
pub prompt_text: Option<String>,
pub kv_transfer_params: Option<Map<String, Value>>,
pub ec_transfer_params: Option<Map<String, Value>>,
pub request_id: Option<String>,
pub web_search: Option<Vec<WebSearchResult>>,
}Fields§
§id: StringA unique identifier for the chat completion.
choices: Vec<Choice>A list of chat completion choices. Can be more than one
if n is greater than 1.
created: u64The Unix timestamp (in seconds) of when the chat completion was created.
model: StringThe model used for the chat completion.
service_tier: Option<ServiceTier>Specifies the processing type used for serving the request.
- If set to ‘auto’, then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use ‘default’.
- If set to ‘default’, then the request will be processed with the standard pricing and performance for the selected model.
- If set to ‘flex’ or ‘priority’, then the request will be processed with the corresponding service tier.
- When not set, the default behavior is ‘auto’.
When the service_tier parameter is set, the response body will include the
service_tier value based on the processing mode actually used to serve the
request. This response value may be different from the value set in the
parameter.
system_fingerprint: Option<String>The system fingerprint used for the chat completion.
Can be used in conjunction with the seed request parameter to understand when
backend changes have been made that might impact determinism.
object: Option<ChatCompletionObject>The object type, which is always chat.completion.
Some only when the backend sends a recognized value; some
non-OpenAI gateways omit or repurpose the field.
usage: Option<CompletionUsage>Usage statistics for the completion request.
moderation: Option<ChatModeration>Moderation results for the request input and generated output.
Present when moderated completions are requested via the moderation
request parameter.
prompt_logprobs: Option<Vec<Option<HashMap<u32, Logprob>>>>vLLM: log probabilities of the prompt tokens, one entry per prompt
position, or null for positions the server did not report. Each
entry maps a token ID to its crate::vllm::Logprob.
Requested with vllm_sampling.prompt_logprobs; OpenAI has no
equivalent.
prompt_token_ids: Option<Vec<u32>>vLLM: the prompt’s token IDs after chat-template rendering.
prompt_text: Option<String>vLLM: the fully rendered prompt text.
Only set when the request set vllm_chat.return_prompt_text.
kv_transfer_params: Option<Map<String, Value>>vLLM: KV-transfer parameters for disaggregated prefill, echoing and
extending the request’s kv_transfer_params.
ec_transfer_params: Option<Map<String, Value>>vLLM: encoder-cache transfer parameters, echoing and extending the
request’s ec_transfer_params.
request_id: Option<String>Z.ai / GLM: the request identifier, echoing the request’s request_id
or the one GLM generated. Not part of the OpenAI schema.
web_search: Option<Vec<WebSearchResult>>Z.ai / GLM: the web-search results behind the answer, when the
web_search tool ran. Not part of the OpenAI schema.