ChatMessageContent<T> Class
- java.
lang. Object - com.
microsoft. semantickernel. services. KernelContentImpl<T> - com.
microsoft. semantickernel. services. chatcompletion. ChatMessageContent<T>
- com.
- com.
Type Parameters
- T
the type of the inner content within the messages
public class ChatMessageContent<T>
extends KernelContentImpl<T>
Represents the content of a chat message
This class defaults to a TEXT content type if none is specified. However, if using this for text content, consider using ChatMessageTextContent and its builders instead.
Constructor Summary
| Constructor | Description |
|---|---|
| ChatMessageContent(AuthorRole authorRole, String content) |
Creates a new instance of the ChatMessageContent<T> class. |
| ChatMessageContent(AuthorRole authorRole, String content, String modelId, T innerContent, Charset encoding, FunctionResultMetadata metadata) |
Creates a new instance of the ChatMessageContent<T> class. |
| ChatMessageContent(AuthorRole authorRole, String content, String modelId, T innerContent, Charset encoding, FunctionResultMetadata metadata, ChatMessageContentType contentType) |
Creates a new instance of the ChatMessageContent<T> class. |
| ChatMessageContent(AuthorRole authorRole, List<KernelContent<T>> items, String modelId, T innerContent, Charset encoding, FunctionResultMetadata metadata, ChatMessageContentType contentType) |
Creates a new instance of the ChatMessageContent<T> class. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
Author |
getAuthorRole()
Gets the author role that generated the content |
| java.lang.String |
getContent()
Gets the content |
|
Chat |
getContentType()
Gets the content type |
| java.nio.charset.Charset |
getEncoding()
Gets the encoding of the content |
|
java.util.List<Kernel |
getItems()
Gets the |
| java.lang.String | toString() |
Methods inherited from KernelContentImpl
Methods inherited from java.lang.Object
Constructor Details
ChatMessageContent
public ChatMessageContent(AuthorRole authorRole, String content)
Creates a new instance of the ChatMessageContent<T> class. Defaults to TEXT content type.
Parameters:
ChatMessageContent
public ChatMessageContent(AuthorRole authorRole, String content, String modelId, T innerContent, Charset encoding, FunctionResultMetadata metadata)
Creates a new instance of the ChatMessageContent<T> class. Defaults to TEXT content type.
Parameters:
ChatMessageContent
public ChatMessageContent(AuthorRole authorRole, String content, String modelId, T innerContent, Charset encoding, FunctionResultMetadata metadata, ChatMessageContentType contentType)
Creates a new instance of the ChatMessageContent<T> class.
Parameters:
ChatMessageContent
public ChatMessageContent(AuthorRole authorRole, List
Creates a new instance of the ChatMessageContent<T> class.
Parameters:
Method Details
getAuthorRole
public AuthorRole getAuthorRole()
Gets the author role that generated the content
Returns:
getContent
public String getContent()
Gets the content
Returns:
nullgetContentType
public ChatMessageContentType getContentType()
Gets the content type
Returns:
getEncoding
public Charset getEncoding()
Gets the encoding of the content
Returns:
nullgetItems
public List
Gets the KernelContent items that comprise the content.
Returns:
nulltoString
public String toString()
Overrides:
ChatMessageContent<T>.toString()