Elffuss BraidHub

kikocis/continue public

8a9d2f5a43d9 · 11.3 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](/images/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 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](../settings) This will download and install Chromium to `~/.continue/.utils`, and use it as the local crawler.
216
217 **Note:** Chromium crawling support is being deprecated and may be removed in future versions.
218</Info>
219
220Further notes:
221
222- 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.
223- 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.
224
225## Managing your docs indexes
226
227You can view indexing statuses and manage your documentation sites from the `@docs indexes` section of the `More` page (three dots)
228
229- Continue does not automatically re-index your docs. Use `Click to re-index` to trigger a reindex for a specific source
230- While a site is indexing, click `Cancel indexing` to cancel the process
231- Failed indexing attempts will show an error status bar and icon
232- Delete a documentation site from your configuration using the trash icon
233
234![More Page @docs indexes section](/images/docs-indexes.png)
235
236You can also view the overall status of currently indexing docs from a hideable progress bar at the bottom of the chat page
237
238![Documentation indexing peek](/images/docs-indexing-peek.png)
239
240You can also use the following IDE command to force a re-index of all docs: `Continue: Docs Force Re-Index`.
241
242## Examples
243
244### VS Code minimal setup
245
246The following configuration example works out of the box for VS Code. This uses the built-in embeddings provider with no reranking.
247
248<Tabs>
249 <Tab title="YAML">
250 ```yaml title="config.yaml"
251 context:
252 - provider: docs
253
254 docs:
255 - title: Nest.js
256 startUrl: https://docs.nestjs.com/
257 ```
258 </Tab>
259 <Tab title="JSON">
260 ```json title="config.json"
261 {
262 "contextProviders": [
263 {
264 "name": "docs",
265 }
266 ],
267 "docs": [
268 {
269 "title": "Nest.js",
270 "startUrl": "https://docs.nestjs.com/",
271 },
272 ]
273 }
274 ```
275 </Tab>
276</Tabs>
277
278### Jetbrains minimal setup
279
280Here is the equivalent minimal example for Jetbrains, which requires setting up an [embeddings provider](../model-roles/embeddings.mdx).
281
282<Tabs>
283 <Tab title="YAML">
284 ```yaml title="config.yaml"
285 models:
286 - name: LMStudio embedder
287 provider: lmstudio
288 model: nomic-ai/nomic-embed-text-v1.5-GGUF
289 roles:
290 - embed
291 context:
292 - provider: docs
293 docs:
294 - title: Nest.js
295 startUrl: https://docs.nestjs.com/
296 ```
297 </Tab>
298 <Tab title="JSON">
299 ```json title="config.json"
300 {
301 "contextProviders": [
302 {
303 "name": "docs",
304 }
305 ],
306 "docs": [
307 {
308 "title": "Nest.js",
309 "startUrl": "https://docs.nestjs.com/",
310 },
311 ],
312 "embeddingsProvider": {
313 "provider": "lmstudio",
314 "model": "nomic-ai/nomic-embed-text-v1.5-GGUF"
315 }
316 }
317 ```
318 </Tab>
319</Tabs>
320
321### Full-power setup (VS Code or Jetbrains)
322
323The following configuration example includes:
324
325- Examples of both public and private documentation sources
326- A custom embeddings provider
327- A reranker model available, with reranking parameters customized
328- A GitHub token to enable GitHub crawling
329
330<Tabs>
331 <Tab title="YAML">
332 ```yaml title="config.yaml"
333 models:
334 - name: LMStudio Nomic Text
335 provider: lmstudio
336 model: nomic-ai/nomic-embed-text-v1.5-GGUF
337 roles:
338 - embed
339 - name: Voyage Rerank-2
340 provider: voyage
341 apiKey: <VOYAGE_API_KEY>
342 model: rerank-2
343 roles:
344 - rerank
345 context:
346 - provider: docs
347 params:
348 githubToken: <GITHUB_TOKEN>
349 nRetrieve: 25
350 nFinal: 5
351 useReranking: true
352 docs:
353 - title: Nest.js
354 startUrl: https://docs.nestjs.com/
355 - title: My Private Docs
356 startUrl: http://10.2.1.2/docs
357 faviconUrl: http://10.2.1.2/docs/assets/favicon.ico
358 useLocalCrawling: true
359 ```
360 </Tab>
361 <Tab title="JSON">
362 ```json title="config.json"
363 {
364 "contextProviders": [
365 {
366 "name": "docs",
367 "params": {
368 "githubToken": "github_...",
369 "nRetrieve": 25,
370 "nFinal": 5,
371 "useReranking": true
372 }
373 }
374 ],
375 "docs": [
376 {
377 "title": "Nest.js",
378 "startUrl": "https://docs.nestjs.com/"
379 },
380 {
381 "title": "My Private Docs",
382 "startUrl": "http://10.2.1.2/docs",
383 "faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico",
384 "maxDepth": 4,
385 "useLocalCrawling": true
386 }
387 ],
388 "reranker": {
389 "name": "voyage",
390 "params": {
391 "model": "rerank-2",
392 "apiKey": "<YOUR_VOYAGE_API_KEY>"
393 }
394 },
395 "embeddingsProvider": {
396 "provider": "lmstudio",
397 "model": "nomic-ai/nomic-embed-text-v1.5-GGUF"
398 }
399 }
400 ```
401 </Tab>
402</Tabs>
403
404This setup could also involve enabling Chromium as a backup for local documentation through the [User Settings Page](../settings).