Class EmbeddingStoreIngestor
-
- All Implemented Interfaces:
public class EmbeddingStoreIngestorThe
EmbeddingStoreIngestorrepresents an ingestion pipeline and is responsible for ingesting Documents into an EmbeddingStore. In the simplest configuration,EmbeddingStoreIngestorembeds provided documents using a provided EmbeddingModel and stores them, along with their Embeddings in anEmbeddingStore. Optionally, theEmbeddingStoreIngestorcan transform documents using a provided DocumentTransformer. This can be useful if you want to clean, enrich, or format documents before embedding them. Optionally, theEmbeddingStoreIngestorcan split documents into TextSegments using a provided DocumentSplitter. This can be useful if documents are big, and you want to split them into smaller segments to improve the quality of similarity searches and reduce the size and cost of a prompt sent to the LLM. Optionally, theEmbeddingStoreIngestorcan transformTextSegments using a TextSegmentTransformer. This can be useful if you want to clean, enrich, or formatTextSegments before embedding them. Including a document title or a short summary in eachTextSegmentis a common technique to improve the quality of similarity searches.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classEmbeddingStoreIngestor.BuilderEmbeddingStoreIngestor builder.
-
Constructor Summary
Constructors Constructor Description EmbeddingStoreIngestor(DocumentTransformer documentTransformer, DocumentSplitter documentSplitter, TextSegmentTransformer textSegmentTransformer, EmbeddingModel embeddingModel, EmbeddingStore<TextSegment> embeddingStore)Creates an instance of an EmbeddingStoreIngestor.
-
Method Summary
Modifier and Type Method Description static IngestionResultingest(Document document, EmbeddingStore<TextSegment> embeddingStore)Ingests a specified Document into a specified EmbeddingStore. static IngestionResultingest(List<Document> documents, EmbeddingStore<TextSegment> embeddingStore)Ingests specified Documents into a specified EmbeddingStore. IngestionResultingest(Document document)Ingests a specified document into an EmbeddingStore that was specified during the creation of this EmbeddingStoreIngestor.IngestionResultingest(Array<Document> documents)Ingests specified documents into an EmbeddingStore that was specified during the creation of this EmbeddingStoreIngestor.IngestionResultingest(List<Document> documents)Ingests specified documents into an EmbeddingStore that was specified during the creation of this EmbeddingStoreIngestor.static EmbeddingStoreIngestor.Builderbuilder()Creates a new EmbeddingStoreIngestor builder. -
-
Constructor Detail
-
EmbeddingStoreIngestor
EmbeddingStoreIngestor(DocumentTransformer documentTransformer, DocumentSplitter documentSplitter, TextSegmentTransformer textSegmentTransformer, EmbeddingModel embeddingModel, EmbeddingStore<TextSegment> embeddingStore)
Creates an instance of anEmbeddingStoreIngestor.- Parameters:
documentTransformer- The DocumentTransformer to use.documentSplitter- The DocumentSplitter to use.textSegmentTransformer- The TextSegmentTransformer to use.embeddingModel- The EmbeddingModel to use.embeddingStore- The EmbeddingStore to use.
-
-
Method Detail
-
ingest
static IngestionResult ingest(Document document, EmbeddingStore<TextSegment> embeddingStore)
Ingests a specified Document into a specified EmbeddingStore. Uses DocumentSplitter and EmbeddingModel found through SPIs (see DocumentSplitterFactory and EmbeddingModelFactory). For the "Easy RAG", import
langchain4j-easy-ragmodule, which contains aDocumentSplitterFactoryandEmbeddingModelFactoryimplementations.- Returns:
result including information related to ingestion process.
-
ingest
static IngestionResult ingest(List<Document> documents, EmbeddingStore<TextSegment> embeddingStore)
Ingests specified Documents into a specified EmbeddingStore. Uses DocumentSplitter and EmbeddingModel found through SPIs (see DocumentSplitterFactory and EmbeddingModelFactory). For the "Easy RAG", import
langchain4j-easy-ragmodule, which contains aDocumentSplitterFactoryandEmbeddingModelFactoryimplementations.- Returns:
result including information related to ingestion process.
-
ingest
IngestionResult ingest(Document document)
Ingests a specified document into an EmbeddingStore that was specified during the creation of this
EmbeddingStoreIngestor.- Parameters:
document- the document to ingest.- Returns:
result including information related to ingestion process.
-
ingest
IngestionResult ingest(Array<Document> documents)
Ingests specified documents into an EmbeddingStore that was specified during the creation of this
EmbeddingStoreIngestor.- Parameters:
documents- the documents to ingest.- Returns:
result including information related to ingestion process.
-
ingest
IngestionResult ingest(List<Document> documents)
Ingests specified documents into an EmbeddingStore that was specified during the creation of this
EmbeddingStoreIngestor.- Parameters:
documents- the documents to ingest.- Returns:
result including information related to ingestion process.
-
builder
static EmbeddingStoreIngestor.Builder builder()
Creates a new EmbeddingStoreIngestor builder.
- Returns:
the builder.
-
-
-
-