Class TextContent

java.lang.Object
dev.langchain4j.data.message.TextContent
All Implemented Interfaces:
Content

public class TextContent extends Object implements Content
Represents a text content.
  • Constructor Details

    • TextContent

      public TextContent(String text)
      Creates a new text content.
      Parameters:
      text - the text.
  • Method Details

    • text

      public String text()
      Returns the text.
      Returns:
      the text.
    • type

      public ContentType type()
      Description copied from interface: Content
      Returns the type of content.

      Can be used to cast the content to the correct type.

      Specified by:
      type in interface Content
      Returns:
      The type of content.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • from

      public static TextContent from(String text)
      Creates a new text content.
      Parameters:
      text - the text.
      Returns:
      the text content.