You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, `QdrantClient` and `WeaviateClient` are not exposed as
beans. Having access to those would benefit to perform operations
with an already configured client.
- Deprecate QdrantVectorStoreConfig.
- Update Qdrant manual config adoc.
- Improve Qdrant adoc.
- Update Weaviate docs.
Copy file name to clipboardExpand all lines: spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/qdrant.adoc
+59-57Lines changed: 59 additions & 57 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ To set up `QdrantVectorStore`, you'll need the following information from your Q
14
14
NOTE: It is recommended that the Qdrant collection is link:https://qdrant.tech/documentation/concepts/collections/#create-a-collection[created] in advance with the appropriate dimensions and configurations.
15
15
If the collection is not created, the `QdrantVectorStore` will attempt to create one using the `Cosine` similarity and the dimension of the configured `EmbeddingClient`.
16
16
17
-
== Dependencies
17
+
== Auto-configuration
18
18
19
19
Then add the Qdrant boot starter dependency to your project:
Instead of using the Spring Boot auto-configuration, you can manually configure the `QdrantVectorStore`. For this you need to add the `spring-ai-qdrant` dependency to your project:
NOTE: These filter expressions are converted into the equivalent Qdrant link:https://qdrant.tech/documentation/concepts/filtering/[filters].
179
147
180
-
[[qdrant-vectorstore-properties]]
181
-
== Configuration properties
148
+
== Manual Configuration
182
149
183
-
You can use the following properties in your Spring Boot configuration to customize the Qdrant vector store.
150
+
Instead of using the Spring Boot auto-configuration, you can manually configure the `QdrantVectorStore`. For this you need to add the `spring-ai-qdrant` dependency to your project:
184
151
185
-
[cols="3,5,1"]
186
-
|===
187
-
|Property| Description | Default value
152
+
[source,xml]
153
+
----
154
+
<dependency>
155
+
<groupId>org.springframework.ai</groupId>
156
+
<artifactId>spring-ai-qdrant</artifactId>
157
+
</dependency>
158
+
----
188
159
189
-
|`spring.ai.vectorstore.qdrant.host`| The host of the Qdrant server. | localhost
190
-
|`spring.ai.vectorstore.qdrant.port`| The gRPC port of the Qdrant server. | 6334
191
-
|`spring.ai.vectorstore.qdrant.api-key`| The API key to use for authentication with the Qdrant server. | -
192
-
|`spring.ai.vectorstore.qdrant.collection-name`| The name of the collection to use in Qdrant. | -
193
-
|`spring.ai.vectorstore.qdrant.use-tls`| Whether to use TLS(HTTPS). | false
> You must list explicitly all metadata field names and types (`BOOLEAN`, `TEXT`, or `NUMBER`) for any metadata key used in filter expression.
94
-
> The `withFilterableMetadataKeys` above registers filterable metadata fields: `country` of type `TEXT`, `year` of type `NUMBER`, and `active` of type `BOOLEAN`.
95
-
>
96
-
> If the filterable metadata fields are expanded with new entries, you have to (re)upload/update the documents with this metadata.
97
-
>
98
-
> You can use the following Weaviate link:https://weaviate.io/developers/weaviate/api/graphql/filters#special-cases[system metadata] fields without explicit definition: `id`, `_creationTimeUnix`, and `_lastUpdateTimeUnix`.
65
+
TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file.
66
+
Refer to the xref:getting-started.adoc#repositories[Repositories] section to add Milestone and/or Snapshot Repositories to your build file.
99
67
100
-
Then in your main code, create some documents:
68
+
To connect to Weaviate and use the `WeaviateVectorStore`, you need to provide access details for your instance.
69
+
A simple configuration can either be provided via Spring Boot's _application.properties_,
101
70
102
-
[source,java]
71
+
[source,properties]
103
72
----
104
-
List<Document> documents = List.of(
105
-
new Document("Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!!", Map.of("country", "UK", "active", true, "year", 2020)),
106
-
new Document("The World is Big and Salvation Lurks Around the Corner", Map.of()),
107
-
new Document("You walk forward facing the past and you turn back toward the future.", Map.of("country", "NL", "active", false, "year", 2023)));
73
+
spring.ai.vectorstore.weaviate.host=<host of your Weaviate instance>
74
+
spring.ai.vectorstore.weaviate.api-key=<your api key>
75
+
spring.ai.vectorstore.weaviate.scheme=http
76
+
77
+
# API key if needed, e.g. OpenAI
78
+
spring.ai.openai.api.key=<api-key>
108
79
----
109
80
110
-
Now add the documents to your vector store:
81
+
TIP: Check the list of xref:#weaviate-vectorstore-properties[configuration parameters] to learn about the default values and configuration options.
111
82
83
+
Now you can Auto-wire the Weaviate Vector Store in your application and use it
112
84
113
85
[source,java]
114
86
----
115
-
vectorStore.add(List.of(document));
116
-
----
87
+
@Autowired VectorStore vectorStore;
117
88
118
-
And finally, retrieve documents similar to a query:
You can leverage the generic, portable link:https://docs.spring.io/spring-ai/reference/api/vectordbs.html#_metadata_filters[metadata filters] with WeaviateVectorStore as well.
133
124
@@ -194,6 +185,61 @@ operator:And
194
185
}]
195
186
----
196
187
188
+
== Manual Configuration
189
+
190
+
Instead of using the Spring Boot auto-configuration, you can manually configure the `WeaviateVectorStore`.
191
+
For this you need to add the `spring-ai-weaviate-store` dependency to your project:
0 commit comments