Class ClaudeFile

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

public abstract class ClaudeFile extends JsonSerializable
A file that can be referenced by ID from subsequent Claude model requests. The JSON representation of this message matches the Claude Files API File object field-for-field, so that code written against that API parses these responses unchanged. This data type is not supported in Gemini API.
  • Constructor Details

    • ClaudeFile

      public ClaudeFile()
  • Method Details

    • createdAt

      public abstract Optional<Instant> createdAt()
      Output only. The time at which the file was created.
    • downloadable

      public abstract Optional<Boolean> downloadable()
      Output only. Whether the contents of this file can be retrieved with `DownloadFile`. False for user-uploaded files, true for tool-generated ones.
    • expiresAt

      public abstract Optional<Instant> expiresAt()
      Output only. The time at which the file expires and is deleted, set from the `expires_in_seconds` upload form field. Unset for files that do not expire, which is serialised as `null`.
    • filename

      public abstract Optional<String> filename()
      Output only. The original name of the uploaded file, taken from the `Content-Disposition` header on upload. Between 1 and 255 characters. Control characters and the characters `<>:"|?*\/` are not accepted.
    • id

      public abstract Optional<String> id()
      Output only. The server-assigned identifier of the file, for example `file_abc123`. This is the ID to pass in subsequent model requests.
    • mimeType

      public abstract Optional<String> mimeType()
      Output only. The media type of the file, taken from the `Content-Type` header of the file part on upload.
    • sizeBytes

      public abstract Optional<Integer> sizeBytes()
      Output only. The size of the file in bytes.
    • type

      public abstract Optional<String> type()
      Output only. The object type. Always `file`.
    • builder

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

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

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