Skip to content

vllm.renderers.chat_utils.types

Classes:

AudioURL

Bases: TypedDict

Attributes:

  • url (Required[str]) –

    Either a URL of the audio or a data URL with base64 encoded audio data.

Source code in vllm/renderers/chat_utils/types.py
class AudioURL(TypedDict, total=False):
    url: Required[str]
    """
    Either a URL of the audio or a data URL with base64 encoded audio data.
    """

url instance-attribute

Either a URL of the audio or a data URL with base64 encoded audio data.

ChatCompletionContentPartAudioEmbedsParam

Bases: TypedDict

Attributes:

  • audio_embeds (MultiModalEmbedsPayload | None) –

    The audio embeddings. It can be either:

  • type (Required[Literal['audio_embeds']]) –

    The type of the content part.

  • uuid (str | None) –

    User-provided UUID of a media. User must guarantee that it is properly

Source code in vllm/renderers/chat_utils/types.py
class ChatCompletionContentPartAudioEmbedsParam(TypedDict, total=False):
    audio_embeds: MultiModalEmbedsPayload | None
    """
    The audio embeddings. It can be either:
    - A single base64 string representing a serialized torch tensor.
    - A dictionary of base64 tensors or numeric JSON metadata arrays.
    """
    type: Required[Literal["audio_embeds"]]
    """The type of the content part."""
    uuid: str | None
    """
    User-provided UUID of a media. User must guarantee that it is properly
    generated and unique for different medias.
    """

audio_embeds instance-attribute

The audio embeddings. It can be either: - A single base64 string representing a serialized torch tensor. - A dictionary of base64 tensors or numeric JSON metadata arrays.

type instance-attribute

The type of the content part.

uuid instance-attribute

User-provided UUID of a media. User must guarantee that it is properly generated and unique for different medias.

ChatCompletionContentPartAudioParam

Bases: TypedDict

Attributes:

Source code in vllm/renderers/chat_utils/types.py
class ChatCompletionContentPartAudioParam(TypedDict, total=False):
    audio_url: Required[AudioURL]

    type: Required[Literal["audio_url"]]
    """The type of the content part."""

type instance-attribute

The type of the content part.

ChatCompletionContentPartImageEmbedsParam

Bases: TypedDict

Attributes:

  • image_embeds (MultiModalEmbedsPayload | None) –

    The image embeddings. It can be either:

  • type (Required[Literal['image_embeds']]) –

    The type of the content part.

  • uuid (str | None) –

    User-provided UUID of a media. User must guarantee that it is properly

Source code in vllm/renderers/chat_utils/types.py
class ChatCompletionContentPartImageEmbedsParam(TypedDict, total=False):
    image_embeds: MultiModalEmbedsPayload | None
    """
    The image embeddings. It can be either:
    - A single base64 string.
    - A dictionary of base64 tensors or numeric JSON metadata arrays.
    """
    type: Required[Literal["image_embeds"]]
    """The type of the content part."""
    uuid: str | None
    """
    User-provided UUID of a media. User must guarantee that it is properly
    generated and unique for different medias.
    """

image_embeds instance-attribute

The image embeddings. It can be either: - A single base64 string. - A dictionary of base64 tensors or numeric JSON metadata arrays.

type instance-attribute

The type of the content part.

uuid instance-attribute

User-provided UUID of a media. User must guarantee that it is properly generated and unique for different medias.

ChatCompletionContentPartPromptEmbedsParam

Bases: TypedDict

Attributes:

Source code in vllm/renderers/chat_utils/types.py
class ChatCompletionContentPartPromptEmbedsParam(TypedDict, total=False):
    data: Required[str]
    """
    Base64-encoded bytes of a serialized `torch.Tensor` of shape
    `(num_tokens, hidden_size)`. The tensor's `dtype` and `hidden_size` must
    match the model's input embedding layer.
    """
    type: Required[Literal["prompt_embeds"]]
    """The type of the content part."""

