Elffuss BraidHub

kikocis/continue public

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