Class IngestionConfiguration

java.lang.Object
io.micronaut.langchain4j.rag.IngestionConfiguration

@EachProperty("langchain4j.rag.ingestion") public final class IngestionConfiguration extends Object
Configures the ingestion of documents into an embedding store: the documents are loaded from the sources, split into segments, embedded with the embedding model and stored. An EmbeddingStoreIngestor bean named after the configuration is created to ingest other documents.
Since:
2.4.0
  • Field Details

    • PREFIX

      public static final String PREFIX
      The configuration prefix.
      See Also:
    • DEFAULT_MAX_SEGMENT_SIZE

      public static final int DEFAULT_MAX_SEGMENT_SIZE
      The default maximum size of a segment, in characters.
      See Also:
    • DEFAULT_MAX_OVERLAP_SIZE

      public static final int DEFAULT_MAX_OVERLAP_SIZE
      The default maximum overlap of two segments, in characters.
      See Also:
    • DEFAULT_GLOB

      public static final String DEFAULT_GLOB
      The default glob of the documents.
      See Also:
  • Constructor Details

    • IngestionConfiguration

      public IngestionConfiguration(@Parameter String name)
      Parameters:
      name - The name of the ingestion
  • Method Details

    • getSources

      public List<String> getSources()
      Returns:
      The locations of the documents
    • setSources

      public void setSources(List<String> sources)
      Parameters:
      sources - The locations of the documents: directories of the file system, or of the classpath with the classpath: prefix
    • getGlob

      public String getGlob()
      Returns:
      The glob the documents match
    • setGlob

      public void setGlob(String glob)
      Parameters:
      glob - The glob the documents match, for example *.md. Defaults to "**".
    • isRecursive

      public boolean isRecursive()
      Returns:
      Whether the documents of the sub-directories of the file system sources are loaded
    • setRecursive

      public void setRecursive(boolean recursive)
      Parameters:
      recursive - Whether the documents of the sub-directories of the file system sources are loaded. Defaults to true.
    • getMaxSegmentSize

      public int getMaxSegmentSize()
      Returns:
      The maximum size of a segment, in characters
    • setMaxSegmentSize

      public void setMaxSegmentSize(int maxSegmentSize)
      Parameters:
      maxSegmentSize - The maximum size of a segment, in characters. Defaults to 1000.
    • getMaxOverlapSize

      public int getMaxOverlapSize()
      Returns:
      The maximum overlap of two consecutive segments, in characters
    • setMaxOverlapSize

      public void setMaxOverlapSize(int maxOverlapSize)
      Parameters:
      maxOverlapSize - The maximum overlap of two consecutive segments, in characters. Defaults to 100.
    • isIngestOnStartup

      public boolean isIngestOnStartup()
      Returns:
      Whether the documents of the sources are ingested when the application starts
    • setIngestOnStartup

      public void setIngestOnStartup(boolean ingestOnStartup)
      Parameters:
      ingestOnStartup - Whether the documents of the sources are ingested when the application starts. Defaults to true.
    • getName

      public String getName()
      Returns:
      The name of the configuration, which is the name of the bean it configures
    • getEmbeddingStore

      public @Nullable String getEmbeddingStore()
      Returns:
      The name of the embedding store bean, or null for the default embedding store
    • setEmbeddingStore

      public void setEmbeddingStore(@Nullable String embeddingStore)
      Parameters:
      embeddingStore - The name of the embedding store bean. Defaults to the default embedding store.
    • getEmbeddingModel

      public @Nullable String getEmbeddingModel()
      Returns:
      The name of the embedding model bean, or null for the default embedding model
    • setEmbeddingModel

      public void setEmbeddingModel(@Nullable String embeddingModel)
      Parameters:
      embeddingModel - The name of the embedding model bean. Defaults to the default embedding model.