data instance-attribute

Base64-encoded bytes of a serialized torch.Tensor of shape (num_tokens, hidden_size). The tensor's dtype and hidden_size must match the model's input embedding layer.

type instance-attribute

The type of the content part.

ChatCompletionContentPartVideoEmbedsParam

Bases: TypedDict

Attributes:

  • type (Required[Literal['video_embeds']]) –

    The type of the content part.

  • uuid (str | None) –

    User-provided UUID of a media. User must guarantee that it is properly

  • video_embeds (MultiModalEmbedsPayload | None) –

    The video embeddings. It can be either:

Source code in vllm/renderers/chat_utils/types.py
class ChatCompletionContentPartVideoEmbedsParam(TypedDict, total=False):
    video_embeds: MultiModalEmbedsPayload | None
    """
    The video embeddings. It can be either:
    - A single base64 string representing a serialized torch tensor.
    - A dictionary of base64 tensors or numeric JSON metadata arrays.
    """
    type: Required[Literal["video_embeds"]]
    """The type of the content part."""
    uuid: str | None
    """
    User-provided UUID of a media. User must guarantee that it is properly
    generated and unique for different medias.
    """

type instance-attribute

The type of the content part.

uuid instance-attribute

User-provided UUID of a media. User must guarantee that it is properly generated and unique for different medias.

video_embeds instance-attribute

The video embeddings. It can be either: - A single base64 string representing a serialized torch tensor. - A dictionary of base64 tensors or numeric JSON metadata arrays.

ChatCompletionContentPartVideoParam

Bases: TypedDict

Attributes:

Source code in vllm/renderers/chat_utils/types.py
class ChatCompletionContentPartVideoParam(TypedDict, total=False):
    video_url: Required[VideoURL]

    type: Required[Literal["video_url"]]
    """The type of the content part."""

type instance-attribute

The type of the content part.

ConversationMessage

Bases: TypedDict

Attributes:

  • content (str | None | list[dict[str, str]]) –

    The contents of the message

  • name (str | None) –

    The name of the function to call

  • reasoning (str | None) –

    The reasoning content for interleaved thinking.

  • reasoning_content (str | None) –

    Deprecated: The reasoning content for interleaved thinking.

  • role (Required[str]) –

    The role of the message's author.

  • task (str | None) –

    Model-specific task marker. Currently passed through for DeepSeek V4.

  • tool_call_id (str | None) –

    Tool call that this message is responding to.

  • tool_calls (list[ChatCompletionMessageToolCallParam] | None) –

    The tool calls generated by the model, such as function calls.

  • tools (list[ChatCompletionFunctionToolParam] | None) –

    The tools for developer role.

Source code in vllm/renderers/chat_utils/types.py
class ConversationMessage(TypedDict, total=False):
    role: Required[str]
    """The role of the message's author."""

    content: str | None | list[dict[str, str]]
    """The contents of the message"""

    tool_call_id: str | None
    """Tool call that this message is responding to."""

    name: str | None
    """The name of the function to call"""

    tool_calls: list[ChatCompletionMessageToolCallParam] | None
    """The tool calls generated by the model, such as function calls."""

    reasoning: str | None
    """The reasoning content for interleaved thinking."""

    reasoning_content: str | None
    """Deprecated: The reasoning content for interleaved thinking."""

    tools: list[ChatCompletionFunctionToolParam] | None
    """The tools for developer role."""

    task: str | None
    """Model-specific task marker. Currently passed through for DeepSeek V4."""

content instance-attribute

The contents of the message

name instance-attribute

The name of the function to call

reasoning instance-attribute

The reasoning content for interleaved thinking.

reasoning_content instance-attribute

Deprecated: The reasoning content for interleaved thinking.

role instance-attribute

The role of the message's author.

task instance-attribute

Model-specific task marker. Currently passed through for DeepSeek V4.

tool_call_id instance-attribute

Tool call that this message is responding to.

