Interface OpenAiMessage
- All Known Implementing Classes:
OpenAiAssistantMessage,OpenAiSystemMessage,OpenAiToolMessage,OpenAiUserMessage
public sealed interface OpenAiMessage
permits OpenAiUserMessage, OpenAiAssistantMessage, OpenAiSystemMessage, OpenAiToolMessage
Interface representing convenience wrappers of chat message to the openai service.
- Since:
- 1.4.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic OpenAiAssistantMessageA convenience method to create an assistant message.static OpenAiAssistantMessageassistant(List<OpenAiToolCall> toolCalls) A convenience method to create an assistant message.content()Returns the content of the message.role()Returns the role associated with the message.static OpenAiSystemMessageA convenience method to create a system message.static OpenAiToolMessageA convenience method to create a tool message.static OpenAiUserMessageuser(OpenAiImageItem openAiImageItem) A convenience method to create a user message containing only an image.static OpenAiUserMessageA convenience method to create a user message.
-
Method Details
-
user
A convenience method to create a user message.- Parameters:
message- the message content.- Returns:
- the user message.
-
user
A convenience method to create a user message containing only an image.- Parameters:
openAiImageItem- the message content.- Returns:
- the user message.
-
assistant
A convenience method to create an assistant message.- Parameters:
message- the message content.- Returns:
- the assistant message.
-
assistant
A convenience method to create an assistant message.- Parameters:
toolCalls- tool calls to associate with the message.- Returns:
- the assistant message.
-
system
A convenience method to create a system message.- Parameters:
message- the message content.- Returns:
- the system message.
-
tool
A convenience method to create a tool message.- Parameters:
message- response of the executed tool call.toolCallId- identifier of the tool call that the assistant expected.- Returns:
- the tool message.
-
role
Returns the role associated with the message.- Returns:
- the role.
-
content
Returns the content of the message.- Returns:
- the content.
-