docs/customize/model-roles/embeddings.mdx
An "embeddings model" is trained to convert a piece of text into a vector, which can later be rapidly compared to other vectors to determine similarity between the pieces of text. Embeddings models are typically much smaller than LLMs, and will be extremely fast and cheap in comparison.
In Continue, embeddings are generated during indexing and then used by codebase awareness to perform similarity search over your codebase.
You can add embed to a model's roles to specify that it can be used to embed.
If you have the ability to use any model, we recommend voyage-code-3, which is listed below along with the rest of the options for embeddings models.
If you want to generate embeddings locally, we recommend using nomic-embed-text with Ollama.
After obtaining an API key from here, you can configure like this:
<Tabs> <Tab title="Hub"> [Voyage Code 3 Embedder Block](https://continue.dev/voyageai/voyage-code-3) </Tab> <Tab title="YAML"> ```yaml title="config.yaml" name: My Config version: 0.0.1 schema: v1models:
- name: Voyage Code 3
provider: voyage
model: voyage-code-3
apiKey: <YOUR_VOYAGE_API_KEY>
roles:
- embed
```
</Tab>
<Tab title="JSON">
```json title="config.json"
{
"embeddingsProvider": {
"provider": "voyage",
"model": "voyage-code-3",
"apiKey": "<YOUR_VOYAGE_API_KEY>"
}
}
```
</Tab>
See here for instructions on how to use Ollama for embeddings.
Transformers.js is a JavaScript port of the popular Transformers library. It allows embeddings to be calculated entirely locally. The model used is all-MiniLM-L6-v2, which is shipped alongside the Continue extension.
models:
- name: default-transformers
provider: transformers.js
roles:
- embed
```
</Tab>
<Tab title="JSON">
```json title="config.json"
{
"embeddingsProvider": {
"provider": "transformers.js"
}
}
```
</Tab>
Hugging Face Text Embeddings Inference enables you to host your own embeddings endpoint. You can configure embeddings to use your endpoint as follows:
<Tabs> {/* <Tab title="Hub"> [HuggingFace Text Embedder Block](https://continue.dev/) </Tab> */} <Tab title="YAML"> ```yaml title="config.yaml" name: My Config version: 0.0.1 schema: v1models: - name: Huggingface TEI Embedder provider: huggingface-tei apiBase: http://localhost:8080 apiKey: <YOUR_TEI_API_KEY> roles: [embed]
</Tab>
<Tab title="JSON">
```json title="config.json"
{
"embeddingsProvider": {
"provider": "huggingface-tei",
"apiBase": "http://localhost:8080",
"apiKey": "<YOUR_TEI_API_KEY>"
}
}
See here for instructions on how to use OpenAI for embeddings.
See here for instructions on how to use Cohere for embeddings.
See here for instructions on how to use Gemini for embeddings.
See here for instructions on how to use Vertex for embeddings.
See here for instructions on how to use Mistral for embeddings.
See here for instructions on how to use NVIDIA for embeddings.
See here for instructions on how to use Bedrock for embeddings.
See here for instructions on how to use WatsonX for embeddings.
See here for instructions on how to use LMStudio for embeddings.