This topic explains how to use the DashScopeEmbedding service to build a vector index in LlamaIndex.
Prerequisites
- You have activated Model Studio and obtained an API key. For more information, see Get an API key.
- You have imported your API key. For more information, see Set your API key as an environment variable (deprecated; use Configure your API key instead).
- Install the LlamaIndex core package, DashScopeEmbedding, and related dependencies.
Supported models
MTEB and CMTEB are standard benchmarks for embedding models. Higher scores indicate better model performance.
Model | MTEB | MTEB (Retrieval task) | CMTEB | CMTEB (Retrieval task) |
|---|---|---|---|---|
text-embedding-v1 | 58.30 | 45.47 | 59.84 | 56.59 |
text-embedding-v2 | 60.13 | 49.49 | 62.17 | 62.78 |
text-embedding-v3 | 63.39 | 55.41 | 68.92 | 73.23 |
Update global settings (optional)
Model usage example
Build a vector index for documents
Sample file used in this example: Alibaba Cloud Model Studio Product Overview (fictional).zip
During vector index creation, each source file is split into multiple segments. Each segment is then converted into a vector.