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
- All Implemented Interfaces:
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.Type -
Constructor Summary
ConstructorsConstructorDescriptionTextContent(String text) TextContent(String text, Map<MetaKey, Object> _meta) Creates an instance of aTextContentrecord class. -
Method Summary
Modifier and TypeMethodDescription_meta()Returns the value of the_metarecord 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
-
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
-