Class ResponseStreamIteratorWithHistory<GenerateContentResponse> (1.23.0)

public class ResponseStreamIteratorWithHistory<GenerateContentResponse> implements Iterator<GenerateContentResponse>

Iterator of the ResponseStream that holds the response chunks.

Inheritance

java.lang.Object > ResponseStreamIteratorWithHistory<GenerateContentResponse>

Type Parameter

NameDescription
GenerateContentResponse

Constructors

ResponseStreamIteratorWithHistory(Iterator serverStreamIterator)

public ResponseStreamIteratorWithHistory(Iterator serverStreamIterator)
Parameter
NameDescription
serverStreamIteratorIterator

Methods

getHistory()

public List<GenerateContentResponse> getHistory()

Retrieves all the chunks in a stream of responses.

Returns
TypeDescription
List<GenerateContentResponse>

hasNext()

public boolean hasNext()
Returns
TypeDescription
boolean

isConsumed()

public boolean isConsumed()

Whether the whole stream has been consumed.

Here "consumed" means we have reached the end of the stream.

Returns
TypeDescription
boolean

next()

public GenerateContentResponse next()
Returns
TypeDescription
GenerateContentResponse