Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to turn off ingestion with Easy RAG #518

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,12 @@ public interface EasyRagConfig {
@WithDefault("5")
Integer maxResults();

/**
* The strategy to decide whether document ingestion into the store should happen at startup or not.
* The default is ON. Changing to OFF generally only makes sense if running against a persistent embedding store
* that was already populated.
*/
@WithDefault("ON")
IngestionStrategy ingestionStrategy();

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public class EasyRagRecorder {
private static final Logger LOGGER = Logger.getLogger(EasyRagRecorder.class);

public void ingest(EasyRagConfig config, BeanContainer beanContainer) {
if (config.ingestionStrategy() == IngestionStrategy.OFF) {
LOGGER.info("Skipping document ingestion as per configuration");
return;
}
EmbeddingStore<TextSegment> embeddingStore = beanContainer.beanInstance(EmbeddingStore.class);
EmbeddingModel embeddingModel = beanContainer.beanInstance(EmbeddingModel.class);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.quarkiverse.langchain4j.easyrag.runtime;

public enum IngestionStrategy {

// TODO: we'd like to also have a "if-empty" and "overwrite" strategy
// but these require some enhancements to the EmbeddingStore API

ON,
OFF

}
Loading