Class TextSegment

java.lang.Object
dev.langchain4j.data.segment.TextSegment

public class TextSegment extends Object
Represents a semantically meaningful segment (chunk/piece/fragment) of a larger entity such as a document or chat conversation. This might be a sentence, a paragraph, or any other discrete unit of text that carries meaning. This class encapsulates a piece of text and its associated metadata.
  • Constructor Details

    • TextSegment

      public TextSegment(String text, Metadata metadata)
      Creates a new text segment.
      Parameters:
      text - the text.
      metadata - the metadata.
  • Method Details