Package com.azure.ai.openai.models
Class ChatMessage
java.lang.Object
com.azure.ai.openai.models.ChatMessage
A single, role-attributed message within a chat completion interaction.
-
Constructor Summary
ConstructorsConstructorDescriptionChatMessage(ChatRole role, String content) Creates an instance of ChatMessage class. -
Method Summary
Modifier and TypeMethodDescriptionGet the content property: The text associated with this message payload.Get the context property: Additional context data associated with a chat message when requesting chat completions using compatible Azure OpenAI chat extensions.Get the functionCall property: The name and arguments of a function that should be called, as generated by the model.getName()Get the name property: The name of the author of this message.getRole()Get the role property: The role associated with this message payload.Set the context property: Additional context data associated with a chat message when requesting chat completions using compatible Azure OpenAI chat extensions.setFunctionCall(FunctionCall functionCall) Set the functionCall property: The name and arguments of a function that should be called, as generated by the model.Set the name property: The name of the author of this message.
-
Constructor Details
-
ChatMessage
Creates an instance of ChatMessage class.- Parameters:
role- the role value to set.content- the content value to set.
-
-
Method Details
-
getRole
Get the role property: The role associated with this message payload.- Returns:
- the role value.
-
getContent
Get the content property: The text associated with this message payload.- Returns:
- the content value.
-
getName
Get the name property: The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.- Returns:
- the name value.
-
setName
Set the name property: The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.- Parameters:
name- the name value to set.- Returns:
- the ChatMessage object itself.
-
getFunctionCall
Get the functionCall property: The name and arguments of a function that should be called, as generated by the model.- Returns:
- the functionCall value.
-
setFunctionCall
Set the functionCall property: The name and arguments of a function that should be called, as generated by the model.- Parameters:
functionCall- the functionCall value to set.- Returns:
- the ChatMessage object itself.
-
getContext
Get the context property: Additional context data associated with a chat message when requesting chat completions using compatible Azure OpenAI chat extensions. This includes information like the intermediate data source retrievals used to service a request. This context information is only populated when using Azure OpenAI with chat extensions capabilities configured.- Returns:
- the context value.
-
setContext
Set the context property: Additional context data associated with a chat message when requesting chat completions using compatible Azure OpenAI chat extensions. This includes information like the intermediate data source retrievals used to service a request. This context information is only populated when using Azure OpenAI with chat extensions capabilities configured.- Parameters:
context- the context value to set.- Returns:
- the ChatMessage object itself.
-