tool_calls instance-attribute

The tool calls generated by the model, such as function calls.

tools instance-attribute

The tools for developer role.

CustomChatCompletionContentPILImageParam

Bases: TypedDict

A simpler version of the param that only accepts a PIL image.

Example: { "image_pil": ImageAsset('cherry_blossom').pil_image }

Attributes:

  • uuid (str | None) –

    User-provided UUID of a media. User must guarantee that it is properly

Source code in vllm/renderers/chat_utils/types.py
class CustomChatCompletionContentPILImageParam(TypedDict, total=False):
    """A simpler version of the param that only accepts a PIL image.

    Example:
    {
        "image_pil": ImageAsset('cherry_blossom').pil_image
    }

    """

    image_pil: PILImage | None
    uuid: str | None
    """
    User-provided UUID of a media. User must guarantee that it is properly
    generated and unique for different medias.
    """

uuid instance-attribute

User-provided UUID of a media. User must guarantee that it is properly generated and unique for different medias.

CustomChatCompletionContentSimpleAudioParam

Bases: TypedDict

A simpler version of the param that only accepts a plain audio_url.

Example: { "audio_url": "https://example.com/audio.mp3" }

Source code in vllm/renderers/chat_utils/types.py
class CustomChatCompletionContentSimpleAudioParam(TypedDict, total=False):
    """A simpler version of the param that only accepts a plain audio_url.

    Example:
    {
        "audio_url": "https://example.com/audio.mp3"
    }

    """

    audio_url: str | None

CustomChatCompletionContentSimpleImageParam

Bases: TypedDict

A simpler version of the param that only accepts a plain image_url. This is supported by OpenAI API, although it is not documented.

Example: { "image_url": "https://example.com/image.jpg" }

Attributes:

  • uuid (str | None) –

    User-provided UUID of a media. User must guarantee that it is properly

Source code in vllm/renderers/chat_utils/types.py
class CustomChatCompletionContentSimpleImageParam(TypedDict, total=False):
    """A simpler version of the param that only accepts a plain image_url.
    This is supported by OpenAI API, although it is not documented.

    Example:
    {
        "image_url": "https://example.com/image.jpg"
    }

    """

    image_url: str | None
    uuid: str | None
    """
    User-provided UUID of a media. User must guarantee that it is properly
    generated and unique for different medias.
    """

uuid instance-attribute

User-provided UUID of a media. User must guarantee that it is properly generated and unique for different medias.

CustomChatCompletionContentSimpleVideoParam

Bases: TypedDict

A simpler version of the param that only accepts a plain audio_url.

Example: { "video_url": "https://example.com/video.mp4" }

Attributes:

  • uuid (str | None) –

    User-provided UUID of a media. User must guarantee that it is properly

Source code in vllm/renderers/chat_utils/types.py
class CustomChatCompletionContentSimpleVideoParam(TypedDict, total=False):
    """A simpler version of the param that only accepts a plain audio_url.

    Example:
    {
        "video_url": "https://example.com/video.mp4"
    }

    """

    video_url: str | None
    uuid: str | None
    """
    User-provided UUID of a media. User must guarantee that it is properly
    generated and unique for different medias.
    """

uuid instance-attribute

User-provided UUID of a media. User must guarantee that it is properly generated and unique for different medias.

CustomChatCompletionContentToolReferenceParam

Bases: TypedDict

A tool reference content param that only accepts a plain tool name.

Example: { "name": "get_weather", "type": "tool_reference" }

Attributes:

  • name (str) –

    The name of the tool being referenced.

  • type (Literal['tool_reference']) –

    The content type.

Source code in vllm/renderers/chat_utils/types.py
class CustomChatCompletionContentToolReferenceParam(TypedDict, total=False):
    """A tool reference content param that only accepts a plain tool name.

    Example:
    {
        "name": "get_weather",
        "type": "tool_reference"
    }

    """

    name: str
    """The name of the tool being referenced."""

    type: Literal["tool_reference"]
    """The content type."""

