Package com.sap.ai.sdk.foundationmodels.openai.generated.model

# Class ChatCompletionResponseMessage

java.lang.Object
com.sap.ai.sdk.foundationmodels.openai.generated.model.ChatCompletionResponseMessage

public class ChatCompletionResponseMessage extends Object
A chat completion message generated by the model.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ChatCompletionResponseMessage()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ChatCompletionResponseMessage`
  `addToolCallsItem(ChatCompletionMessageToolCall toolCallsItem)`
  Add one toolCalls instance to this `ChatCompletionResponseMessage`.
  `ChatCompletionResponseMessage`
  `content(String content)`
  Set the content of this `ChatCompletionResponseMessage` instance and return the same instance.
  `boolean`
  `equals(Object o)`
  `ChatCompletionResponseMessage`
  `functionCall(ChatCompletionFunctionCall functionCall)`
  Set the functionCall of this `ChatCompletionResponseMessage` instance and return the same instance.
  `String`
  `getContent()`
  The contents of the message.
  `Object`
  `getCustomField(String name)`
  Deprecated.
  Use `toMap()` instead.
  `Set<String>`
  `getCustomFieldNames()`
  Get the names of the unrecognizable properties of the `ChatCompletionResponseMessage`.
  `ChatCompletionFunctionCall`
  `getFunctionCall()`
  Get functionCall
  `String`
  `getRefusal()`
  The refusal message generated by the model.
  `ChatCompletionResponseMessageRole`
  `getRole()`
  Get role
  `List<ChatCompletionMessageToolCall>`
  `getToolCalls()`
  The tool calls generated by the model, such as function calls.
  `int`
  `hashCode()`
  `ChatCompletionResponseMessage`
  `refusal(String refusal)`
  Set the refusal of this `ChatCompletionResponseMessage` instance and return the same instance.
  `ChatCompletionResponseMessage`
  `role(ChatCompletionResponseMessageRole role)`
  Set the role of this `ChatCompletionResponseMessage` instance and return the same instance.
  `void`
  `setContent(String content)`
  Set the content of this `ChatCompletionResponseMessage` instance.
  `void`
  `setCustomField(String customFieldName, Object customFieldValue)`
  Set an unrecognizable property of this `ChatCompletionResponseMessage` instance.
  `void`
  `setFunctionCall(ChatCompletionFunctionCall functionCall)`
  Set the functionCall of this `ChatCompletionResponseMessage` instance.
  `void`
  `setRefusal(String refusal)`
  Set the refusal of this `ChatCompletionResponseMessage` instance.
  `void`
  `setRole(ChatCompletionResponseMessageRole role)`
  Set the role of this `ChatCompletionResponseMessage` instance.
  `void`
  `setToolCalls(List<ChatCompletionMessageToolCall> toolCalls)`
  Set the toolCalls of this `ChatCompletionResponseMessage` instance.
  `Map<String,Object>`
  `toMap()`
  Get the value of all properties of this `ChatCompletionResponseMessage` instance including unrecognized properties.
  `ChatCompletionResponseMessage`
  `toolCalls(List<ChatCompletionMessageToolCall> toolCalls)`
  Set the toolCalls of this `ChatCompletionResponseMessage` instance and return the same instance.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ChatCompletionResponseMessage

    public ChatCompletionResponseMessage()

- ## Method Details

  - ### role

    @Nonnull public ChatCompletionResponseMessage role(@Nonnull ChatCompletionResponseMessageRole role)
    Set the role of this `ChatCompletionResponseMessage` instance and return the same instance.
    Parameters:
      `role` - The role of this `ChatCompletionResponseMessage`
    Returns:
      The same instance of this `ChatCompletionResponseMessage` class

  - ### getRole

    @Nonnull public ChatCompletionResponseMessageRole getRole()
    Get role
    Returns:
      role The role of this `ChatCompletionResponseMessage` instance.

  - ### setRole

    public void setRole(@Nonnull ChatCompletionResponseMessageRole role)
    Set the role of this `ChatCompletionResponseMessage` instance.
    Parameters:
      `role` - The role of this `ChatCompletionResponseMessage`

  - ### refusal

    @Nonnull public ChatCompletionResponseMessage refusal(@Nullable String refusal)
    Set the refusal of this `ChatCompletionResponseMessage` instance and return the same instance.
    Parameters:
      `refusal` - The refusal message generated by the model.
    Returns:
      The same instance of this `ChatCompletionResponseMessage` class

  - ### getRefusal

    @Nullable public String getRefusal()
    The refusal message generated by the model.
    Returns:
      refusal The refusal of this `ChatCompletionResponseMessage` instance.

  - ### setRefusal

    public void setRefusal(@Nullable String refusal)
    Set the refusal of this `ChatCompletionResponseMessage` instance.
    Parameters:
      `refusal` - The refusal message generated by the model.

  - ### content

    @Nonnull public ChatCompletionResponseMessage content(@Nullable String content)
    Set the content of this `ChatCompletionResponseMessage` instance and return the same instance.
    Parameters:
      `content` - The contents of the message.
    Returns:
      The same instance of this `ChatCompletionResponseMessage` class

  - ### getContent

    @Nullable public String getContent()
    The contents of the message.
    Returns:
      content The content of this `ChatCompletionResponseMessage` instance.

  - ### setContent

    public void setContent(@Nullable String content)
    Set the content of this `ChatCompletionResponseMessage` instance.
    Parameters:
      `content` - The contents of the message.

  - ### toolCalls

    @Nonnull public ChatCompletionResponseMessage toolCalls(@Nullable List<ChatCompletionMessageToolCall> toolCalls)
    Set the toolCalls of this `ChatCompletionResponseMessage` instance and return the same instance.
    Parameters:
      `toolCalls` - The tool calls generated by the model, such as function calls.
    Returns:
      The same instance of this `ChatCompletionResponseMessage` class

  - ### addToolCallsItem

    @Nonnull public ChatCompletionResponseMessage addToolCallsItem(@Nonnull ChatCompletionMessageToolCall toolCallsItem)
    Add one toolCalls instance to this `ChatCompletionResponseMessage`.
    Parameters:
      `toolCallsItem` - The toolCalls that should be added
    Returns:
      The same instance of type `ChatCompletionResponseMessage`

  - ### getToolCalls

    @Nonnull public List<ChatCompletionMessageToolCall> getToolCalls()
    The tool calls generated by the model, such as function calls.
    Returns:
      toolCalls The toolCalls of this `ChatCompletionResponseMessage` instance.

  - ### setToolCalls

    public void setToolCalls(@Nullable List<ChatCompletionMessageToolCall> toolCalls)
    Set the toolCalls of this `ChatCompletionResponseMessage` instance.
    Parameters:
      `toolCalls` - The tool calls generated by the model, such as function calls.

  - ### functionCall

    @Nonnull public ChatCompletionResponseMessage functionCall(@Nullable ChatCompletionFunctionCall functionCall)
    Set the functionCall of this `ChatCompletionResponseMessage` instance and return the same instance.
    Parameters:
      `functionCall` - The functionCall of this `ChatCompletionResponseMessage`
    Returns:
      The same instance of this `ChatCompletionResponseMessage` class

  - ### getFunctionCall

    @Nonnull public ChatCompletionFunctionCall getFunctionCall()
    Get functionCall
    Returns:
      functionCall The functionCall of this `ChatCompletionResponseMessage` instance.

  - ### setFunctionCall

    public void setFunctionCall(@Nullable ChatCompletionFunctionCall functionCall)
    Set the functionCall of this `ChatCompletionResponseMessage` instance.
    Parameters:
      `functionCall` - The functionCall of this `ChatCompletionResponseMessage`

  - ### getCustomFieldNames

    @Nonnull public Set<String> getCustomFieldNames()
    Get the names of the unrecognizable properties of the `ChatCompletionResponseMessage`.
    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 `ChatCompletionResponseMessage` 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 `ChatCompletionResponseMessage` 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 `ChatCompletionResponseMessage` 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`