Class ChatMessageContent<T>
- java.lang.Object
-
- com.microsoft.semantickernel.services.KernelContent<T>
-
- com.microsoft.semantickernel.services.chatcompletion.ChatMessageContent<T>
-
- Type Parameters:
T- the type of the inner content within the messages
- Direct Known Subclasses:
ChatMessageImageContent,ChatMessageTextContent
public class ChatMessageContent<T> extends KernelContent<T>
Represents the content of a chat messageThis class defaults to a
ChatMessageContentType.TEXTcontent type if none is specified. However, if using this for text content, consider usingChatMessageTextContentand its builders instead.
-
-
Constructor Summary
Constructors Constructor Description ChatMessageContent(AuthorRole authorRole, String content)Creates a new instance of theChatMessageContentclass.ChatMessageContent(AuthorRole authorRole, String content, String modelId, T innerContent, Charset encoding, FunctionResultMetadata metadata)Creates a new instance of theChatMessageContentclass.ChatMessageContent(AuthorRole authorRole, String content, String modelId, T innerContent, Charset encoding, FunctionResultMetadata metadata, ChatMessageContentType contentType)Creates a new instance of theChatMessageContentclass.ChatMessageContent(AuthorRole authorRole, List<KernelContent<T>> items, String modelId, T innerContent, Charset encoding, FunctionResultMetadata metadata, ChatMessageContentType contentType)Creates a new instance of theChatMessageContentclass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthorRolegetAuthorRole()Gets the author role that generated the contentStringgetContent()Gets the contentChatMessageContentTypegetContentType()Gets the content typeCharsetgetEncoding()Gets the encoding of the contentList<KernelContent<T>>getItems()Gets theKernelContentitems that comprise the content.StringtoString()-
Methods inherited from class com.microsoft.semantickernel.services.KernelContent
getInnerContent, getMetadata
-
-
-
-
Constructor Detail
-
ChatMessageContent
public ChatMessageContent(AuthorRole authorRole, String content)
Creates a new instance of theChatMessageContentclass. Defaults toChatMessageContentType.TEXTcontent type.- Parameters:
authorRole- the author role that generated the contentcontent- the content
-
ChatMessageContent
public ChatMessageContent(AuthorRole authorRole, String content, @Nullable String modelId, @Nullable T innerContent, @Nullable Charset encoding, @Nullable FunctionResultMetadata metadata)
Creates a new instance of theChatMessageContentclass. Defaults toChatMessageContentType.TEXTcontent type.- Parameters:
authorRole- the author role that generated the contentcontent- the contentmodelId- the model idinnerContent- the inner contentencoding- the encodingmetadata- the metadata
-
ChatMessageContent
public ChatMessageContent(AuthorRole authorRole, String content, @Nullable String modelId, @Nullable T innerContent, @Nullable Charset encoding, @Nullable FunctionResultMetadata metadata, ChatMessageContentType contentType)
Creates a new instance of theChatMessageContentclass.- Parameters:
authorRole- the author role that generated the contentcontent- the contentmodelId- the model idinnerContent- the inner contentencoding- the encodingmetadata- the metadatacontentType- the content type
-
ChatMessageContent
public ChatMessageContent(AuthorRole authorRole, @Nullable List<KernelContent<T>> items, String modelId, T innerContent, Charset encoding, FunctionResultMetadata metadata, ChatMessageContentType contentType)
Creates a new instance of theChatMessageContentclass.- Parameters:
authorRole- the author role that generated the contentitems- the itemsmodelId- the model idinnerContent- the inner contentencoding- the encodingmetadata- the metadatacontentType- the content type
-
-
Method Detail
-
getAuthorRole
public AuthorRole getAuthorRole()
Gets the author role that generated the content- Returns:
- the author role that generated the content
-
getContent
@Nullable public String getContent()
Gets the content- Specified by:
getContentin classKernelContent<T>- Returns:
- the content, which may be
null
-
getItems
@Nullable public List<KernelContent<T>> getItems()
Gets theKernelContentitems that comprise the content.- Returns:
- the items, which may be
null
-
getEncoding
@Nullable public Charset getEncoding()
Gets the encoding of the content- Returns:
- the encoding, which may be
null
-
getContentType
public ChatMessageContentType getContentType()
Gets the content type- Returns:
- the content type
-
-