Elffuss BraidHub

kikocis/continue public

e0b45db6ff5d · 11.7 KiBRawPermalink
1---
2title: "How to Set Up @Docs Context Provider in Continue"
3description: Learn how to access and search your project's documentation directly within Continue
4keywords:
5 [
6 documentation,
7 indexing,
8 context provider,
9 embeddings,
10 docs,
11 embedder,
12 embeddings provider,
13 documentation,
14 ]
15toc_max_heading_level: 5
16sidebarTitle: "@Docs"
17---
18
19The `@Docs` context provider allows you to efficiently reference documentation directly within Continue.
20
21## How to Enable the @Docs Context Provider
22
23To enable the `@Docs` context provider, add it to the list of context providers in your `config.json` file.
24
25<Tabs>
26 <Tab title="YAML">
27 ```yaml title="config.yaml"
28 context:
29 - provider: docs
30 ```
31 </Tab>
32 <Tab title="JSON">
33 ```json title="config.json"
34 {
35 "contextProviders": [
36 {
37 "name": "docs"
38 }
39 ]
40 }
41 ```
42 </Tab>
43</Tabs>
44
45## How the @Docs Context Provider Works
46
47The `@Docs` context provider works by
48
491. Crawling specified documentation sites
502. Generating embeddings for the chunked content
513. Storing the embeddings locally on your machine
524. Embedding chat input to include similar documentation chunks as context
53
54## How to Index Your Own Documentation
55
56### Using Hub `docs` Blocks
57
58@Docs uses [`docs` blocks](../../hub/blocks/block-types#docs) in Assistants from the hub. Visit the hub to [explore `docs` blocks](https://hub.continue.dev/explore/docs) or [create your own](https://hub.continue.dev/new?type=block&blockType=docs).
59
60### How to Add Documentation Through the @Docs Context Provider
61
62To add a single documentation site, we recommend using the **Add Documentation** Form within the GUI. This can be accessed
63
64- from the `@Docs` context provider - type `@Docs` in the chat, hit `Enter`, and search for `Add Docs`
65- from the `More` page (three dots icon) in the `@docs indexes` section
66 the `@Docs` context provider.
67
68In the **Add Documentation** Form, enter a `Title` and `Start URL` for the site.
69
70- `Title`: The name of the documentation site, used for identification in the UI.
71- `Start URL`: The URL where the indexing process should begin.
72
73Indexing will begin upon submission. Progress can be viewed in the form or later in the `@docs indexes` section of the `More` page.
74
75Documentation sources may be suggested based on package files in your repo. This currently works for Python `requirements.txt` files and Node.js (Javascript/Typescript) `package.json` files.
76
77- Packages with a valid documentation URL (with a `+` icon) can be clicked to immediately kick off indexing
78- Packages with partial information (with a pen icon) can be clicked to fill the form with the available information
79- Note that you can hover over the information icon to see where the package suggestion was found.
80
81![Add documentation form](/images/docs-form.png)
82
83### How to Add Documentation in Configuration Files
84
85For bulk documentation site adds or edits, we recommend editing your global configuration file directly. Documentation sites are stored in an array within `docs` in your global configuration, as follows:
86
87<Tabs>
88 <Tab title="YAML">
89 ```yaml title="config.yaml"
90 docs:
91 - title: Nest.js
92 startUrl: https://docs.nestjs.com/
93 faviconUrl: https://docs.nestjs.com/favicon.ico
94 ```
95 </Tab>
96 <Tab title="JSON">
97 ```json title="config.json"
98 {
99 "docs": [
100 {
101 "title": "Nest.js",
102 "startUrl": "https://docs.nestjs.com/",
103 "faviconUrl": "https://docs.nestjs.com/favicon.ico"
104 }
105 ]
106 }
107 ```
108 </Tab>
109</Tabs>
110
111See [the config reference](/reference) for all documentation site configuration options.
112
113Indexing will re-sync upon saving the configuration file.
114
115## How to Configure @Docs Advanced Settings
116
117### How to Use Your Custom Embeddings Provider
118
119If you have set up an [embeddings provider](../model-roles/embeddings.mdx), @docs will use your embeddings provider. Switching embeddings providers will trigger a re-index of all documentation sites in your configuration.
120
121### How to Configure Reranking for Better Results
122
123As with [@Codebase context provider configuration](./codebase#configuration), you can adjust the reranking behavior of the `@Docs` context provider with the `nRetrieve`, `nFinal`, and `useReranking`.
124
125<Tabs>
126 <Tab title="YAML">
127 ```yaml title="config.yaml"
128 context:
129 - provider: docs
130 params:
131 nRetrieve: 25 # The number of docs to retrieve from the embeddings query
132 nFinal: 5 # The number of docs chunks to return IF reranking
133 useReranking: true # use reranking if a reranker is configured (defaults to true)
134 ```
135 </Tab>
136 <Tab title="JSON">
137 ```json title="config.json"
138 {
139 "contextProviders": [
140 {
141 "name": "docs",
142 "params": {
143 "nRetrieve": 25, // The number of docs to retrieve from the embeddings query
144 "nFinal": 5, // The number of docs chunks to return IF reranking
145 "useReranking": true // use reranking if a reranker is configured (defaults to true)
146 }
147 }
148 ]
149 }
150 ```
151 </Tab>
152</Tabs>
153
154### How to Set Up GitHub Token for GitHub Documentation
155
156The GitHub API rate limits public requests to 60 per hour. If you want to reliably index GitHub repos, you can add a github token to your config file:
157
158<Tabs>
159 <Tab title="YAML">
160 ```yaml title="config.yaml"
161 context:
162 - provider: docs
163 params:
164 githubToken: <GITHUB_TOKEN>
165 ```
166 </Tab>
167 <Tab title="JSON">
168 ```json title="config.json"
169 {
170 "contextProviders": [
171 {
172 "name": "docs",
173 "params": {
174 "githubToken": "github_..."
175 }
176 }
177 ]
178 }
179 ```
180 </Tab>
181</Tabs>
182
183### How to Enable Local Crawling for Private Documentation
184
185By default, Continue crawls documentation sites using a specialized crawling service that provides the best experience for most users and documentation sites.
186
187If your documentation is private, you can skip the default crawler and use a local crawler instead by setting `useLocalCrawling` to `true`.
188
189<Tabs>
190 <Tab title="YAML">
191 ```yaml title="config.yaml"
192 docs:
193 - title: My Private Docs
194 startUrl: http://10.2.1.2/docs
195 faviconUrl: http://10.2.1.2/docs/assets/favicon.ico,
196 useLocalCrawling: true
197 ```
198 </Tab>
199 <Tab title="JSON">
200 ```json title="config.json"
201 {
202 "docs": [
203 {
204 "title": "My Private Docs",
205 "startUrl": "http://10.2.1.2/docs",
206 "faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico",
207 "useLocalCrawling": true
208 }
209 ]
210 }
211 ```
212 </Tab>
213</Tabs>
214
215<Info>
216 The default local crawler is a lightweight tool that cannot render sites that
217 are dynamically generated using JavaScript. If your sites need to be rendered,
218 you can enable the experimental `Use Chromium for Docs Crawling` feature from
219 your [User Settings Page](../settings) This will download and install Chromium
220 to `~/.continue/.utils`, and use it as the local crawler. **Note:** Chromium
221 crawling support is being deprecated and may be removed in future versions.
222</Info>
223
224Further notes:
225
226- If the site is only locally accessible, the default crawler will fail anyways and fall back to the local crawler. `useLocalCrawling` is especially useful if the URL itself is confidential.
227- For GitHub Repos this has no effect because only the GitHub Crawler will be used, and if the repo is private it can only be accessed with a priveleged GitHub token anyways.
228
229## How to Manage Your Documentation Indexes
230
231You can view indexing statuses and manage your documentation sites from the `@docs indexes` section of the `More` page (three dots)
232
233- Continue does not automatically re-index your docs. Use `Click to re-index` to trigger a reindex for a specific source
234- While a site is indexing, click `Cancel indexing` to cancel the process
235- Failed indexing attempts will show an error status bar and icon
236- Delete a documentation site from your configuration using the trash icon
237
238![More Page @docs indexes section](/images/docs-indexes.png)
239
240You can also view the overall status of currently indexing docs from a hideable progress bar at the bottom of the chat page
241
242![Documentation indexing peek](/images/docs-indexing-peek.png)
243
244You can also use the following IDE command to force a re-index of all docs: `Continue: Docs Force Re-Index`.
245
246## Configuration Examples for Different Setups
247
248### How to Set Up @Docs in VS Code (Minimal Configuration)
249
250The following configuration example works out of the box for VS Code. This uses the built-in embeddings provider with no reranking.
251
252<Tabs>
253 <Tab title="YAML">
254 ```yaml title="config.yaml"
255 context:
256 - provider: docs
257
258 docs:
259 - title: Nest.js
260 startUrl: https://docs.nestjs.com/
261 ```
262 </Tab>
263 <Tab title="JSON">
264 ```json title="config.json"
265 {
266 "contextProviders": [
267 {
268 "name": "docs",
269 }
270 ],
271 "docs": [
272 {
273 "title": "Nest.js",
274 "startUrl": "https://docs.nestjs.com/",
275 },
276 ]
277 }
278 ```
279 </Tab>
280</Tabs>
281
282### How to Set Up @Docs in JetBrains IDEs (Minimal Configuration)
283
284Here is the equivalent minimal example for Jetbrains, which requires setting up an [embeddings provider](../model-roles/embeddings.mdx).
285
286<Tabs>
287 <Tab title="YAML">
288 ```yaml title="config.yaml"
289 models:
290 - name: LMStudio embedder
291 provider: lmstudio
292 model: nomic-ai/nomic-embed-text-v1.5-GGUF
293 roles:
294 - embed
295 context:
296 - provider: docs
297 docs:
298 - title: Nest.js
299 startUrl: https://docs.nestjs.com/
300 ```
301 </Tab>
302 <Tab title="JSON">
303 ```json title="config.json"
304 {
305 "contextProviders": [
306 {
307 "name": "docs",
308 }
309 ],
310 "docs": [
311 {
312 "title": "Nest.js",
313 "startUrl": "https://docs.nestjs.com/",
314 },
315 ],
316 "embeddingsProvider": {
317 "provider": "lmstudio",
318 "model": "nomic-ai/nomic-embed-text-v1.5-GGUF"
319 }
320 }
321 ```
322 </Tab>
323</Tabs>
324
325### How to Set Up @Docs with Advanced Features (VS Code or JetBrains)
326
327The following configuration example includes:
328
329- Examples of both public and private documentation sources
330- A custom embeddings provider
331- A reranker model available, with reranking parameters customized
332- A GitHub token to enable GitHub crawling
333
334<Tabs>
335 <Tab title="YAML">
336 ```yaml title="config.yaml"
337 models:
338 - name: LMStudio Nomic Text
339 provider: lmstudio
340 model: nomic-ai/nomic-embed-text-v1.5-GGUF
341 roles:
342 - embed
343 - name: Voyage Rerank-2
344 provider: voyage
345 apiKey: <VOYAGE_API_KEY>
346 model: rerank-2
347 roles:
348 - rerank
349 context:
350 - provider: docs
351 params:
352 githubToken: <GITHUB_TOKEN>
353 nRetrieve: 25
354 nFinal: 5
355 useReranking: true
356 docs:
357 - title: Nest.js
358 startUrl: https://docs.nestjs.com/
359 - title: My Private Docs
360 startUrl: http://10.2.1.2/docs
361 faviconUrl: http://10.2.1.2/docs/assets/favicon.ico
362 useLocalCrawling: true
363 ```
364 </Tab>
365 <Tab title="JSON">
366 ```json title="config.json"
367 {
368 "contextProviders": [
369 {
370 "name": "docs",
371 "params": {
372 "githubToken": "github_...",
373 "nRetrieve": 25,
374 "nFinal": 5,
375 "useReranking": true
376 }
377 }
378 ],
379 "docs": [
380 {
381 "title": "Nest.js",
382 "startUrl": "https://docs.nestjs.com/"
383 },
384 {
385 "title": "My Private Docs",
386 "startUrl": "http://10.2.1.2/docs",
387 "faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico",
388 "maxDepth": 4,
389 "useLocalCrawling": true
390 }
391 ],
392 "reranker": {
393 "name": "voyage",
394 "params": {
395 "model": "rerank-2",
396 "apiKey": "<YOUR_VOYAGE_API_KEY>"
397 }
398 },
399 "embeddingsProvider": {
400 "provider": "lmstudio",
401 "model": "nomic-ai/nomic-embed-text-v1.5-GGUF"
402 }
403 }
404 ```
405 </Tab>
406</Tabs>
407
408This setup could also involve enabling Chromium as a backup for local documentation through the [User Settings Page](../settings).