Skip to content

vllm.outputs

Classes:

  • ClassificationOutput –

    The output data of one classification output of a request.

  • CompletionOutput –

    The output data of one completion output of a request.

  • EmbeddingOutput –

    The output data of one embedding output of a request.

  • PoolingOutput –

    The output data of one pooling output of a request.

  • PoolingRequestOutput –

    The output data of a pooling request to the LLM.

  • RequestError –

    A request-level error that does not mark the engine as unhealthy.

  • RequestOutput –

    The output data of a completion request to the LLM.

  • SamplingMask –

    Per-token sampling support sets aligned with completion token IDs.

  • ScoringOutput –

    The output data of one scoring output of a request.

  • WeightVersionSpan –

    Output tokens [start, end) were sampled by weights labelled version.

ClassificationOutput dataclass

The output data of one classification output of a request.

Parameters:

  • probs

    (list[float]) –

    The probability vector, which is a list of floats. Its length depends on the number of classes.

CompletionOutput dataclass

The output data of one completion output of a request.

Parameters:

  • index

    (int) –

    The index of the output in the request.

  • text

    (str) –

    The generated output text.

  • token_ids

    (Sequence[int]) –

    The token IDs of the generated output text.

  • cumulative_logprob

    (float | None) –

    The cumulative log probability of the generated output text.

  • logprobs

    (SampleLogprobs | None) –

    The log probabilities of the top probability words at each position if the logprobs are requested.

  • sampling_mask

    (SamplingMask | None, default: None ) –

    The post-processing token support set for each generated token, if requested.

  • finish_reason

    (str | None, default: None ) –

    The reason why the sequence is finished.

  • stop_reason

    (int | str | None, default: None ) –

    The stop string or token id that caused the completion to stop, None if the completion finished for some other reason including encountering the EOS token.

  • lora_request

    (LoRARequest | None, default: None ) –

    The LoRA request that was used to generate the output.

  • spec_decode_metrics

    (RequestSpecDecodeMetrics | None, default: None ) –

    Per-sequence speculative-decoding acceptance metrics, populated on finish when speculative decoding ran and --per-request-spec-decode-metrics is enabled; None otherwise. Surfaced in the response as metrics.speculative_decoding for single-sequence (n == 1) requests.

  • weight_versions

    (list[WeightVersionSpan] | None, default: None ) –

    Contiguous weight version spans over output-token indexes. Set on the final output only.

EmbeddingOutput dataclass

The output data of one embedding output of a request.

Parameters:

  • embedding

    (list[float]) –

    The embedding vector, which is a list of floats. Its length depends on the hidden dimension of the model.

PoolingOutput dataclass

The output data of one pooling output of a request.

Parameters:

  • data

    (Tensor) –

    The extracted hidden states.

PoolingRequestOutput

Bases: Generic[_O]

The output data of a pooling request to the LLM.

Parameters:

  • request_id

    (str) –

    A unique identifier for the pooling request.

  • outputs

    (PoolingOutput) –

    The pooling results for the given input.

  • prompt_token_ids

    (list[int]) –

    A list of token IDs used in the prompt.

  • num_cached_tokens

    (int) –

    The number of tokens with prefix cache hit.

  • finished

    (bool) –

    A flag indicating whether the pooling is completed.

  • error

    (RequestError | None, default: None ) –

    Structured request-level error information, if the request failed.

  • late_chunking

    (LateChunkingMetadata | None, default: None ) –

    Token and source ranges for fixed-length late chunking.

RequestError dataclass

A request-level error that does not mark the engine as unhealthy.

RequestOutput

The output data of a completion request to the LLM.

Parameters:

  • request_id

    (str) –

    The unique ID of the request.

  • prompt

    (str | None) –

    The prompt string of the request. For encoder/decoder models, this is the decoder input prompt.

  • prompt_token_ids

    (list[int] | None) –

    The token IDs of the prompt. For encoder/decoder models, this is the decoder input prompt token ids.

  • prompt_logprobs

    (PromptLogprobs | None) –

    The log probabilities to return per prompt token.

  • prompt_token_id_logprobs

    (ndarray | None, default: None ) –

    Logprobs of prompt_logprob_token_ids, shaped [prompt_len - 1 - prompt_logprob_start, num_ids]; row i holds the logprobs of its own IDs as predictions of prompt token prompt_logprob_start + i + 1, with -inf in padded columns.

  • outputs

    (list[CompletionOutput]) –

    The output sequences of the request.

  • finished

    (bool) –

    Whether the whole request is finished.

  • metrics

    (RequestStateStats | None, default: None ) –

    Metrics associated with the request.

  • lora_request

    (LoRARequest | None, default: None ) –

    The LoRA request that was used to generate the output.

  • encoder_prompt

    (str | None, default: None ) –

    The encoder prompt string of the request. None if decoder-only.

  • encoder_prompt_token_ids

    (list[int] | None, default: None ) –

    The token IDs of the encoder prompt. None if decoder-only.

  • num_cached_tokens

    (int | None, default: None ) –

    The number of tokens with prefix cache hit.

  • num_cache_creation_tokens

    (int | None, default: None ) –

    Prompt tokens currently counted as local prefix-cache writes for this request.

  • kv_transfer_params

    (dict[str, Any] | None, default: None ) –

    The params for remote K/V transfer.

  • ec_transfer_params

    (dict[str, Any] | None, default: None ) –

    The params for remote encoder-cache transfer.

Methods:

  • add –

    Merge subsequent RequestOutput into this one

add(next_output, aggregate)

Merge subsequent RequestOutput into this one

SamplingMask dataclass

Per-token sampling support sets aligned with completion token IDs.

Each inner list contains the vocabulary token IDs that survived top-k / top-p / min-p filtering for the corresponding generated token.

ScoringOutput dataclass

The output data of one scoring output of a request.

Parameters:

  • score

    (float) –

    The similarity score, which is a scalar value.

WeightVersionSpan dataclass

Output tokens [start, end) were sampled by weights labelled version.