Skip to content

vllm.entrypoints.pooling.embed.protocol

Embedding API protocol models for OpenAI and Cohere formats.

OpenAI: https://platform.openai.com/docs/api-reference/embeddings Cohere: https://docs.cohere.com/reference/embed

Classes:

Functions:

EmbeddingBatchChatInputRequest

Bases: EmbeddingBatchChatRequest

OpenAI embeddings request with batched chat conversations in input.

EmbeddingBatchChatRequest

Bases: PoolingBasicRequestMixin, ChatRequestOptionsMixin, EmbedRequestMixin, EmbeddingTokenizeParamsMixin

OpenAI embeddings request with batched top-level chat conversations.

Mirrors BatchChatCompletionRequest by keeping batched conversations in messages instead of introducing a separate batch-specific field.

EmbeddingChatInputRequest

Bases: EmbeddingChatRequest

OpenAI embeddings request with one chat conversation in input.

EmbeddingChatRequest

Bases: PoolingBasicRequestMixin, ChatRequestMixin, EmbedRequestMixin, EmbeddingTokenizeParamsMixin

OpenAI embeddings request with one top-level chat conversation.

_encode_base64_embeddings(float_embeddings)

Encode float embeddings as base64 (little-endian float32).

_pack_binary_embeddings(float_embeddings, signed)

Bit-pack float embeddings: positive -> 1, negative -> 0.

Bits are packed MSB-first, eight per byte.

build_typed_embeddings(float_embeddings, embedding_types)

Convert float embeddings to all requested Cohere embedding types.