Record Class ModelChunk

java.lang.Object
java.lang.Record
ai.badmonkey.agentspaces.springai.model.wire.ModelChunk
Record Components:
requestId - the request it streams
attempt - which attempt produced it; a higher attempt means the first server died
seq - the chunk's position in its attempt, from 0
deltas - the deltas, in order
last - whether this chunk ends the attempt's stream
usage - token usage, on the last chunk
error - the provider's error, on a last chunk that failed
servedBy - the serving peer

public record ModelChunk(String requestId, int attempt, int seq, List<WireGeneration> deltas, boolean last, WireUsage usage, String error, String servedBy) extends Record
A batch of streamed deltas. Chunks are short-leased, so they collect themselves; the full answer also lands as the request's ModelResponse.
  • Constructor Details

  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • requestId

      public String requestId()
      Returns the value of the requestId record component.
      Returns:
      the value of the requestId record component
    • attempt

      public int attempt()
      Returns the value of the attempt record component.
      Returns:
      the value of the attempt record component
    • seq

      public int seq()
      Returns the value of the seq record component.
      Returns:
      the value of the seq record component
    • deltas

      public List<WireGeneration> deltas()
      Returns the value of the deltas record component.
      Returns:
      the value of the deltas record component
    • last

      public boolean last()
      Returns the value of the last record component.
      Returns:
      the value of the last record component
    • usage

      public WireUsage usage()
      Returns the value of the usage record component.
      Returns:
      the value of the usage record component
    • error

      public String error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • servedBy

      public String servedBy()
      Returns the value of the servedBy record component.
      Returns:
      the value of the servedBy record component