Skip to content

registry

User key registry for Stained Glass Output Protection in vLLM, shared across all vLLM processes.

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.

Functions:

Name Description
get_shared_registry

Get the shared registry for managing keys across vLLM processes.

remove_key

Remove a key from the registry by first marking it as a sentinel allowing existing generation steps to not crash and then remove

get_shared_registry

get_shared_registry() -> MutableMapping[str, bytes | None]

Get the shared registry for managing keys across vLLM processes.

This function provides access to a shared dictionary that maps string keys to optional byte values.

Returns:

Type Description
MutableMapping[str, bytes | None]

A mutable mapping representing the shared key registry.

remove_key async

remove_key(
    request_id: str,
    shared_registry: MutableMapping[str, bytes | None],
) -> None

Remove a key from the registry by first marking it as a sentinel allowing existing generation steps to not crash and then remove after 60 seconds.

Parameters:

Name Type Description Default

request_id

str

Request to remove from the registry.

required

shared_registry

MutableMapping[str, bytes | None]

Shared registry from which to delete key.

required