Skip to content

Commit 2678679

Browse files
committed
Merge branch 'couchbase-store'
Signed-off-by: Abhiraj <[email protected]>
2 parents e8b2247 + e7631be commit 2678679

File tree

1 file changed

+11
-17
lines changed
  • spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs

1 file changed

+11
-17
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/couchbase.adoc

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -225,31 +225,25 @@ and then create the `CouchbaseSearchVectorStore` bean using the builder pattern:
225225
[source,java]
226226
----
227227
@Bean
228-
public CouchbaseSearchVectorStore vectorStore(Cluster cluster, EmbeddingModel embeddingModel) {
229-
// Create a configuration using the builder pattern
230-
CouchbaseSearchVectorStore.CouchbaseSearchVectorStoreConfig config =
231-
CouchbaseSearchVectorStore.CouchbaseSearchVectorStoreConfig.builder()
232-
.withBucketName("myBucket")
233-
.withScopeName("myScope")
234-
.withCollectionName("myCollection")
235-
.withDimensions(1536)
236-
.withSimilarityFunction(CouchbaseSimilarityFunction.dot_product)
237-
.withIndexOptimization(CouchbaseIndexOptimization.recall)
228+
public VectorStore couchbaseSearchVectorStore(Cluster cluster,
229+
EmbeddingModel embeddingModel,
230+
Boolean initializeSchema) {
231+
return CouchbaseSearchVectorStore
232+
.builder(cluster, embeddingModel)
233+
.bucketName("test")
234+
.scopeName("test")
235+
.collectionName("test")
236+
.initializeSchema(initializeSchema)
238237
.build();
239-
240-
// Create the vector store using the builder pattern
241-
return CouchbaseSearchVectorStore.builder(cluster, config, embeddingModel)
242-
.initializeSchema(true) // Set to true to initialize the required schema
243-
.build();
244238
}
245239
246240
// This can be any EmbeddingModel implementation.
247241
@Bean
248242
public EmbeddingModel embeddingModel() {
249-
return new OpenAiEmbeddingModel(new OpenAiApi(System.getenv("OPENAI_API_KEY")));
243+
return new OpenAiEmbeddingModel(OpenAiApi.builder().apiKey(this.openaiKey).build());
250244
}
251245
----
252246

253247
== Limitations
254248

255-
NOTE: It is mandatory to have the following Couchbase services activated: Data, Query, Index, Search. While Data and Seach could be enough, Query and Index are necessary to support the complete metadata filtering mechanism.
249+
NOTE: It is mandatory to have the following Couchbase services activated: Data, Query, Index, Search. While Data and Search could be enough, Query and Index are necessary to support the complete metadata filtering mechanism.

0 commit comments

Comments
 (0)