Class Completion


public class Completion extends ObjectWithJsonToString
  • Constructor Details

    • Completion

      public Completion()
  • Method Details

    • completion

      public static Completion completion()
    • withText

      public Completion withText(String text)
    • getText

      public String getText()
    • withToolCalls

      public Completion withToolCalls(List<ToolUse> toolCalls)
    • withToolCalls

      public Completion withToolCalls(ToolUse... toolCalls)
    • withToolCall

      public Completion withToolCall(ToolUse toolCall)
    • getToolCalls

      public List<ToolUse> getToolCalls()
    • withStopReason

      public Completion withStopReason(String stopReason)
    • getStopReason

      public String getStopReason()
    • withUsage

      public Completion withUsage(Usage usage)
    • getUsage

      public Usage getUsage()
    • withStreaming

      public Completion withStreaming(Boolean streaming)
    • streaming

      public Completion streaming()
    • getStreaming

      public Boolean getStreaming()
    • withStreamingPhysics

      public Completion withStreamingPhysics(StreamingPhysics streamingPhysics)
    • withStreamingPhysics

      public Completion withStreamingPhysics(Object... parts)
      Compose streaming physics from independent values. Accepts any combination of Delay (interpreted as time-to-first-token) and StreamingPhysics fragments (each typically carrying a single field — e.g. tokensPerSecond(50) or jitter(0.2)). Non-null fields from the fragments are merged left-to-right onto a single StreamingPhysics instance which is then assigned to this completion. Calling implicitly enables streaming.
    • getStreamingPhysics

      public StreamingPhysics getStreamingPhysics()
    • withOutputSchema

      public Completion withOutputSchema(String outputSchema)
      Optional JSON Schema (as a JSON string) that this completion's text is expected to conform to. When set, the LLM response handler validates the configured text against the schema as the response is encoded. Validation is fail-soft: a mismatch does not alter the response body — it adds an x-mockserver-structured-output-invalid diagnostic header and logs a warning, so a deliberately non-conforming fixture still returns exactly as configured while malformed structured-output fixtures are surfaced.
    • getOutputSchema

      public String getOutputSchema()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class ObjectWithReflectiveEqualsHashCodeToString
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ObjectWithReflectiveEqualsHashCodeToString