Class OpenAiChatCompletionDelta

java.lang.Object
com.sap.ai.sdk.foundationmodels.openai.OpenAiChatCompletionDelta
All Implemented Interfaces:
StreamedDelta

public class OpenAiChatCompletionDelta extends Object implements StreamedDelta
Represents an OpenAI chat completion output delta for streaming.
Since:
1.4.0
  • Method Details

    • getDeltaContent

      @Nonnull public String getDeltaContent()
      Description copied from interface: StreamedDelta
      Get the message content from the delta.

      Note: If there are multiple choices only the first one is returned

      Note: Some deltas do not contain any content

      Specified by:
      getDeltaContent in interface StreamedDelta
      Returns:
      the message content or empty string.
    • getFinishReason

      @Nullable public String getFinishReason()
      Description copied from interface: StreamedDelta
      Reason for finish. The possible values are:

      stop: API returned complete message, or a message terminated by one of the stop sequences provided via the stop parameter

      length: Incomplete model output due to max_tokens parameter or token limit

      function_call: The model decided to call a function

      content_filter: Omitted content due to a flag from our content filters

      null: API response still in progress or incomplete

      Specified by:
      getFinishReason in interface StreamedDelta
      Returns:
      the finish reason or null.
    • getCompletionUsage

      @Nullable public CompletionUsage getCompletionUsage()
      Retrieves the completion usage from the response, or null if it is not available.
      Returns:
      The completion usage or null.
    • getOriginalResponse

      @Nonnull public CreateChatCompletionStreamResponse getOriginalResponse()
      The original response from the chat completion stream.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object