Class OpenAIChatMessage
java.lang.Object
com.developer.nefarious.zjoule.plugin.chat.openai.OpenAIChatMessage
- All Implemented Interfaces:
IChatMessage
Represents a chat message exchanged with the OpenAI model.
The
OpenAIChatMessage
class implements IChatMessage
and
encapsulates the role and content of a message in the chat context.-
Constructor Summary
ConstructorDescriptionDefault constructor for creating an emptyOpenAIChatMessage
.OpenAIChatMessage
(Role role, String content) Constructs a newOpenAIChatMessage
with the specified role and content. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the content of the message.Retrieves the message content.getRole()
Retrieves the role associated with the message.void
setContent
(String content) Sets the content of the message.void
Sets the role of the message.
-
Constructor Details
-
OpenAIChatMessage
public OpenAIChatMessage()Default constructor for creating an emptyOpenAIChatMessage
. -
OpenAIChatMessage
Constructs a newOpenAIChatMessage
with the specified role and content.- Parameters:
role
- the role of the message (e.g.,Role.USER
,Role.SYSTEM
).content
- the content of the message.
-
-
Method Details
-
getContent
Retrieves the content of the message.- Returns:
- the content of the message as a
String
.
-
getMessage
Retrieves the message content. This is the implementation of theIChatMessage.getMessage()
method.- Specified by:
getMessage
in interfaceIChatMessage
- Returns:
- the message content as a
String
.
-
getRole
Retrieves the role associated with the message. This is the implementation of theIChatMessage.getRole()
method.- Specified by:
getRole
in interfaceIChatMessage
- Returns:
- the role of the message as a
Role
.
-
setContent
Sets the content of the message.- Parameters:
content
- the new content of the message.
-
setRole
Sets the role of the message.- Parameters:
role
- the new role of the message (e.g.,Role.USER
,Role.SYSTEM
).
-