Class RagChunk

  • All Implemented Interfaces:

    
    public abstract class RagChunk
    extends JsonSerializable
                        

    A RagChunk includes the content of a chunk of a RagFile, and associated metadata. This data type is not supported in Gemini API.

    • Nested Class Summary

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

      Builder for RagChunk.

    • Constructor Summary

      Constructors 
      Constructor Description
      RagChunk()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Optional<RagChunkPageSpan> pageSpan() If populated, represents where the chunk starts and ends in the document.
      abstract Optional<String> text() The content of the chunk.
      static RagChunk.Builder builder() Instantiates a builder for RagChunk.
      abstract RagChunk.Builder toBuilder() Creates a builder with the same values as this instance.
      static RagChunk fromJson(String jsonString) Deserializes a JSON string to a RagChunk 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