Skip to content

Commit 5d5b22a

Browse files
addressed comments
1 parent aeb3c5d commit 5d5b22a

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

tutorial/markdown/aspnet/semantic-kernel/semantic-kernel-tutorial.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
---
22
# frontmatter
3-
path: "/tutorial-csharp-semantic-kernel-vector-search"
3+
path: "/tutorial-csharp-couchbase-vector-search-semantic-kernel"
44
# title and description do not need to be added to markdown, start with H2 (##)
55
title: Build Vector Search with Couchbase .NET Semantic Kernel Connector and OpenAI
66
short_title: Vector Search with Semantic Kernel
77
description:
8-
- Build a semantic search application using Couchbase Hyperscale vector index with Semantic Kernel.
8+
- Build a semantic search application using Couchbase Vector Search with Semantic Kernel.
99
- Learn to use the Couchbase .NET Vector Store Connector for Microsoft Semantic Kernel.
1010
- Discover how to generate embeddings with OpenAI and store them in Couchbase.
1111
- Perform vector similarity searches with filtering using SQL++ and ANN_DISTANCE.
1212
content_type: tutorial
1313
filter: sdk
1414
technology:
15+
- hyperscale vector index
16+
- composite vector index
1517
- fts
1618
- kv
1719
tags:
@@ -35,43 +37,43 @@ This demo showcases the **Semantic Kernel Couchbase connector** - a .NET library
3537
The connector supports three index types:
3638
- **Hyperscale Vector Index** - for pure vector search at scale ← *Used in this demo*
3739
- **Composite Vector Index** - for vector search with heavy scalar filtering
38-
- **FTS** (Full-Text Search) - for hybrid text + semantic search
40+
- **Search Vector Index** (using Search service) - for hybrid text + semantic search
3941

4042
This makes the connector ideal for RAG (Retrieval-Augmented Generation) applications, semantic search engines, hybrid search, and recommendation systems.
4143

4244
## Prerequisites
4345

44-
### 1. Couchbase Server Setup
46+
### Couchbase Server Setup
4547
- **Couchbase Server 8.0+**
4648
- Local installation or Couchbase Cloud/Capella
4749
- Bucket with proper read/write permissions
4850
- Query service enabled for SQL++ operations
4951

50-
### 2. OpenAI API Access
52+
### OpenAI API Access
5153
- **OpenAI API Key** - Get one from: https://platform.openai.com/api-keys
5254
- Used for generating text embeddings with `text-embedding-3-small` model
5355
- Ensure you have sufficient API quota for embedding generation
5456

55-
### 3. Development Environment
57+
### Development Environment
5658
- **.NET 8.0** or later
5759
- Visual Studio, VS Code, or JetBrains Rider
5860
- Basic understanding of C# and vector databases
5961

6062

6163
## Setting Up the Environment
6264

63-
### 1. Clone and Navigate
65+
### Clone and Navigate
6466
```bash
6567
git clone https://github.com/couchbase-examples/couchbase-semantic-kernel-quickstart.git
6668
cd couchbase-semantic-kernel-quickstart/CouchbaseVectorSearchDemo
6769
```
6870

69-
### 2. Install Dependencies
71+
### Install Dependencies
7072
```bash
7173
dotnet restore
7274
```
7375

74-
### 3. Configuration Setup
76+
### Configuration Setup
7577

7678
Update `appsettings.Development.json` with your credentials:
7779

@@ -124,14 +126,14 @@ internal sealed class Glossary
124126

125127
## Step-by-Step Tutorial
126128

127-
### Step 1: Prepare Couchbase
129+
### Prepare Couchbase
128130

129131
Ensure you have the bucket, scope, and collection ready in Couchbase:
130132
- **Bucket**: `demo`
131133
- **Scope**: `semantic-kernel`
132134
- **Collection**: `glossary`
133135

134-
### Step 2: Data Ingestion and Embedding Generation
136+
### Data Ingestion and Embedding Generation
135137

136138
This step demonstrates how the connector works with Semantic Kernel's vector store abstractions:
137139

@@ -142,13 +144,12 @@ var collection = vectorStore.GetCollection<string, Glossary>(
142144
"glossary",
143145
new CouchbaseQueryCollectionOptions
144146
{
145-
IndexName = "hyperscale_glossary_index", // Hyperscale index name
146147
SimilarityMetric = "cosine"
147148
}
148149
);
149150
```
150151

151-
The `CouchbaseQueryCollectionOptions` works with both Hyperscale and Composite indexes - simply specify the appropriate index name. For FTS indexes, use `CouchbaseSearchCollection` with `CouchbaseSearchCollectionOptions` instead.
152+
The `CouchbaseQueryCollectionOptions` works with both Hyperscale and Composite indexes - simply specify the appropriate index name. For Search Vector indexes, use `CouchbaseSearchCollection` with `CouchbaseSearchCollectionOptions` instead.
152153

153154
**Automatic Embedding Generation** - The connector integrates with Semantic Kernel's `IEmbeddingGenerator` interface to automatically generate embeddings from text. When you provide an embedding generator (in this case, OpenAI's `text-embedding-3-small`), the text is automatically converted to vectors:
154155

@@ -178,9 +179,13 @@ This creates 6 sample glossary entries with technical terms, generates embedding
178179
}
179180
```
180181

