Class ChatCompletionMessage
-
- All Implemented Interfaces:
public final class ChatCompletionMessage
A chat completion message generated by the model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
ChatCompletionMessage.Builder
A builder for ChatCompletionMessage.
public final class
ChatCompletionMessage.Annotation
A URL citation when using web search.
public final class
ChatCompletionMessage.FunctionCall
Deprecated and replaced by
tool_calls
. The name and arguments of a function that should be called, as generated by the model.
-
Method Summary
Modifier and Type Method Description final Optional<String>
content()
The contents of the message. final Optional<String>
refusal()
The refusal message generated by the model. final JsonValue
_role()
The role of the author of this message. final Optional<List<ChatCompletionMessage.Annotation>>
annotations()
Annotations for the message, when applicable, as when using the web search tool. final Optional<ChatCompletionAudio>
audio()
If the audio output modality is requested, this object contains data about the audio response from the model. final Optional<ChatCompletionMessage.FunctionCall>
functionCall()
Deprecated and replaced by tool_calls
.final Optional<List<ChatCompletionMessageToolCall>>
toolCalls()
The tool calls generated by the model, such as function calls. final JsonField<String>
_content()
Returns the raw JSON value of content. final JsonField<String>
_refusal()
Returns the raw JSON value of refusal. final JsonField<List<ChatCompletionMessage.Annotation>>
_annotations()
Returns the raw JSON value of annotations. final JsonField<ChatCompletionAudio>
_audio()
Returns the raw JSON value of audio. final JsonField<ChatCompletionMessage.FunctionCall>
_functionCall()
Returns the raw JSON value of functionCall. final JsonField<List<ChatCompletionMessageToolCall>>
_toolCalls()
Returns the raw JSON value of toolCalls. final Map<String, JsonValue>
_additionalProperties()
final ChatCompletionAssistantMessageParam
toParam()
final ChatCompletionMessage
validate()
final ChatCompletionMessage.Builder
toBuilder()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static ChatCompletionMessage.Builder
builder()
Returns a mutable builder for constructing an instance of ChatCompletionMessage. -
-
Method Detail
-
_role
final JsonValue _role()
The role of the author of this message.
Expected to always return the following:
JsonValue.from("assistant")
However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
annotations
final Optional<List<ChatCompletionMessage.Annotation>> annotations()
Annotations for the message, when applicable, as when using the web search tool.
-
audio
final Optional<ChatCompletionAudio> audio()
If the audio output modality is requested, this object contains data about the audio response from the model. Learn more.
-
functionCall
@Deprecated(message = "deprecated") final Optional<ChatCompletionMessage.FunctionCall> functionCall()
Deprecated and replaced by
tool_calls
. The name and arguments of a function that should be called, as generated by the model.
-
toolCalls
final Optional<List<ChatCompletionMessageToolCall>> toolCalls()
The tool calls generated by the model, such as function calls.
-
_content
final JsonField<String> _content()
Returns the raw JSON value of content.
Unlike content, this method doesn't throw if the JSON field has an unexpected type.
-
_refusal
final JsonField<String> _refusal()
Returns the raw JSON value of refusal.
Unlike refusal, this method doesn't throw if the JSON field has an unexpected type.
-
_annotations
final JsonField<List<ChatCompletionMessage.Annotation>> _annotations()
Returns the raw JSON value of annotations.
Unlike annotations, this method doesn't throw if the JSON field has an unexpected type.
-
_audio
final JsonField<ChatCompletionAudio> _audio()
Returns the raw JSON value of audio.
Unlike audio, this method doesn't throw if the JSON field has an unexpected type.
-
_functionCall
@Deprecated(message = "deprecated") final JsonField<ChatCompletionMessage.FunctionCall> _functionCall()
Returns the raw JSON value of functionCall.
Unlike functionCall, this method doesn't throw if the JSON field has an unexpected type.
-
_toolCalls
final JsonField<List<ChatCompletionMessageToolCall>> _toolCalls()
Returns the raw JSON value of toolCalls.
Unlike toolCalls, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toParam
final ChatCompletionAssistantMessageParam toParam()
-
validate
final ChatCompletionMessage validate()
-
toBuilder
final ChatCompletionMessage.Builder toBuilder()
-
builder
final static ChatCompletionMessage.Builder builder()
Returns a mutable builder for constructing an instance of ChatCompletionMessage.
The following fields are required:
.content() .refusal()
-
-
-
-