request_output
Patched vLLM RequestOutput class with encrypted text fields.
Warning
Under almost no circumstances should you need to import this module directly. If stainedglass_output_protection is installed, and
you launch vLLM via the alternative entrypoint, this module will be automatically applied.
Classes:
| Name | Description |
|---|---|
EncryptedRequestOutput |
|
EncryptedRequestOutput
¶
Bases: RequestOutput
RequestOutput with user-facing text encrypted upon instantiation.
Methods:
| Name | Description |
|---|---|
__init__ |
Encrypt the string fields of a RequestOutput before initializing it. |
add |
Merge subsequent RequestOutput into this one, accounting for encrypted fields. |
encrypt |
Encrypt the string fields of the RequestOutput in place. |
Attributes:
| Name | Type | Description |
|---|---|---|
key_registry |
Mapping[str, bytes | None]
|
Read only typed reference to the class's shared key registry. |
key_registry
property
¶
Read only typed reference to the class's shared key registry.
__init__
¶
__init__(
request_id: str,
prompt: str | None,
prompt_token_ids: list[int] | None,
prompt_logprobs: PromptLogprobs | None,
outputs: list[CompletionOutput],
finished: bool,
metrics: RequestStateStats | None = None,
lora_request: LoRARequest | None = None,
encoder_prompt: str | None = None,
encoder_prompt_token_ids: list[int] | None = None,
num_cached_tokens: int | None = None,
*,
multi_modal_placeholders: MultiModalPlaceholderDict
| None = None,
kv_transfer_params: dict[str, Any] | None = None,
**kwargs: Any,
) -> None
Encrypt the string fields of a RequestOutput before initializing it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The unique ID of the request. |
required |
|
str | None
|
The prompt string of the request. For encoder/decoder models, this is the decoder input prompt. |
required |
|
list[int] | None
|
The token IDs of the prompt. For encoder/decoder models, this is the decoder input prompt token ids. |
required |
|
PromptLogprobs | None
|
The log probabilities to return per prompt token. |
required |
|
list[CompletionOutput]
|
The output sequences of the request. |
required |
|
bool
|
Whether the whole request is finished. |
required |
|
RequestStateStats | None
|
Metrics associated with the request. |
None
|
|
LoRARequest | None
|
The LoRA request that was used to generate the output. |
None
|
|
str | None
|
The encoder prompt string of the request. None if decoder-only. |
None
|
|
list[int] | None
|
The token IDs of the encoder prompt. None if decoder-only. |
None
|
|
int | None
|
The number of tokens with prefix cache hit. |
None
|
|
MultiModalPlaceholderDict | None
|
Placeholder data for multimodal requests. |
None
|
|
dict[str, Any] | None
|
The params for remote K/V transfer. |
None
|
|
Any
|
Keyword arguments for |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If |
NotImplementedError
|
If |
NotImplementedError
|
If |
NotImplementedError
|
If |
add
¶
add(next_output: RequestOutput, aggregate: bool) -> None
Merge subsequent RequestOutput into this one, accounting for encrypted fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
RequestOutput
|
The next RequestOutput to merge. |
required |
|
bool
|
Whether to aggregate metrics. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
encrypt
¶
Encrypt the string fields of the RequestOutput in place.
This method can be used to re-encrypt the fields if they were modified after initialization.