name instance-attribute

The name of the tool being referenced.

type instance-attribute

The content type.

CustomChatCompletionMessageParam

Bases: TypedDict

Enables custom roles in the Chat Completion API.

Attributes:

  • content (str | list[ChatCompletionContentPartParam]) –

    The contents of the message.

  • name (str) –

    An optional name for the participant.

  • reasoning (str | None) –

    The reasoning content for interleaved thinking.

  • role (Required[str]) –

    The role of the message's author.

  • task (str | None) –

    Model-specific task marker. Currently passed through for DeepSeek V4.

  • tool_call_id (str | None) –

    Tool call that this message is responding to.

  • tool_calls (list[ChatCompletionMessageToolCallParam] | None) –

    The tool calls generated by the model, such as function calls.

  • tools (list[ChatCompletionFunctionToolParam] | None) –

    The tools for developer role.

Source code in vllm/renderers/chat_utils/types.py
class CustomChatCompletionMessageParam(TypedDict, total=False):
    """Enables custom roles in the Chat Completion API."""

    role: Required[str]
    """The role of the message's author."""

    content: str | list[ChatCompletionContentPartParam]
    """The contents of the message."""

    name: str
    """An optional name for the participant.

    Provides the model information to differentiate between participants of the
    same role.
    """

    tool_call_id: str | None
    """Tool call that this message is responding to."""

    tool_calls: list[ChatCompletionMessageToolCallParam] | None
    """The tool calls generated by the model, such as function calls."""

    reasoning: str | None
    """The reasoning content for interleaved thinking."""

    tools: list[ChatCompletionFunctionToolParam] | None
    """The tools for developer role."""

    task: str | None
    """Model-specific task marker. Currently passed through for DeepSeek V4."""

content instance-attribute

The contents of the message.

name instance-attribute

An optional name for the participant.

Provides the model information to differentiate between participants of the same role.

reasoning instance-attribute

The reasoning content for interleaved thinking.

role instance-attribute

The role of the message's author.

task instance-attribute

Model-specific task marker. Currently passed through for DeepSeek V4.

tool_call_id instance-attribute

Tool call that this message is responding to.

tool_calls instance-attribute

The tool calls generated by the model, such as function calls.

tools instance-attribute

The tools for developer role.

CustomThinkCompletionContentParam

Bases: TypedDict

A Think Completion Content Param that accepts a plain text and a boolean.

Example: { "thinking": "I am thinking about the answer", "closed": True, "type": "thinking" }

Attributes:

Source code in vllm/renderers/chat_utils/types.py
class CustomThinkCompletionContentParam(TypedDict, total=False):
    """A Think Completion Content Param that accepts a plain text and a boolean.

    Example:
    {
        "thinking": "I am thinking about the answer",
        "closed": True,
        "type": "thinking"
    }

    """

    thinking: Required[str]
    """The thinking content."""

    closed: bool
    """Whether the thinking is closed."""

    type: Required[Literal["thinking"]]
    """The thinking type."""

closed instance-attribute

Whether the thinking is closed.

thinking instance-attribute

The thinking content.

type instance-attribute

The thinking type.

PILImage

Bases: BaseModel

A PIL.Image.Image object.

Source code in vllm/renderers/chat_utils/types.py
class PILImage(BaseModel):
    """A PIL.Image.Image object."""

    image_pil: Image.Image
    model_config = ConfigDict(arbitrary_types_allowed=True)

VideoURL

Bases: TypedDict

Attributes:

  • url (Required[str]) –

    Either a URL of the video or a data URL with base64 encoded video data.

Source code in vllm/renderers/chat_utils/types.py
class VideoURL(TypedDict, total=False):
    url: Required[str]
    """
    Either a URL of the video or a data URL with base64 encoded video data.
    """

url instance-attribute

Either a URL of the video or a data URL with base64 encoded video data.