Package com.google.genkit.ai
Class ModelResponseChunk
java.lang.Object
com.google.genkit.ai.ModelResponseChunk
ModelResponseChunk represents a streaming chunk from a generative AI model.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ModelResponseChunk(List<Part> content) Creates a ModelResponseChunk with the given content. -
Method Summary
Modifier and TypeMethodDescriptiongetIndex()getText()Returns the text content from all text parts.voidsetContent(List<Part> content) voidstatic ModelResponseChunkCreates a ModelResponseChunk with text content.
-
Constructor Details
-
ModelResponseChunk
public ModelResponseChunk()Default constructor. -
ModelResponseChunk
Creates a ModelResponseChunk with the given content.- Parameters:
content- the content parts
-
-
Method Details
-
text
Creates a ModelResponseChunk with text content.- Parameters:
text- the text content- Returns:
- a new chunk
-
getText
Returns the text content from all text parts.- Returns:
- the concatenated text, or null if no text content
-
getContent
-
setContent
-
getIndex
-
setIndex
-