Class FileData

  • All Implemented Interfaces:

    
    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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public abstract class FileData.Builder

      Builder for FileData.

    • Constructor Summary

      Constructors 
      Constructor Description
      FileData()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Optional<String> displayName() Optional.
      abstract Optional<String> fileUri() Required.
      abstract Optional<String> mimeType() Required.
      static FileData.Builder builder() Instantiates a builder for FileData.
      abstract FileData.Builder toBuilder() Creates a builder with the same values as this instance.
      static FileData fromJson(String jsonString) Deserializes a JSON string to a FileData object.
      • Methods inherited from class com.google.genai.JsonSerializable

        fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileData

        FileData()
    • Method Detail

      • displayName

         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.