Skip to content

Commit 1a7d962

Browse files
committed
docs: improved info about auto-embeddings in plain mode
1 parent 95d74f2 commit 1a7d962

File tree

8 files changed

+695
-404
lines changed

8 files changed

+695
-404
lines changed

.translation-cache/Creating_a_table/Local_tables/Plain_and_real-time_table_settings.md.json

Lines changed: 63 additions & 3 deletions
Large diffs are not rendered by default.

.translation-cache/Searching/KNN.md.json

Lines changed: 30 additions & 0 deletions
Large diffs are not rendered by default.

manual/chinese/Creating_a_table/Local_tables/Plain_and_real-time_table_settings.md

Lines changed: 206 additions & 186 deletions
Large diffs are not rendered by default.

manual/chinese/Searching/KNN.md

Lines changed: 88 additions & 41 deletions
Large diffs are not rendered by default.

manual/english/Creating_a_table/Local_tables/Plain_and_real-time_table_settings.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -471,25 +471,45 @@ Each vector attribute stores an array of floating-point numbers that represent d
471471

472472
##### Configuring KNN for vector attributes
473473

474-
To enable KNN searches on float vector attributes, you must add a `knn` configuration that specifies the indexing parameters:
474+
To enable KNN searches on float vector attributes, you must add a `knn` configuration that specifies the indexing parameters. You can configure KNN in two ways:
475+
476+
**1. Manual vector insertion** (you provide pre-computed vectors):
475477

476478
```ini
477479
rt_attr_float_vector = image_vector
478480
rt_attr_float_vector = text_vector
479481
knn = {"attrs":[{"name":"image_vector","type":"hnsw","dims":768,"hnsw_similarity":"COSINE","hnsw_m":16,"hnsw_ef_construction":200},{"name":"text_vector","type":"hnsw","dims":768,"hnsw_similarity":"COSINE","hnsw_m":16,"hnsw_ef_construction":200}]}
480482
```
481483

