Class LLMChoice

java.lang.Object
com.sap.ai.sdk.orchestration.model.LLMChoice

public class LLMChoice extends Object
LLMChoice
  • Constructor Details

    • LLMChoice

      protected LLMChoice()
      Default constructor for LLMChoice.
  • Method Details

    • index

      @Nonnull public LLMChoice index(@Nonnull Integer index)
      Set the index of this LLMChoice instance and return the same instance.
      Parameters:
      index - Index of the choice
      Returns:
      The same instance of this LLMChoice class
    • getIndex

      @Nonnull public Integer getIndex()
      Index of the choice
      Returns:
      index The index of this LLMChoice instance.
    • setIndex

      public void setIndex(@Nonnull Integer index)
      Set the index of this LLMChoice instance.
      Parameters:
      index - Index of the choice
    • message

      @Nonnull public LLMChoice message(@Nonnull ResponseChatMessage message)
      Set the message of this LLMChoice instance and return the same instance.
      Parameters:
      message - The message of this LLMChoice
      Returns:
      The same instance of this LLMChoice class
    • getMessage

      @Nonnull public ResponseChatMessage getMessage()
      Get message
      Returns:
      message The message of this LLMChoice instance.
    • setMessage

      public void setMessage(@Nonnull ResponseChatMessage message)
      Set the message of this LLMChoice instance.
      Parameters:
      message - The message of this LLMChoice
    • logprobs

      @Nonnull public LLMChoice logprobs(@Nullable ChoiceLogprobs logprobs)
      Set the logprobs of this LLMChoice instance and return the same instance.
      Parameters:
      logprobs - The logprobs of this LLMChoice
      Returns:
      The same instance of this LLMChoice class
    • getLogprobs

      @Nonnull public ChoiceLogprobs getLogprobs()
      Get logprobs
      Returns:
      logprobs The logprobs of this LLMChoice instance.
    • setLogprobs

      public void setLogprobs(@Nullable ChoiceLogprobs logprobs)
      Set the logprobs of this LLMChoice instance.
      Parameters:
      logprobs - The logprobs of this LLMChoice
    • finishReason

      @Nonnull public LLMChoice finishReason(@Nonnull String finishReason)
      Set the finishReason of this LLMChoice instance and return the same instance.
      Parameters:
      finishReason - Reason the model stopped generating tokens. 'stop' if the model hit a natural stop point or a provided stop sequence, 'length' if the maximum token number was reached, 'content_filter' if content was omitted due to a filter enforced by the LLM model provider or the content filtering module
      Returns:
      The same instance of this LLMChoice class
    • getFinishReason

      @Nonnull public String getFinishReason()
      Reason the model stopped generating tokens. 'stop' if the model hit a natural stop point or a provided stop sequence, 'length' if the maximum token number was reached, 'content_filter' if content was omitted due to a filter enforced by the LLM model provider or the content filtering module
      Returns:
      finishReason The finishReason of this LLMChoice instance.
    • setFinishReason

      public void setFinishReason(@Nonnull String finishReason)
      Set the finishReason of this LLMChoice instance.
      Parameters:
      finishReason - Reason the model stopped generating tokens. 'stop' if the model hit a natural stop point or a provided stop sequence, 'length' if the maximum token number was reached, 'content_filter' if content was omitted due to a filter enforced by the LLM model provider or the content filtering module
    • getCustomFieldNames

      @Nonnull public Set<String> getCustomFieldNames()
      Get the names of the unrecognizable properties of the LLMChoice.
      Returns:
      The set of properties names
    • getCustomField

      @Nullable @Deprecated public Object getCustomField(@Nonnull String name) throws NoSuchElementException
      Deprecated.
      Use toMap() instead.
      Get the value of an unrecognizable property of this LLMChoice instance.
      Parameters:
      name - The name of the property
      Returns:
      The value of the property
      Throws:
      NoSuchElementException - If no property with the given name could be found.
    • toMap

      @Nonnull public Map<String,Object> toMap()
      Get the value of all properties of this LLMChoice instance including unrecognized properties.
      Returns:
      The map of all properties
    • setCustomField

      public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue)
      Set an unrecognizable property of this LLMChoice instance. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
      Parameters:
      customFieldName - The name of the property
      customFieldValue - The value of the property
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object
    • create

      public static LLMChoice.Builder create()
      Create a type-safe, fluent-api builder object to construct a new LLMChoice instance with all required arguments.