Move batching strategy to base vector store builder

Moving BatchingStrategy configuration from individual vector store implementations
to the base AbstractVectorStoreBuilder to reduce code duplication and provide consistent
batching behavior across all vector stores.

The default TokenCountBatchingStrategy is now set in the base builder class.
This commit is contained in:
Soby Chacko
2025-01-08 11:51:42 -05:00
committed by Ilayaperumal Gopinathan
parent 6a5326816c
commit 9844a18983
22 changed files with 35 additions and 292 deletions

View File

@@ -203,8 +203,6 @@ public class PgVectorStore extends AbstractObservationVectorStore implements Ini
private final PgVectorSchemaValidator schemaValidator;
private final BatchingStrategy batchingStrategy;
private final int maxDocumentBatchSize;
/**
@@ -235,7 +233,6 @@ public class PgVectorStore extends AbstractObservationVectorStore implements Ini
this.createIndexMethod = builder.indexType;
this.initializeSchema = builder.initializeSchema;
this.schemaValidator = new PgVectorSchemaValidator(this.jdbcTemplate);
this.batchingStrategy = builder.batchingStrategy;
this.maxDocumentBatchSize = builder.maxDocumentBatchSize;
}
@@ -599,8 +596,6 @@ public class PgVectorStore extends AbstractObservationVectorStore implements Ini
private boolean initializeSchema;
private BatchingStrategy batchingStrategy = new TokenCountBatchingStrategy();
private int maxDocumentBatchSize = MAX_DOCUMENT_BATCH_SIZE;
private PgVectorStoreBuilder(JdbcTemplate jdbcTemplate, EmbeddingModel embeddingModel) {
@@ -649,11 +644,6 @@ public class PgVectorStore extends AbstractObservationVectorStore implements Ini
return this;
}
public PgVectorStoreBuilder batchingStrategy(BatchingStrategy batchingStrategy) {
this.batchingStrategy = batchingStrategy;
return this;
}
public PgVectorStoreBuilder maxDocumentBatchSize(int maxDocumentBatchSize) {
this.maxDocumentBatchSize = maxDocumentBatchSize;
return this;