Elffuss BraidHub

kikocis/continue public

627d7d0d1f85 · 4.7 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](../context/codebase.mdx) 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
22If 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.
23
24If you want to generate embeddings locally, we recommend using `nomic-embed-text` with [Ollama](../model-providers/top-level/ollama#embeddings-model).
25
26### Voyage AI
27
28After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this:
29
30<Tabs>
31 <Tab title="Hub">
32 [Voyage Code 3 Embedder Block](https://hub.continue.dev/voyageai/voyage-code-3)
33 </Tab>
34 <Tab title="YAML">
35 ```yaml title="config.yaml"
36 models:
37 - name: Voyage Code 3
38 provider: voyage
39 model: voyage-code-3
40 apiKey: <YOUR_VOYAGE_API_KEY>
41 roles:
42 - embed
43 ```
44 </Tab>
45 <Tab title="JSON">
46 ```json title="config.json"
47 {
48 "embeddingsProvider": {
49 "provider": "voyage",
50 "model": "voyage-code-3",
51 "apiKey": "<YOUR_VOYAGE_API_KEY>"
52 }
53 }
54 ```
55 </Tab>
56</Tabs>
57
58### Ollama
59
60See [here](../model-providers/top-level/ollama#embeddings-model) for instructions on how to use Ollama for embeddings.
61
62### Transformers.js (currently VS Code only)
63
64[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.
65
66<Tabs>
67 <Tab title="YAML">
68 ```yaml title="config.yaml"
69 models:
70 - name: default-transformers
71 provider: transformers.js
72 roles:
73 - embed
74 ```
75 </Tab>
76 <Tab title="JSON">
77 ```json title="config.json"
78 {
79 "embeddingsProvider": {
80 "provider": "transformers.js"
81 }
82 }
83 ```
84 </Tab>
85</Tabs>
86
87### Text Embeddings Inference
88
89[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:
90
91<Tabs>
92 {/* HUB_TODO nonexistent block */}
93 {/* <Tab title="Hub">
94 [HuggingFace Text Embedder Block](https://hub.continue.dev/)
95 </Tab> */}
96 <Tab title="YAML">
97 ```yaml title="config.yaml"
98 models:
99 - name: Huggingface TEI Embedder
100 provider: huggingface-tei
101 apiBase: http://localhost:8080
102 apiKey: <YOUR_TEI_API_KEY>
103 roles: [embed]
104 ```
105 </Tab>
106 <Tab title="JSON">
107 ```json title="config.json"
108 {
109 "embeddingsProvider": {
110 "provider": "huggingface-tei",
111 "apiBase": "http://localhost:8080",
112 "apiKey": "<YOUR_TEI_API_KEY>"
113 }
114 }
115 ```
116 </Tab>
117</Tabs>
118
119### OpenAI
120
121See [here](../model-providers/top-level/openai#embeddings-model) for instructions on how to use OpenAI for embeddings.
122
123### Cohere
124
125See [here](../model-providers/more/cohere#embeddings-model) for instructions on how to use Cohere for embeddings.
126
127### Gemini
128
129See [here](../model-providers/top-level/gemini#embeddings-model) for instructions on how to use Gemini for embeddings.
130
131### Vertex
132
133See [here](../model-providers/top-level/vertexai#embeddings-model) for instructions on how to use Vertex for embeddings.
134
135### Mistral
136
137See [here](../model-providers/top-level/mistral#embeddings-model) for instructions on how to use Mistral for embeddings.
138
139### NVIDIA
140
141See [here](../model-providers/more/nvidia#embeddings-model) for instructions on how to use NVIDIA for embeddings.
142
143### Bedrock
144
145See [here](../model-providers/top-level/bedrock#embeddings-model) for instructions on how to use Bedrock for embeddings.
146
147### WatsonX
148
149See [here](../model-providers/more/watsonx#embeddings-model) for instructions on how to use WatsonX for embeddings.
150
151### LMStudio
152
153See [here](../model-providers/more/lmstudio#embeddings-model) for instructions on how to use LMStudio for embeddings.