Skip to content

Commit fe180fb

Browse files
committed
fix: Catch collection creation error
1 parent 6852302 commit fe180fb

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/ingestion-java/src/main/java/ai/azure/openai/rag/workshop/ingestion/configuration/EmbeddingStoreProducer.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ public EmbeddingStore<TextSegment> embeddingStore() throws Exception {
3434

3535
QdrantGrpcClient.Builder grpcClientBuilder = QdrantGrpcClient.newBuilder(qdrantHostname, qdrantPort, false);
3636
QdrantClient qdrantClient = new QdrantClient(grpcClientBuilder.build());
37-
qdrantClient.createCollectionAsync(
38-
azureSearchIndexName,
39-
VectorParams.newBuilder()
40-
.setSize(384)
41-
.setDistance(Distance.Cosine)
42-
.build()
37+
try {
38+
qdrantClient.createCollectionAsync(
39+
azureSearchIndexName,
40+
VectorParams.newBuilder()
41+
.setSize(384)
42+
.setDistance(Distance.Cosine)
43+
.build()
4344
).get();
45+
} catch (Exception e) {
46+
log.info("Collection already exists, skipping creation. Error: {}", e.getMessage());
47+
}
4448

4549
return QdrantEmbeddingStore.builder()
4650
.client(qdrantClient)

0 commit comments

Comments
 (0)