fix: Chroma VectorStore auto configuration

- Add null check for the Chroma vector store ObservationConvention
   - Since the builder enforces non null check, the ChromaVectorStore builder in its autoconfiguration will only set the ObservationConvention if it is not null.
This commit is contained in:
Ilayaperumal Gopinathan
2024-12-06 18:49:01 +00:00
parent 2ef4559827
commit a8dda0a8f1

View File

@@ -86,14 +86,17 @@ public class ChromaVectorStoreAutoConfiguration {
ChromaVectorStoreProperties storeProperties, ObjectProvider<ObservationRegistry> observationRegistry,
ObjectProvider<VectorStoreObservationConvention> customObservationConvention,
BatchingStrategy chromaBatchingStrategy) {
return ChromaVectorStore.builder(chromaApi)
ChromaVectorStore.ChromaBuilder chromaBuilder = ChromaVectorStore.builder(chromaApi)
.embeddingModel(embeddingModel)
.collectionName(storeProperties.getCollectionName())
.initializeSchema(storeProperties.isInitializeSchema())
.observationRegistry(observationRegistry.getIfUnique(() -> ObservationRegistry.NOOP))
.customObservationConvention(customObservationConvention.getIfAvailable(() -> null))
.batchingStrategy(chromaBatchingStrategy)
.build();
.batchingStrategy(chromaBatchingStrategy);
VectorStoreObservationConvention observationConvention = customObservationConvention.getIfAvailable();
if (observationConvention != null) {
chromaBuilder.customObservationConvention(observationConvention);
}
return chromaBuilder.build();
}
static class PropertiesChromaConnectionDetails implements ChromaConnectionDetails {