484+
**2. Auto embeddings** (Manticore generates vectors from text automatically):
485+
486+
```ini
487+
rt_attr_float_vector = embedding_vector
488+
rt_field = title
489+
rt_field = description
490+
knn = {"attrs":[{"name":"embedding_vector","type":"hnsw","hnsw_similarity":"L2","hnsw_m":16,"hnsw_ef_construction":200,"model_name":"sentence-transformers/all-MiniLM-L6-v2","from":"title"}]}
491+
```
492+
482493
**Required KNN parameters:**
483494
- `name`: The name of the vector attribute (must match the `rt_attr_float_vector` name)
484495
- `type`: Index type, currently only `"hnsw"` is supported
485-
- `dims`: Number of dimensions in the vectors (must match your embedding model's output)
496+
- `dims`: Number of dimensions in the vectors. **Required** for manual vector insertion, **must be omitted** when using `model_name` (the model determines dimensions automatically)
486497
- `hnsw_similarity`: Distance function - `"L2"`, `"IP"` (inner product), or `"COSINE"`
487498

488499
**Optional KNN parameters:**
489-
- `hnsw_m`: Maximum connections in the graph
490-
- `hnsw_ef_construction`: Construction time/accuracy trade-off
500+
- `hnsw_m`: Maximum connections in the graph (default: 16)
501+
- `hnsw_ef_construction`: Construction time/accuracy trade-off (default: 200)
502+
503+
**Auto-embeddings parameters** (when using `model_name`):
504+
- `model_name`: The embedding model to use (e.g., `"sentence-transformers/all-MiniLM-L6-v2"`, `"openai/text-embedding-ada-002"`). When specified, `dims` must be omitted as the model determines the dimensions automatically.
505+
- `from`: Comma-separated list of field names to use for embedding generation, or empty string `""` to use all text/string fields. This parameter is required when `model_name` is specified.
506+
- `api_key`: API key for API-based models (OpenAI, Voyage, Jina). Only required for API-based embedding services.
507+
- `cache_path`: Optional path for caching downloaded models (for sentence-transformers models).
508+
- `use_gpu`: Optional boolean to enable GPU acceleration if available.
509+
510+
**Important:** You cannot specify both `dims` and `model_name` in the same configuration - they are mutually exclusive. Use `dims` for manual vector insertion, or `model_name` for auto-embeddings. Use `dims` for manual vector insertion, or `model_name` for auto-embeddings.
491511

492-
For more details on KNN vector search, see the [KNN documentation](../../Searching/KNN.md).
512+
For more details on KNN vector search and auto-embeddings, see the [KNN documentation](../../Searching/KNN.md).
493513

494514
#### rt_attr_bool
495515

manual/english/Searching/KNN.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Query OK, 0 rows affected (0.01 sec)
3939
```
4040

4141
<!-- intro -->
42-
##### Plain mode (using configuration file):
42+
##### Plain mode (using configuration file) - Manual vectors:
4343

4444
<!-- request Config -->
4545
```ini
@@ -51,6 +51,8 @@ table test_vec {
5151
}
5252
```
5353

54+
**Note:** For auto-embeddings in plain mode, see the example below, which shows how to use `model_name` and `from` parameters in the `knn` configuration.
55+
5456
<!-- end -->
5557

5658
<!-- example knn_insert -->
@@ -110,6 +112,51 @@ CREATE TABLE products_all (
110112
);
111113
```
112114

115+
<!-- intro -->
116+
##### Plain mode (using configuration file):
117+
118+
<!-- request Config -->
119+
```ini
120+
table products {
121+
type = rt
122+
path = /path/to/products
123+
rt_field = title
124+
rt_field = description
125+
rt_attr_float_vector = embedding_vector
126+
knn = {"attrs":[{"name":"embedding_vector","type":"hnsw","hnsw_similarity":"L2","hnsw_m":16,"hnsw_ef_construction":200,"model_name":"sentence-transformers/all-MiniLM-L6-v2","from":"title"}]}
127+
}
128+
```
129+
130+
Using OpenAI with API key in plain mode:
131+
```ini
132+
table products_openai {
133+
type = rt
134+
path = /path/to/products_openai
135+
rt_field = title
136+
rt_field = description
137+
rt_attr_float_vector = embedding_vector
138+
knn = {"attrs":[{"name":"embedding_vector","type":"hnsw","hnsw_similarity":"L2","hnsw_m":16,"hnsw_ef_construction":200,"model_name":"openai/text-embedding-ada-002","from":"title,description","api_key":"your-api-key-here"}]}
139+
}
140+
```
141+
142+
Using all text fields (empty FROM):
143+
```ini
144+
table products_all {
145+
type = rt
146+
path = /path/to/products_all
147+
rt_field = title
148+
rt_field = description
149+
rt_attr_float_vector = embedding_vector
150+
knn = {"attrs":[{"name":"embedding_vector","type":"hnsw","hnsw_similarity":"L2","hnsw_m":16,"hnsw_ef_construction":200,"model_name":"sentence-transformers/all-MiniLM-L6-v2","from":""}]}
151+
}
152+
```
153+
154+
**Important notes for plain mode:**
155+
- When using `model_name`, you **must not** specify `dims` - the model automatically determines the vector dimensions. The `dims` and `model_name` parameters are mutually exclusive.
156+
- When **not** using `model_name` (manual vector insertion), you **must** specify `dims` to indicate the vector dimensions.
157+
- The `from` parameter specifies which fields to use for embedding generation (comma-separated list, or empty string for all text/string fields). This parameter is required when using `model_name`.
158+
- For API-based models (OpenAI, Voyage, Jina), include the `api_key` parameter in the knn configuration
159+
113160
<!-- end -->
114161

115162
##### Inserting data with auto embeddings

0 commit comments

Comments
 (0)