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.

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

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:

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

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:

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:

  • audio_embeds (MultiModalEmbedsPayload | None) –

    The video's audio track when use_audio_in_video=True, sharing its UUID.

  • 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:

audio_embeds instance-attribute

The video's audio track when use_audio_in_video=True, sharing its UUID.

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:

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.

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

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" }

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

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

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.

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 | ChatCompletionContentPartPromptEmbedsParam | 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.

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:

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.

VideoURL

Bases: TypedDict

Attributes:

  • 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.