181-
### Step 3: Hyperscale Index Creation
182+
### Hyperscale Index Creation
182183

183-
This demo uses a **Hyperscale Vector Index** - optimized for pure vector searches without heavy scalar filtering. After documents are inserted, the demo creates the Hyperscale index:
184+
While the application works without creating indexes manually, you can optionally create a vector index for better performance.
185+
186+
This demo uses a **Hyperscale Vector Index** - optimized for pure vector searches without heavy scalar filtering.
187+
188+
After documents are inserted, the demo creates the Hyperscale index:
184189

185190
```sql
186191
CREATE VECTOR INDEX `hyperscale_glossary_index`
@@ -200,9 +205,9 @@ USING GSI WITH {
200205
- **Include Fields**: Non-vector fields for faster retrieval
201206
- **Quantization**: `IVF,SQ8` (Inverted File with 8-bit scalar quantization)
202207

203-
> **Note**: [Composite vector indexes](https://docs.couchbase.com/server/current/vector-index/composite-vector-index.html) can be created similarly by adding scalar fields to the index definition. Use Composite indexes when your queries frequently filter on scalar values before vector comparison. For this demo, we use Hyperscale since we're demonstrating pure semantic search capabilities.
208+
> **Note**: [Composite vector indexes](https://docs.couchbase.com/server/current/vector-index/composite-vector-index.html) can be created similarly by adding scalar fields to the index definition. Use Composite indexes when your queries frequently filter on scalar values before vector comparison. For this demo, we use Hyperscale since we are demonstrating pure semantic search capabilities.
204209
205-
### Step 4: Vector Search Operations
210+
### Vector Search Operations
206211

207212
The demo performs two types of searches using the connector's `SearchAsync()` method with the Hyperscale index:
208213

@@ -228,6 +233,8 @@ ORDER BY _distance ASC
228233
LIMIT 1
229234
```
230235

236+
> **Note**: The distance metric (`'cosine'` in this example) comes from the `SimilarityMetric` property configured when creating the collection:
237+
231238
**Expected Result**: Finds "API" entry with high similarity
232239

233240
#### Filtered Vector Search
@@ -280,7 +287,7 @@ Couchbase offers three types of vector indexes optimized for different use cases
280287
- Ideal for: Compliance filtering, user-specific searches, time-bounded queries
281288
- **Creation**: Similar to Hyperscale but includes scalar fields in the index definition
282289

283-
**3. FTS (Full-Text Search) Indexes**
290+
**3. Search Vector Indexes**
284291
- Uses Couchbase Search API via `CouchbaseSearchCollection`
285292
- Best for hybrid search scenarios combining full-text search with vector similarity
286293
- Supports text search, faceting, and vector search in a single query
@@ -293,7 +300,7 @@ All three index types work with the same Semantic Kernel abstractions (`SearchAs
293300
**Choosing the Right Type**:
294301
- Start with **Hyperscale** for pure vector searches and large datasets
295302
- Use **Composite** when scalar filters eliminate large portions of data before vector comparison
296-
- Use **FTS** when you need hybrid search combining full-text and semantic search
303+
- Use **Search Vector Index** when you need hybrid search combining full-text and semantic search
297304

298305
For more details, see the [Couchbase Vector Index Documentation](https://docs.couchbase.com/server/current/vector-index/use-vector-indexes.html).
299306

@@ -339,7 +346,7 @@ Data ingestion completed
339346
340347
Step 2: Creating Hyperscale vector index manually...
341348
Executing Hyperscale index creation query...
342-
Hyperscale vector index 'hyperscale_glossary_index' already exists.
349+
Hyperscale vector index 'hyperscale_glossary_index' created successfully!
343350
344351
Step 3: Performing vector search...
345352
Found: API
@@ -372,7 +379,7 @@ The Couchbase Semantic Kernel connector provides a seamless integration between
372379
**Vector Store Classes:**
373380
- **`CouchbaseVectorStore`** - Main entry point for vector store operations
374381
- **`CouchbaseQueryCollection`** - Collection class for Hyperscale and Composite indexes (SQL++)
375-
- **`CouchbaseSearchCollection`** - Collection class for FTS indexes (Search API)
382+
- **`CouchbaseSearchCollection`** - Collection class for Search Vector indexes (Search, formerly known as Full Text service)
376383

377384
**Common Methods (all index types):**
378385
- **`GetCollection<TKey, TRecord>()`** - Returns a typed collection for CRUD operations
@@ -382,7 +389,7 @@ The Couchbase Semantic Kernel connector provides a seamless integration between
382389

383390
**Configuration Options:**
384391
- **`CouchbaseQueryCollectionOptions`** - For Hyperscale and Composite indexes
385-
- **`CouchbaseSearchCollectionOptions`** - For FTS indexes
392+
- **`CouchbaseSearchCollectionOptions`** - For Search Vector indexes
386393

387394
For more documentation, visit the [connector repository](https://github.com/Couchbase-Ecosystem/couchbase-semantic-kernel).
388395

0 commit comments

Comments
 (0)