com.theokanning.openai.completion.chat.ChatMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
Basic java objects for the OpenAI GPT APIs
package com.theokanning.openai.completion.chat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Each object has a role (either “system”, “user”, or “assistant”) and content (the content of the message). Conversations can be as short as 1 message or fill many pages.
* Typically, a conversation is formatted with a system message first, followed by alternating user and assistant messages.
* The system message helps set the behavior of the assistant. In the example above, the assistant was instructed with “You are a helpful assistant.”
* The user messages help instruct the assistant. They can be generated by the end users of an application, or set by a developer as an instruction.
* The assistant messages help store prior responses. They can also be written by a developer to help give examples of desired behavior.
*
*
* see OpenAi documentation
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ChatMessage {
/**
* Must be either 'system', 'user', or 'assistant'.
* You may use {@link ChatMessageRole} enum.
*/
String role;
String content;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy