Skip to content

Commit defe815

Browse files
Milvus-doc-botMilvus-doc-bot
authored andcommitted
Release new docs to preview
1 parent e18b599 commit defe815

5 files changed

Lines changed: 305 additions & 2 deletions

File tree

v3.0.x/site/en/menuStructure/en.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,12 @@
13011301
"id": "google-gemini.md",
13021302
"order": 10,
13031303
"children": []
1304+
},
1305+
{
1306+
"label": "Yandex Cloud",
1307+
"id": "yandex-cloud.md",
1308+
"order": 11,
1309+
"children": []
13041310
}
13051311
]
13061312
},
@@ -1413,6 +1419,12 @@
14131419
"id": "siliconflow-ranker.md",
14141420
"order": 5,
14151421
"children": []
1422+
},
1423+
{
1424+
"label": "DashScope Ranker",
1425+
"id": "dashscope-ranker.md",
1426+
"order": 6,
1427+
"children": []
14161428
}
14171429
]
14181430
}

v3.0.x/site/en/userGuide/embeddings-reranking/embedding-function/embedding-function-overview.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ The Function module in Milvus allows you to transform raw text data into vector
5252
<td><p><code>FLOAT_VECTOR</code></p></td>
5353
<td><p>API key</p></td>
5454
</tr>
55+
<tr>
56+
<td><p><a href="yandex-cloud.md">Yandex Cloud</a></p></td>
57+
<td><p>Yandex Cloud AI Studio text vectorization models</p></td>
58+
<td><p><code>FLOAT_VECTOR</code></p></td>
59+
<td><p>API key</p></td>
60+
</tr>
5561
<tr>
5662
<td><p><a href="bedrock.md">Bedrock</a></p></td>
5763
<td><p>amazon.titan-embed-text-v2</p></td>
@@ -586,4 +592,4 @@ results = client.search(
586592

587593
```bash
588594
# restful
589-
```
595+
```
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
id: yandex-cloud.md
3+
title: "Yandex Cloud"
4+
summary: "This topic describes how to configure and use Yandex Cloud embedding functions in Milvus."
5+
beta: Milvus 2.6.x
6+
---
7+
8+
# Yandex Cloud
9+
10+
This topic describes how to configure and use Yandex Cloud embedding functions in Milvus.
11+
12+
## Choose an embedding model
13+
14+
Milvus supports Yandex Cloud AI Studio text vectorization models through the `yc` provider. In the Function parameters, set `model_name` to the Yandex Cloud model URI that Milvus should call.
15+
16+
For example, Yandex Text Embeddings for documents use a model URI such as `emb://<folder_ID>/text-search-doc/latest` and return 256-dimensional vectors. For available model URIs and dimensions, refer to [Text vectorization models](https://aistudio.yandex.ru/docs/en/ai-studio/concepts/embeddings).
17+
18+
## Configure credentials
19+
20+
Milvus must know your Yandex Cloud API key before it can request embeddings. You can configure the API key in `milvus.yaml` or through an environment variable.
21+
22+
### Option 1: Configuration file
23+
24+
Store your API key in `milvus.yaml` and point the Yandex Cloud provider to the credential label.
25+
26+
```yaml
27+
# milvus.yaml
28+
credential:
29+
yandex_apikey:
30+
apikey: <YOUR_YC_API_KEY>
31+
32+
function:
33+
textEmbedding:
34+
providers:
35+
yc:
36+
credential: yandex_apikey
37+
# url: https://llm.api.cloud.yandex.net/foundationModels/v1/textEmbedding
38+
```
39+
40+
### Option 2: Environment variable
41+
42+
If no matching credential is configured in `milvus.yaml`, Milvus can read the Yandex Cloud API key from the following environment variable:
43+
44+
<table>
45+
<tr>
46+
<th><p>Variable</p></th>
47+
<th><p>Required?</p></th>
48+
<th><p>Description</p></th>
49+
</tr>
50+
<tr>
51+
<td><p><code>MILVUS_YC_API_KEY</code></p></td>
52+
<td><p>Yes</p></td>
53+
<td><p>Yandex Cloud API key used by the Milvus service to call Yandex Cloud AI Studio.</p></td>
54+
</tr>
55+
</table>
56+
57+
## Use embedding function
58+
59+
Once credentials are configured, define a schema with an input text field and an output vector field, then add a Yandex Cloud embedding Function to the schema.
60+
61+
```python
62+
from pymilvus import MilvusClient, DataType, Function, FunctionType
63+
64+
client = MilvusClient(uri="http://localhost:19530")
65+
66+
schema = client.create_schema()
67+
schema.add_field("id", DataType.INT64, is_primary=True, auto_id=False)
68+
schema.add_field("document", DataType.VARCHAR, max_length=9000)
69+
schema.add_field("dense", DataType.FLOAT_VECTOR, dim=256)
70+
71+
text_embedding_function = Function(
72+
name="yandex_cloud_embedding",
73+
function_type=FunctionType.TEXTEMBEDDING,
74+
input_field_names=["document"],
75+
output_field_names=["dense"],
76+
params={
77+
"provider": "yc",
78+
"model_name": "emb://<folder_ID>/text-search-doc/latest",
79+
"credential": "yandex_apikey",
80+
"dim": "256",
81+
},
82+
)
83+
84+
schema.add_function(text_embedding_function)
85+
```
86+
87+
### Yandex Cloud-specific parameters
88+
89+
<table>
90+
<tr>
91+
<th><p>Parameter</p></th>
92+
<th><p>Required?</p></th>
93+
<th><p>Description</p></th>
94+
<th><p>Value / Example</p></th>
95+
</tr>
96+
<tr>
97+
<td><p><code>provider</code></p></td>
98+
<td><p>Yes</p></td>
99+
<td><p>The embedding model provider to use.</p></td>
100+
<td><p><code>"yc"</code></p></td>
101+
</tr>
102+
<tr>
103+
<td><p><code>model_name</code></p></td>
104+
<td><p>Yes</p></td>
105+
<td><p>The Yandex Cloud model URI to call.</p></td>
106+
<td><p><code>"emb://&lt;folder_ID&gt;/text-search-doc/latest"</code></p></td>
107+
</tr>
108+
<tr>
109+
<td><p><code>credential</code></p></td>
110+
<td><p>No</p></td>
111+
<td><p>The label of a credential defined in the top-level <code>credential:</code> section of <code>milvus.yaml</code>.</p></td>
112+
<td><p><code>"yandex_apikey"</code></p></td>
113+
</tr>
114+
<tr>
115+
<td><p><code>dim</code></p></td>
116+
<td><p>No</p></td>
117+
<td><p>The output vector dimension. If set, the value must match the dimension of the output vector field.</p></td>
118+
<td><p><code>"256"</code></p></td>
119+
</tr>
120+
</table>
121+
122+
## Next steps
123+
124+
After configuring the embedding function, refer to [Embedding Function Overview](embedding-function-overview.md) for guidance on creating indexes, inserting data, and running semantic search.
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
id: dashscope-ranker.md
3+
title: "DashScope Ranker"
4+
summary: "This topic describes how to configure and use DashScope reranking models, such as Qwen rerank models, in Milvus."
5+
beta: Milvus 2.6.x
6+
---
7+
8+
# DashScope Ranker
9+
10+
The DashScope Ranker lets Milvus call Alibaba Cloud DashScope reranking models to reorder search results by semantic relevance.
11+
12+
## Prerequisites
13+
14+
Before using the DashScope Ranker, ensure that you have:
15+
16+
- A Milvus collection with a `VARCHAR` field that contains the text to rerank.
17+
18+
- A valid DashScope API key.
19+
20+
- Access to a DashScope reranking model, such as `gte-rerank-v2`.
21+
22+
For available rerank models and regional endpoints, refer to the [Alibaba Cloud Model Studio Text Rerank API](https://www.alibabacloud.com/help/en/model-studio/text-rerank-api).
23+
24+
## Configure credentials
25+
26+
Milvus must know your DashScope API key before it can request reranking from DashScope. You can configure the API key in `milvus.yaml` or through an environment variable.
27+
28+
### Option 1: Configuration file
29+
30+
Store your API key in `milvus.yaml` and point the DashScope rerank provider to the credential label.
31+
32+
```yaml
33+
# milvus.yaml
34+
credential:
35+
dashscope_apikey:
36+
apikey: <YOUR_DASHSCOPE_API_KEY>
37+
38+
function:
39+
rerank:
40+
model:
41+
providers:
42+
ali:
43+
credential: dashscope_apikey
44+
# url: https://dashscope.aliyuncs.com/api/v1/services/rerank/text-rerank/text-rerank
45+
```
46+
47+
### Option 2: Environment variable
48+
49+
If no matching credential is configured in `milvus.yaml`, Milvus can read the DashScope API key from the following environment variable:
50+
51+
<table>
52+
<tr>
53+
<th><p>Variable</p></th>
54+
<th><p>Required?</p></th>
55+
<th><p>Description</p></th>
56+
</tr>
57+
<tr>
58+
<td><p><code>MILVUS_DASHSCOPE_API_KEY</code></p></td>
59+
<td><p>Yes</p></td>
60+
<td><p>DashScope API key used by the Milvus service to call Alibaba Cloud DashScope.</p></td>
61+
</tr>
62+
</table>
63+
64+
## Create a DashScope ranker function
65+
66+
To use the DashScope Ranker, create a Function object that specifies the DashScope reranking model and query text. Use `provider: "ali"` for DashScope reranking.
67+
68+
```python
69+
from pymilvus import Function, FunctionType
70+
71+
dashscope_ranker = Function(
72+
name="dashscope_semantic_ranker",
73+
input_field_names=["document"],
74+
function_type=FunctionType.RERANK,
75+
params={
76+
"reranker": "model",
77+
"provider": "ali",
78+
"model_name": "gte-rerank-v2",
79+
"queries": ["renewable energy developments"],
80+
"max_client_batch_size": 128,
81+
"credential": "dashscope_apikey",
82+
},
83+
)
84+
```
85+
86+
### DashScope ranker-specific parameters
87+
88+
<table>
89+
<tr>
90+
<th><p>Parameter</p></th>
91+
<th><p>Required?</p></th>
92+
<th><p>Description</p></th>
93+
<th><p>Value / Example</p></th>
94+
</tr>
95+
<tr>
96+
<td><p><code>reranker</code></p></td>
97+
<td><p>Yes</p></td>
98+
<td><p>Must be set to <code>"model"</code> to enable model reranking.</p></td>
99+
<td><p><code>"model"</code></p></td>
100+
</tr>
101+
<tr>
102+
<td><p><code>provider</code></p></td>
103+
<td><p>Yes</p></td>
104+
<td><p>The model service provider to use for reranking. For DashScope, use <code>"ali"</code>.</p></td>
105+
<td><p><code>"ali"</code></p></td>
106+
</tr>
107+
<tr>
108+
<td><p><code>model_name</code></p></td>
109+
<td><p>Yes</p></td>
110+
<td><p>The DashScope reranking model to use.</p></td>
111+
<td><p><code>"gte-rerank-v2"</code></p></td>
112+
</tr>
113+
<tr>
114+
<td><p><code>queries</code></p></td>
115+
<td><p>Yes</p></td>
116+
<td><p>List of query strings used by the rerank model to calculate relevance scores. The number of query strings must match the number of queries in the search request.</p></td>
117+
<td><p><code>["renewable energy developments"]</code></p></td>
118+
</tr>
119+
<tr>
120+
<td><p><code>max_client_batch_size</code></p></td>
121+
<td><p>No</p></td>
122+
<td><p>Maximum number of documents to send to the model service per request.</p></td>
123+
<td><p><code>128</code> (default)</p></td>
124+
</tr>
125+
<tr>
126+
<td><p><code>credential</code></p></td>
127+
<td><p>No</p></td>
128+
<td><p>The label of a credential defined in the top-level <code>credential:</code> section of <code>milvus.yaml</code>.</p></td>
129+
<td><p><code>"dashscope_apikey"</code></p></td>
130+
</tr>
131+
</table>
132+
133+
<div class="alert note">
134+
135+
For general parameters shared across all model rankers, such as `provider` and `queries`, refer to [Create a model ranker](model-ranker-overview.md#Create-a-model-ranker).
136+
137+
</div>
138+
139+
## Apply to standard vector search
140+
141+
To apply DashScope Ranker to a standard vector search, pass the ranker Function to `search()`.
142+
143+
```python
144+
results = client.search(
145+
collection_name="your_collection",
146+
data=[your_query_vector],
147+
anns_field="dense_vector",
148+
limit=5,
149+
output_fields=["document"],
150+
ranker=dashscope_ranker,
151+
consistency_level="Bounded",
152+
)
153+
```

v3.0.x/site/en/userGuide/embeddings-reranking/reranking/model-ranker-overview.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ Milvus supports the following model service providers for reranking, each with d
8484
<td><ul><li><p>Advanced document chunking with configurable overlap</p></li><li><p>Chunk-based scoring (highest-scoring chunk represents document)</p></li><li><p>Support for diverse reranking models</p></li><li><p>Cost-effective with standard and pro model variants</p></li></ul></td>
8585
<td><p>Technical documentation search system processing lengthy manuals and papers that need intelligent segmentation and overlap control</p></td>
8686
</tr>
87+
<tr>
88+
<td><p>DashScope</p></td>
89+
<td><p>Applications using Alibaba Cloud or Qwen reranking models</p></td>
90+
<td><ul><li><p>Managed DashScope reranking API</p></li><li><p>Supports reranking models such as <code>gte-rerank-v2</code></p></li><li><p>API-key based authentication</p></li></ul></td>
91+
<td><p>RAG applications that want to rerank candidates with Alibaba Cloud-hosted reranking models</p></td>
92+
</tr>
8793
</table>
8894

8995
For detailed information about implementation of each model service, refer to the dedicated documentation:
@@ -98,6 +104,8 @@ For detailed information about implementation of each model service, refer to th
98104

99105
- [SiliconFlow Ranker](siliconflow-ranker.md)
100106

107+
- [DashScope Ranker](dashscope-ranker.md)
108+
101109
## Implementation
102110

103111
Before implementing Model Ranker, ensure you have:
@@ -294,4 +302,4 @@ SearchResp searchResp = client.search(searchReq);
294302

295303
```bash
296304
# restful
297-
```
305+
```

0 commit comments

Comments
 (0)