Class ModelResponseChunk

java.lang.Object
com.google.genkit.ai.ModelResponseChunk

public class ModelResponseChunk extends Object
ModelResponseChunk represents a streaming chunk from a generative AI model.
  • Constructor Details

    • ModelResponseChunk

      public ModelResponseChunk()
      Default constructor.
    • ModelResponseChunk

      public ModelResponseChunk(List<Part> content)
      Creates a ModelResponseChunk with the given content.
      Parameters:
      content - the content parts
  • Method Details

    • text

      public static ModelResponseChunk text(String text)
      Creates a ModelResponseChunk with text content.
      Parameters:
      text - the text content
      Returns:
      a new chunk
    • getText

      public String getText()
      Returns the text content from all text parts.
      Returns:
      the concatenated text, or null if no text content
    • getContent

      public List<Part> getContent()
    • setContent

      public void setContent(List<Part> content)
    • getIndex

      public Integer getIndex()
    • setIndex

      public void setIndex(Integer index)