Skip to main content

2 posts tagged with "embeddings"

View All Tags

Incident Report: vLLM Embeddings Broken by encoding_format Parameter

Sameer Kankute
SWE @ LiteLLM (LLM Translation)
Krrish Dholakia
CEO, LiteLLM
Ishaan Jaff
CTO, LiteLLM

Date: Feb 16, 2026 Duration: ~3 hours Severity: High (for vLLM embedding users) Status: Resolved

Summary​

A commit (dbcae4a) intended to fix OpenAI SDK behavior broke vLLM embeddings by explicitly passing encoding_format=None in API requests. vLLM rejects this with error: "unknown variant \`, expected float or base64"`.

  • vLLM embedding calls: Complete failure - all requests rejected
  • Other providers: No impact - OpenAI and other providers functioned normally
  • Other vLLM functionality: No impact - only embeddings were affected

Gemini Embedding 2 Preview: Multimodal Embeddings on LiteLLM

Sameer Kankute
SWE @ LiteLLM (LLM Translation)

LiteLLM now supports multimodal embeddings with gemini-embedding-2-previewβ€”generating a single embedding from a mix of text, images, audio, video, and PDF content. Available via both the Gemini API (API key) and Vertex AI (GCP credentials).

Supported Input Types​

ModalitySupported Formats
TextPlain text
ImagePNG, JPEG
AudioMP3, WAV
VideoMP4, MOV
DocumentsPDF

Input Formats​

LiteLLM accepts three input formats for multimodal content:

  1. Data URIs – Base64-encoded inline: data:image/png;base64,<encoded_data>
  2. GCS URLs – Cloud Storage paths (Vertex AI): gs://bucket/path/to/file.png
  3. Gemini File References – Pre-uploaded files (Gemini API): files/abc123

Quick Start​

from litellm import embedding
import os

os.environ["GEMINI_API_KEY"] = "your-api-key"

# Text + Image (base64)
response = embedding(
model="gemini/gemini-embedding-2-preview",
input=[
"The food was delicious and the waiter...",
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII"
],
)
print(response)

Input Format Examples​

FormatExampleProvider
Data URIdata:image/png;base64,...Gemini, Vertex AI
GCS URLgs://bucket/path/image.pngVertex AI
File referencefiles/abc123Gemini API only

Supported MIME Types for Data URIs​

  • Images: image/png, image/jpeg
  • Audio: audio/mpeg, audio/wav
  • Video: video/mp4, video/quicktime
  • Documents: application/pdf

GCS URL MIME Inference​

For Vertex AI, MIME types are inferred from file extensions:

  • .png β†’ image/png
  • .jpg / .jpeg β†’ image/jpeg
  • .mp3 β†’ audio/mpeg
  • .wav β†’ audio/wav
  • .mp4 β†’ video/mp4
  • .mov β†’ video/quicktime
  • .pdf β†’ application/pdf

Optional Parameters​

ParameterDescriptionMaps to
dimensionsOutput embedding sizeoutputDimensionality
response = embedding(
model="gemini/gemini-embedding-2-preview",
input=["text to embed"],
dimensions=768, # Optional: control output vector size
)