Supported Formats

Attachments can be sent in the following ways:

  • Base64 encoded data: For files you have locally or want to upload directly
  • Remote URLs: For files hosted on the web that the AI can access

Using URLs

const response = await itzam.generateText({
  input: "What can you say about this document?",
  workflowSlug: "document-analysis",
  attachments: [
    {
      file: "https://example.com/document.pdf",
    },
  ],
});

Using Base64

const response = await itzam.streamText({
  input: "Analyze this image",
  workflowSlug: "image-analysis",
  attachments: [
    {
      file: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD...",
    },
  ],
});

Multiple Attachments

You can send multiple attachments in a single request:

const response = await itzam.generateText({
  input: "Compare these documents and images",
  workflowSlug: "multi-modal-analysis",
  attachments: [
    {
      file: "https://example.com/document1.pdf",
      mimeType: "application/pdf",
    },
    {
      file: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD...",
      mimeType: "image/jpeg",
    },
  ],
});

Attachment Object Structure

PropertyTypeRequiredDescription
filestringYesThe file data as base64 string or URL
mimeTypestringNoThe MIME type of the file (e.g., “image/png”, “application/pdf”). Auto-detected, but helps the AI understand the file type.

Supported MIME Types

Common MIME types that work well with AI models:

Images

  • image/jpeg - JPEG images
  • image/png - PNG images
  • image/gif - GIF images
  • image/webp - WebP images
  • image/svg+xml - SVG images

Documents

  • application/pdf - PDF documents
  • text/plain - Plain text files
  • text/markdown - Markdown files
  • application/msword - Word documents
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document - Word documents (.docx)

Data

  • application/json - JSON files
  • text/csv - CSV files
  • application/xml - XML files