Class Flow.StreamingFlowValue<O,S>

java.lang.Object
com.google.genkit.core.Flow.StreamingFlowValue<O,S>
Type Parameters:
O - the output type
S - the stream chunk type
Enclosing class:
Flow<I,O,S>

public static class Flow.StreamingFlowValue<O,S> extends Object
StreamingFlowValue represents either a streamed chunk or the final output of a flow.
  • Constructor Details

    • StreamingFlowValue

      public StreamingFlowValue(boolean done, O output, S stream)
      Creates a new StreamingFlowValue.
      Parameters:
      done - true if this is the final output
      output - the final output (valid if done is true)
      stream - the stream chunk (valid if done is false)
  • Method Details

    • isDone

      public boolean isDone()
      Returns true if this is the final output.
      Returns:
      true if done
    • getOutput

      public O getOutput()
      Returns the final output. Valid only if isDone() returns true.
      Returns:
      the output
    • getStream

      public S getStream()
      Returns the stream chunk. Valid only if isDone() returns false.
      Returns:
      the stream chunk