Class FileData

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.FileData

public abstract class FileData extends JsonSerializable
URI-based data. A FileData message contains a URI pointing to data of a specific media type. It is used to represent images, audio, and video stored in Google Cloud Storage.
  • Constructor Details

    • FileData

      public FileData()
  • Method Details

    • displayName

      public abstract Optional<String> displayName()
      Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API.
    • fileUri

      public abstract Optional<String> fileUri()
      Required. The URI of the file in Google Cloud Storage.
    • mimeType

      public abstract Optional<String> mimeType()
      Required. The IANA standard MIME type of the source data.
    • builder

      public static FileData.Builder builder()
      Instantiates a builder for FileData.
    • toBuilder

      public abstract FileData.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static FileData fromJson(String jsonString)
      Deserializes a JSON string to a FileData object.