Elffuss BraidHub

kikocis/continue public

main · 5.0 KiBRawPermalink
1---
2title: Embed Role
3description: Embed model role
4keywords: [embedding, model, role, embeddings]
5sidebar_position: 5
6---
7
8An "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.
9
10In Continue, embeddings are generated during indexing and then used by [codebase awareness](/guides/codebase-documentation-awareness) to perform similarity search over your codebase.
11
12You can add `embed` to a model's `roles` to specify that it can be used to embed.
13
14<Info>
15 [Built-in model (VS Code only)] `transformers.js` is used as a built-in
16 embeddings model in VS Code. In JetBrains, there currently is no built-in
17 embedder.
18</Info>
19
20## Recommended embedding models
21
22<Info>
23 See our [comprehensive model recommendations](/customization/models#recommended-models) for the best embedding models comparison.
24</Info>
25
26If 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.
27
28If you want to generate embeddings locally, we recommend using `nomic-embed-text` with [Ollama](../model-providers/top-level/ollama#embeddings-model).
29
30### Voyage AI
31
32After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this:
33
34<Tabs>
35 <Tab title="Hub">
36 [Voyage Code 3 Embedder Block](https://hub.continue.dev/voyageai/voyage-code-3)
37 </Tab>
38 <Tab title="YAML">
39 ```yaml title="config.yaml"
40 models:
41 - name: Voyage Code 3
42 provider: voyage
43 model: voyage-code-3
44 apiKey: <YOUR_VOYAGE_API_KEY>
45 roles:
46 - embed
47 ```
48 </Tab>
49 <Tab title="JSON">
50 ```json title="config.json"
51 {
52 "embeddingsProvider": {
53 "provider": "voyage",
54 "model": "voyage-code-3",
55 "apiKey": "<YOUR_VOYAGE_API_KEY>"
56 }
57 }
58 ```
59 </Tab>
60</Tabs>
61
62### Ollama
63
64See [here](../model-providers/top-level/ollama#embeddings-model) for instructions on how to use Ollama for embeddings.
65
66### Transformers.js (currently VS Code only)
67
68[Transformers.js](https://huggingface.co/docs/transformers.js/index) is a JavaScript port of the popular [Transformers](https://huggingface.co/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.
69
70<Tabs>
71 <Tab title="YAML">
72 ```yaml title="config.yaml"
73 models:
74 - name: default-transformers
75 provider: transformers.js
76 roles:
77 - embed
78 ```
79 </Tab>
80 <Tab title="JSON">
81 ```json title="config.json"
82 {
83 "embeddingsProvider": {
84 "provider": "transformers.js"
85 }
86 }
87 ```
88 </Tab>
89</Tabs>
90
91### Text Embeddings Inference
92
93[Hugging Face Text Embeddings Inference](https://huggingface.co/docs/text-embeddings-inference/en/index) enables you to host your own embeddings endpoint. You can configure embeddings to use your endpoint as follows:
94
95<Tabs>
96 {/* HUB_TODO nonexistent block */}
97 {/* <Tab title="Hub">
98 [HuggingFace Text Embedder Block](https://hub.continue.dev/)
99 </Tab> */}
100 <Tab title="YAML">
101 ```yaml title="config.yaml"
102 models:
103 - name: Huggingface TEI Embedder
104 provider: huggingface-tei
105 apiBase: http://localhost:8080
106 apiKey: <YOUR_TEI_API_KEY>
107 roles: [embed]
108 ```
109 </Tab>
110 <Tab title="JSON">
111 ```json title="config.json"
112 {
113 "embeddingsProvider": {
114 "provider": "huggingface-tei",
115 "apiBase": "http://localhost:8080",
116 "apiKey": "<YOUR_TEI_API_KEY>"
117 }
118 }
119 ```
120 </Tab>
121</Tabs>
122
123### OpenAI
124
125See [here](../model-providers/top-level/openai#how-to-configure-openai-embeddings-models) for instructions on how to use OpenAI for embeddings.
126
127### Cohere
128
129See [here](../model-providers/more/cohere#embeddings-model) for instructions on how to use Cohere for embeddings.
130
131### Gemini
132
133See [here](../model-providers/top-level/gemini#how-to-configure-gemini-embeddings-models) for instructions on how to use Gemini for embeddings.
134
135### Vertex
136
137See [here](../model-providers/top-level/vertexai#how-to-configure-vertex-ai-embeddings-models) for instructions on how to use Vertex for embeddings.
138
139### Mistral
140
141See [here](../model-providers/more/mistral#how-to-configure-mistral-embeddings-models) for instructions on how to use Mistral for embeddings.
142
143### NVIDIA
144
145See [here](../model-providers/more/nvidia#embeddings-model) for instructions on how to use NVIDIA for embeddings.
146
147### Bedrock
148
149See [here](../model-providers/top-level/bedrock#how-to-configure-amazon-bedrock-embeddings-models) for instructions on how to use Bedrock for embeddings.
150
151### WatsonX
152
153See [here](../model-providers/more/watsonx#embeddings-model) for instructions on how to use WatsonX for embeddings.
154
155### LMStudio
156
157See [here](../model-providers/top-level/lmstudio#embeddings-model) for instructions on how to use LMStudio for embeddings.