Class ChatCompletionMessageParam
-
- All Implemented Interfaces:
public final class ChatCompletionMessageParamDeveloper-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer,
developermessages replace the previoussystemmessages.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceChatCompletionMessageParam.VisitorAn interface that defines how to map each variant of ChatCompletionMessageParam to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<ChatCompletionDeveloperMessageParam>developer()Developer-provided instructions that the model should follow, regardless of messages sent by the user. final Optional<ChatCompletionSystemMessageParam>system()Developer-provided instructions that the model should follow, regardless of messages sent by the user. final Optional<ChatCompletionUserMessageParam>user()Messages sent by an end user, containing prompts or additional context information. final Optional<ChatCompletionAssistantMessageParam>assistant()Messages sent by the model in response to user messages. final Optional<ChatCompletionToolMessageParam>tool()final Optional<ChatCompletionFunctionMessageParam>function()final BooleanisDeveloper()final BooleanisSystem()final BooleanisUser()final BooleanisAssistant()final BooleanisTool()final BooleanisFunction()final ChatCompletionDeveloperMessageParamasDeveloper()Developer-provided instructions that the model should follow, regardless of messages sent by the user. final ChatCompletionSystemMessageParamasSystem()Developer-provided instructions that the model should follow, regardless of messages sent by the user. final ChatCompletionUserMessageParamasUser()Messages sent by an end user, containing prompts or additional context information. final ChatCompletionAssistantMessageParamasAssistant()Messages sent by the model in response to user messages. final ChatCompletionToolMessageParamasTool()final ChatCompletionFunctionMessageParamasFunction()final Optional<JsonValue>_json()final <T extends Any> Taccept(ChatCompletionMessageParam.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ChatCompletionMessageParamvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ChatCompletionMessageParamofDeveloper(ChatCompletionDeveloperMessageParam developer)Developer-provided instructions that the model should follow, regardless of messages sent by the user. final static ChatCompletionMessageParamofSystem(ChatCompletionSystemMessageParam system)Developer-provided instructions that the model should follow, regardless of messages sent by the user. final static ChatCompletionMessageParamofUser(ChatCompletionUserMessageParam user)Messages sent by an end user, containing prompts or additional context information. final static ChatCompletionMessageParamofAssistant(ChatCompletionAssistantMessageParam assistant)Messages sent by the model in response to user messages. final static ChatCompletionMessageParamofTool(ChatCompletionToolMessageParam tool)final static ChatCompletionMessageParamofFunction(ChatCompletionFunctionMessageParam function)-
-
Method Detail
-
developer
final Optional<ChatCompletionDeveloperMessageParam> developer()
Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer,
developermessages replace the previoussystemmessages.
-
system
final Optional<ChatCompletionSystemMessageParam> system()
Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use
developermessages for this purpose instead.
-
user
final Optional<ChatCompletionUserMessageParam> user()
Messages sent by an end user, containing prompts or additional context information.
-
assistant
final Optional<ChatCompletionAssistantMessageParam> assistant()
Messages sent by the model in response to user messages.
-
tool
final Optional<ChatCompletionToolMessageParam> tool()
-
function
@Deprecated(message = "deprecated") final Optional<ChatCompletionFunctionMessageParam> function()
-
isDeveloper
final Boolean isDeveloper()
-
isAssistant
final Boolean isAssistant()
-
isFunction
@Deprecated(message = "deprecated") final Boolean isFunction()
-
asDeveloper
final ChatCompletionDeveloperMessageParam asDeveloper()
Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer,
developermessages replace the previoussystemmessages.
-
asSystem
final ChatCompletionSystemMessageParam asSystem()
Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use
developermessages for this purpose instead.
-
asUser
final ChatCompletionUserMessageParam asUser()
Messages sent by an end user, containing prompts or additional context information.
-
asAssistant
final ChatCompletionAssistantMessageParam asAssistant()
Messages sent by the model in response to user messages.
-
asTool
final ChatCompletionToolMessageParam asTool()
-
asFunction
@Deprecated(message = "deprecated") final ChatCompletionFunctionMessageParam asFunction()
-
accept
final <T extends Any> T accept(ChatCompletionMessageParam.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = chatCompletionMessageParam.accept(new ChatCompletionMessageParam.Visitor<Optional<String>>() { @Override public Optional<String> visitDeveloper(ChatCompletionDeveloperMessageParam developer) { return Optional.of(developer.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ChatCompletionMessageParam validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofDeveloper
final static ChatCompletionMessageParam ofDeveloper(ChatCompletionDeveloperMessageParam developer)
Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer,
developermessages replace the previoussystemmessages.
-
ofSystem
final static ChatCompletionMessageParam ofSystem(ChatCompletionSystemMessageParam system)
Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use
developermessages for this purpose instead.
-
ofUser
final static ChatCompletionMessageParam ofUser(ChatCompletionUserMessageParam user)
Messages sent by an end user, containing prompts or additional context information.
-
ofAssistant
final static ChatCompletionMessageParam ofAssistant(ChatCompletionAssistantMessageParam assistant)
Messages sent by the model in response to user messages.
-
ofTool
final static ChatCompletionMessageParam ofTool(ChatCompletionToolMessageParam tool)
-
ofFunction
@Deprecated(message = "deprecated") final static ChatCompletionMessageParam ofFunction(ChatCompletionFunctionMessageParam function)
-
-
-
-