Skip to content
1 min read · 67 words

Type Alias: ChatCompletionsContentBlock ​

ts
type ChatCompletionsContentBlock =
  | {
      text: string;
      type: "text";
    }
  | {
      image_url: {
        detail?: "auto" | "low" | "high";
        url: string;
      };
      type: "image_url";
    }
  | {
      input_audio: {
        data: string;
        format: "wav" | "mp3";
      };
      type: "input_audio";
    }
  | {
      file: {
        file_data?: string;
        file_id?: string;
        filename?: string;
      };
      type: "file";
    };

Defined in: src/batteries/llm/openai_chat_completions/types.ts:129

Discriminated union of content block shapes accepted by the OpenAI Chat Completions wire format for a content-array message body.

Remarks ​

text is the trust-envelope-wrapped string body. image_url carries either an inline data: URI or a remote URL. input_audio carries base64-encoded audio plus a format hint. file carries either a previously-uploaded file_id or an inline file_data blob with a filename.