Class ChatHistory
- java.lang.Object
-
- com.microsoft.semantickernel.chatcompletion.ChatHistory
-
public class ChatHistory extends Object
Provides a history of messages between the User, Assistant and System
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChatHistory.AuthorRolesRole of the author of a chat messagestatic classChatHistory.MessageChat message representation
-
Constructor Summary
Constructors Constructor Description ChatHistory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessage(ChatHistory.AuthorRoles authorRole, String content)Add a message to the chat historyOptional<ChatHistory.Message>getLastMessage()Get last messageList<ChatHistory.Message>getMessages()Get the chat history
-
-
-
Method Detail
-
getMessages
public List<ChatHistory.Message> getMessages()
Get the chat history- Returns:
- List of messages in the chat
-
getLastMessage
public Optional<ChatHistory.Message> getLastMessage()
Get last message- Returns:
- The most recent message in chat
-
addMessage
public void addMessage(ChatHistory.AuthorRoles authorRole, String content)
Add a message to the chat history- Parameters:
authorRole- Role of the message authorcontent- Message content
-
-