Elffuss BraidHub

kikocis/continue public

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