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:
committed by
Ilayaperumal Gopinathan
parent
6a5326816c
commit
9844a18983
@@ -82,8 +82,6 @@ public class PineconeVectorStore extends AbstractObservationVectorStore {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
private final BatchingStrategy batchingStrategy;
|
||||
|
||||
/**
|
||||
* Creates a new PineconeVectorStore using the builder pattern.
|
||||
* @param builder The configured builder instance
|
||||
@@ -110,7 +108,6 @@ public class PineconeVectorStore extends AbstractObservationVectorStore {
|
||||
|
||||
this.pineconeConnection = new PineconeClient(clientConfig).connect(connectionConfig);
|
||||
this.objectMapper = new ObjectMapper();
|
||||
this.batchingStrategy = builder.batchingStrategy;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,8 +314,6 @@ public class PineconeVectorStore extends AbstractObservationVectorStore {
|
||||
|
||||
private Duration serverSideTimeout = Duration.ofSeconds(20);
|
||||
|
||||
private BatchingStrategy batchingStrategy = new TokenCountBatchingStrategy();
|
||||
|
||||
private Builder(EmbeddingModel embeddingModel, String apiKey, String projectId, String environment,
|
||||
String indexName) {
|
||||
super(embeddingModel);
|
||||
@@ -376,18 +371,6 @@ public class PineconeVectorStore extends AbstractObservationVectorStore {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the batching strategy.
|
||||
* @param batchingStrategy The batching strategy to use
|
||||
* @return The builder instance
|
||||
* @throws IllegalArgumentException if batchingStrategy is null
|
||||
*/
|
||||
public Builder batchingStrategy(BatchingStrategy batchingStrategy) {
|
||||
Assert.notNull(batchingStrategy, "BatchingStrategy must not be null");
|
||||
this.batchingStrategy = batchingStrategy;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a new PineconeVectorStore instance with the configured properties.
|
||||
* @return A new PineconeVectorStore instance
|
||||
|
||||
Reference in New Issue
Block a user