Package io.openliberty.mcp.content
Record Class TextContent
java.lang.Object
java.lang.Record
io.openliberty.mcp.content.TextContent
- Record Components:
text- (must not benull)_meta- the optional metadata (may benull)annotations- the optional annotations (may benull)
- All Implemented Interfaces:
Content
public record TextContent(String text, Map<MetaKey,Object> _meta, Content.Annotations annotations)
extends Record
implements Content
A text content provided to or from an LLM.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.openliberty.mcp.content.Content
Content.Annotations, Content.Type -
Constructor Summary
ConstructorsConstructorDescriptionTextContent(String text) TextContent(String text, Map<MetaKey, Object> _meta, Content.Annotations annotations) Creates an instance of aTextContentrecord class. -
Method Summary
Modifier and TypeMethodDescription_meta()Returns the value of the_metarecord component.Returns the value of theannotationsrecord component.asText()Casts and returns this object as a text content, or throws anIllegalArgumentExceptionif the content object does not represent aTextContent.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.type()
-
Constructor Details
-
TextContent
-
TextContent
Creates an instance of aTextContentrecord class.- Parameters:
text- the value for thetextrecord component_meta- the value for the_metarecord componentannotations- the value for theannotationsrecord component
-
-
Method Details
-
type
-
asText
Description copied from interface:ContentCasts and returns this object as a text content, or throws anIllegalArgumentExceptionif the content object does not represent aTextContent. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
_meta
Returns the value of the_metarecord component.- Returns:
- the value of the
_metarecord component
-
annotations
Returns the value of theannotationsrecord component.- Specified by:
annotationsin interfaceContent- Returns:
- the value of the
annotationsrecord component
-