ExAgent.Services.GeminiUploadService (ExAgent v0.2.0)

Copy Markdown View Source

HTTP service for uploading files to the Gemini Files API.

Handles multipart/related uploads to the Gemini media upload endpoint and returns an ExAgent.FileRef with the provider-assigned file URI. Files uploaded to Gemini expire after 48 hours.

Summary

Functions

Uploads a file to Gemini and returns a file reference.

Functions

upload(api_key, file_data, mime_type, opts \\ [])

@spec upload(String.t(), binary(), String.t(), keyword()) ::
  {:ok, ExAgent.FileRef.t()} | {:error, term()}

Uploads a file to Gemini and returns a file reference.

Uses multipart/related with JSON metadata and binary content. Polls for file processing completion if the file state is PROCESSING.

Options

  • :filename - display name for the file (default: "upload")
  • :upload_url - override upload URL (useful for testing)