Skip to content

Commit 7d9b329

Browse files
committed
docs: update ingestion docs
1 parent 95a552c commit 7d9b329

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

docs/sections/java-quarkus/05-ingestion.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ The embeddings along with the original texts are then added to the vector databa
5454
```java
5555
public class EmbeddingStoreProducer {
5656

57+
private static final Logger log = LoggerFactory.getLogger(EmbeddingStoreProducer.class);
58+
5759
@ConfigProperty(name = "AZURE_SEARCH_INDEX", defaultValue = "kbindex")
5860
String azureSearchIndexName;
5961

@@ -64,15 +66,27 @@ public class EmbeddingStoreProducer {
6466
public EmbeddingStore<TextSegment> embeddingStore() throws URISyntaxException {
6567
String qdrantHostname = new URI(qdrantUrl).getHost();
6668
int qdrantPort = new URI(qdrantUrl).getPort();
69+
70+
QdrantGrpcClient.Builder grpcClientBuilder = QdrantGrpcClient.newBuilder(qdrantHostname, qdrantPort, false);
71+
QdrantClient qdrantClient = new QdrantClient(grpcClientBuilder.build());
72+
qdrantClient.createCollectionAsync(
73+
azureSearchIndexName,
74+
VectorParams.newBuilder()
75+
.setSize(384)
76+
.setDistance(Distance.Cosine)
77+
.build()
78+
).get();
79+
6780
return QdrantEmbeddingStore.builder()
81+
.client(qdrantClient)
6882
.collectionName(azureSearchIndexName)
69-
.host(qdrantHostname)
70-
.port(qdrantPort)
7183
.build();
7284
}
7385
}
7486
```
7587

88+
If there's no collection found with the specified name in Qdrant, it will create one.
89+
7690
### Running the ingestion process
7791

7892
Let's now execute this process. First, you need to make sure you have Qdrant running locally and all setup. Run the following command in a terminal to start up Qdrant (**make sure you stopped the Qdrant container before!**):
@@ -81,18 +95,7 @@ Let's now execute this process. First, you need to make sure you have Qdrant run
8195
docker compose up qdrant
8296
```
8397

84-
This will start Qdrant locally. Make sure you can access the Qdrant dashboard at the URL http://localhost:6333/dashboard. Then, create a new collection named `kbindex` with the following cUrl command:
85-
86-
```bash
87-
curl -X PUT 'http://localhost:6333/collections/kbindex' \
88-
-H 'Content-Type: application/json' \
89-
--data-raw '{
90-
"vectors": {
91-
"size": 384,
92-
"distance": "Cosine"
93-
}
94-
}'
95-
```
98+
This will start Qdrant locally. Make sure you can access the Qdrant dashboard at the URL http://localhost:6333/dashboard.
9699

97100
You should see the collection in the dashabord:
98101

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ public EmbeddingStore<TextSegment> embeddingStore() throws URISyntaxException {
3535

3636
QdrantGrpcClient.Builder grpcClientBuilder = QdrantGrpcClient.newBuilder(qdrantHostname, qdrantPort, false);
3737
QdrantClient qdrantClient = new QdrantClient(grpcClientBuilder.build());
38-
qdrantClient.createCollectionAsync(azureSearchIndexName, VectorParams.newBuilder().setSize(384).setDistance(Distance.Cosine).build()).get();
38+
qdrantClient.createCollectionAsync(
39+
azureSearchIndexName,
40+
VectorParams.newBuilder()
41+
.setSize(384)
42+
.setDistance(Distance.Cosine)
43+
.build()
44+
).get();
3945

4046
return QdrantEmbeddingStore.builder()
4147
.client(qdrantClient)

0 commit comments

Comments
 (0)