Skip to content

OpenAIMessageContent

OpenAIMessageContent = string | ({ text: string; type: "text"; } | { image_url: { detail?: "auto" | "low" | "high"; url: string; }; type: "image_url"; })[]

Defined in: adapters/openai.ts:54

OpenAI message content type supporting text and multimodal inputs.

Can be either a simple string for text-only messages, or an array of content blocks for multimodal messages that include images. The array form supports mixing text and images in a single message.

// Simple text
const textContent: OpenAIMessageContent = "Hello, world!";
// Multimodal with image
const multimodalContent: OpenAIMessageContent = [
{ type: 'text', text: 'What is in this image?' },
{
type: 'image_url',
image_url: {
url: 'https://example.com/photo.jpg',
detail: 'high'
}
}
];