From c92159cadf0f0766ceffdeb0e482e518481c4623 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 10 Feb 2025 15:56:38 -0800 Subject: [PATCH] docs-yaml-examples --- docs/docs/chat/context-selection.md | 2 +- docs/docs/chat/how-it-works.md | 2 +- docs/docs/chat/how-to-customize.md | 2 +- docs/docs/customize/context-providers.mdx | 2 +- .../deep-dives/{docs.md => docs.mdx} | 374 ++++++++++++------ 5 files changed, 256 insertions(+), 126 deletions(-) rename docs/docs/customize/deep-dives/{docs.md => docs.mdx} (53%) diff --git a/docs/docs/chat/context-selection.md b/docs/docs/chat/context-selection.md index aa1d052fe..65b76c72a 100644 --- a/docs/docs/chat/context-selection.md +++ b/docs/docs/chat/context-selection.md @@ -31,7 +31,7 @@ You can automatically include relevant files from your codebase as context by ty ## Documentation site -You can include a documentation site as context by typing [`@Docs`](../customize/context-providers.mdx#docs) and selecting the documentation site. You can learn about how @Docs works [here](../customize/deep-dives/docs.md). +You can include a documentation site as context by typing [`@Docs`](../customize/context-providers.mdx#docs) and selecting the documentation site. You can learn about how @Docs works [here](../customize/deep-dives/docs.mdx). ## Terminal contents diff --git a/docs/docs/chat/how-it-works.md b/docs/docs/chat/how-it-works.md index e799e0a07..92b6e75f9 100644 --- a/docs/docs/chat/how-it-works.md +++ b/docs/docs/chat/how-it-works.md @@ -11,4 +11,4 @@ The model response is then streamed directly back to the sidebar. Each code sect If you would like to view the exact prompt that is sent to the model during Chat, you can [view this in the prompt logs](troubleshooting.mdx#llm-prompt-logs). -You can learn more about how `@Codebase` works [here](../customize/deep-dives/codebase.mdx) and `@Docs` [here](../customize/deep-dives/docs.md). +You can learn more about how `@Codebase` works [here](../customize/deep-dives/codebase.mdx) and `@Docs` [here](../customize/deep-dives/docs.mdx). diff --git a/docs/docs/chat/how-to-customize.md b/docs/docs/chat/how-to-customize.md index b375d6b1d..3fcb7376f 100644 --- a/docs/docs/chat/how-to-customize.md +++ b/docs/docs/chat/how-to-customize.md @@ -10,6 +10,6 @@ There are a number of different ways to customize Chat - You can add a [`.continuerules`](../customize/deep-dives/rules.md) file to the root of your project to customize the system prompt - You can configure [`@Codebase`](../customize/deep-dives/codebase.mdx) - You can create your own [custom code RAG](../customize/tutorials/custom-code-rag.mdx) -- You can configure [`@Docs`](../customize/deep-dives/docs.md) +- You can configure [`@Docs`](../customize/deep-dives/docs.mdx) - You can [build your own context provider](../customize/tutorials/build-your-own-context-provider.md) - You can configure and create custom [tools](../customize/tools.mdx) diff --git a/docs/docs/customize/context-providers.mdx b/docs/docs/customize/context-providers.mdx index c22082e47..ccf09a3e2 100644 --- a/docs/docs/customize/context-providers.mdx +++ b/docs/docs/customize/context-providers.mdx @@ -151,7 +151,7 @@ Reference the contents from any documentation site. Note that this will only enable the `@Docs` context provider. -To use it, you need to add a documentation site to your config file. See the [docs](../customize/deep-dives/docs.md) page for more information. +To use it, you need to add a documentation site to your config file. See the [docs](../customize/deep-dives/docs.mdx) page for more information. ### `@Open` diff --git a/docs/docs/customize/deep-dives/docs.md b/docs/docs/customize/deep-dives/docs.mdx similarity index 53% rename from docs/docs/customize/deep-dives/docs.md rename to docs/docs/customize/deep-dives/docs.mdx index 2786d548c..cc371804e 100644 --- a/docs/docs/customize/deep-dives/docs.md +++ b/docs/docs/customize/deep-dives/docs.mdx @@ -14,6 +14,9 @@ keywords: toc_max_heading_level: 5 --- +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + # @Docs The [`@Docs` context provider](customize/context-providers.mdx#docs) allows you to efficiently reference documentation directly within Continue. @@ -22,15 +25,25 @@ The [`@Docs` context provider](customize/context-providers.mdx#docs) allows you To enable the `@Docs` context provider, add it to the list of context providers in your `config.json` file. -```json title="config.json" -{ - "contextProviders": [ - { - "name": "docs" - } - ] -} -``` + + + ```yaml title="config.yaml" + context: + - provider: docs + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "docs" + } + ] + } + ``` + + ## How It Works @@ -76,17 +89,29 @@ Documentation sources may be suggested based on package files in your repo. This For 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: -```json title="config.json" -{ - "docs": [ - { - "title": "Nest.js", - "startUrl": "https://docs.nestjs.com/", - "faviconUrl": "https://docs.nestjs.com/favicon.ico" - } - ] -} -``` + + + ```yaml title="config.yaml" + docs: + - title: Nest.js + startUrl: https://docs.nestjs.com/ + faviconUrl: https://docs.nestjs.com/favicon.ico + ``` + + + ```json title="config.json" + { + "docs": [ + { + "title": "Nest.js", + "startUrl": "https://docs.nestjs.com/", + "faviconUrl": "https://docs.nestjs.com/favicon.ico" + } + ] + } + ``` + + See [the config reference](../../reference) for all documentation site configuration options. @@ -102,39 +127,63 @@ If you have set up an [embeddings provider](../model-types/embeddings.md), @docs As with [@Codebase context provider configuration](./codebase#configuration), you can adjust the reranking behavior of the `@Docs` context provider with the `nRetrieve`, `nFinal`, and `useReranking`. -```json title="config.json" -{ - "contextProviders": [ - { - "name": "docs", - "params": { - "nRetrieve": 25, // The number of docs to retreive from the embeddings query - "nFinal": 5, // The number of docs chunks to return IF reranking - "useReranking": true // use reranking if a reranker is configured (defaults to true) + + + ```yaml title="config.yaml" + context: + - provider: docs + params: + nRetrieve: 25 # The number of docs to retreive from the embeddings query + nFinal: 5 # The number of docs chunks to return IF reranking + useReranking: true # use reranking if a reranker is configured (defaults to true) + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "docs", + "params": { + "nRetrieve": 25, // The number of docs to retreive from the embeddings query + "nFinal": 5, // The number of docs chunks to return IF reranking + "useReranking": true // use reranking if a reranker is configured (defaults to true) + } } - } - ] -} -``` + ] + } + ``` + + ### Github The 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: -<<<<<<< HEAD - -```json title="config.json" -{ - "contextProviders": [ - { - "name": "docs", - "params": { - "githubToken": "github_..." + + + ```yaml title="config.yaml" + context: + - provider: docs + params: + githubToken: ${{ secrets.GITHUB_TOKEN }} + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "docs", + "params": { + "githubToken": "github_..." + } } - } - ] -} -``` + ] + } + ``` + + ### Local Crawling @@ -142,18 +191,31 @@ By default, Continue crawls documentation sites using a specialized crawling ser If your documentation is private, you can skip the default crawler and use a local crawler instead by setting `useLocalCrawling` to `true`. -```json title="config.json" -{ - "docs": [ - { - "title": "My Private Docs", - "startUrl": "http://10.2.1.2/docs", - "faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico", - "useLocalCrawling": true - } - ] -} -``` + + + ```yaml title="config.yaml" + docs: + - title: My Private Docs + startUrl: http://10.2.1.2/docs + faviconUrl: http://10.2.1.2/docs/assets/favicon.ico, + useLocalCrawling: true + ``` + + + ```json title="config.json" + { + "docs": [ + { + "title": "My Private Docs", + "startUrl": "http://10.2.1.2/docs", + "faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico", + "useLocalCrawling": true + } + ] + } + ``` + + 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.md) This will download and install Chromium to `~/.continue/.utils`, and use it as the local crawler. @@ -184,41 +246,74 @@ You can also use the following IDE command to force a re-index of all docs: `Con The following configuration example works out of the box for VS Code. This uses the built-in embeddings provider with no reranking. Pre-indexed docs will be accessible. -```json title="config.json" - "contextProviders": [ - { - "name": "docs", - } - ], - "docs": [ - { - "title": "Nest.js", - "startUrl": "https://docs.nestjs.com/", - }, - ], -``` + + + ```yaml title="config.yaml" + context: + - provider: docs + + docs: + - title: Nest.js + startUrl: https://docs.nestjs.com/ + ``` + + + ```json title="config.json" + "contextProviders": [ + { + "name": "docs", + } + ], + "docs": [ + { + "title": "Nest.js", + "startUrl": "https://docs.nestjs.com/", + }, + ], + ``` + + ### Jetbrains minimal setup Here is the equivalent minimal example for Jetbrains, which requires setting up an [embeddings provider](../model-types/embeddings.md). Pre-indexed docs will _not_ be accessible. -```json title="config.json" - "contextProviders": [ - { - "name": "docs", - } - ], - "docs": [ - { - "title": "Nest.js", - "startUrl": "https://docs.nestjs.com/", + + + ```yaml title="config.yaml" + models: + - name: LMStudio embedder + provider: lmstudio + model: nomic-ai/nomic-embed-text-v1.5-GGUF + roles: + - embed + context: + - provider: docs + docs: + - title: Nest.js + startUrl: https://docs.nestjs.com/ + ``` + + + ```json title="config.json" + "contextProviders": [ + { + "name": "docs", + } + ], + "docs": [ + { + "title": "Nest.js", + "startUrl": "https://docs.nestjs.com/", + }, + ], + "embeddingsProvider": { + "provider": "lmstudio", + "model": "nomic-ai/nomic-embed-text-v1.5-GGUF" }, - ], - "embeddingsProvider": { - "provider": "lmstudio", - "model": "nomic-ai/nomic-embed-text-v1.5-GGUF" - }, -``` + ``` + + ### Full-power setup (VS Code or Jetbrains) @@ -229,44 +324,79 @@ The following configuration example includes: - A reranker model available, with reranking parameters customized - A Github token to enable Github crawling -```json title="config.json" -{ - "contextProviders": [ - { - "name": "docs", - "params": { - "githubToken": "github_...", - "nRetrieve": 25, - "nFinal": 5, - "useReranking": true + + + ```yaml title="config.yaml" + models: + - name: LMStudio Nomic Text + provider: lmstudio + model: nomic-ai/nomic-embed-text-v1.5-GGUF + roles: + - embed + - name: Voyage Rerank-2 + provider: voyage + apiKey: ${{ secrets.VOYAGE_API_KEY }} + model: rerank-2 + roles: + - rerank + context: + - provider: docs + params: + githubToken: ${{ secrets.GITHUB_TOKEN }} + nRetrieve: 25 + nFinal: 5 + useReranking: true + docs: + - title: Nest.js + startUrl: https://docs.nestjs.com/ + - title: My Private Docs + startUrl: http://10.2.1.2/docs + faviconUrl: http://10.2.1.2/docs/assets/favicon.ico + maxDepth: 4 + useLocalCrawling: true + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "docs", + "params": { + "githubToken": "github_...", + "nRetrieve": 25, + "nFinal": 5, + "useReranking": true + } + } + ], + "docs": [ + { + "title": "Nest.js", + "startUrl": "https://docs.nestjs.com/" + }, + { + "title": "My Private Docs", + "startUrl": "http://10.2.1.2/docs", + "faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico", + "maxDepth": 4, + "useLocalCrawling": true + } + ], + "reranker": { + "name": "voyage", + "params": { + "model": "rerank-2", + "apiKey": "" } - } - ], - "docs": [ - { - "title": "Nest.js", - "startUrl": "https://docs.nestjs.com/" }, - { - "title": "My Private Docs", - "startUrl": "http://10.2.1.2/docs", - "faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico", - "maxDepth": 4, - "useLocalCrawling": true + "embeddingsProvider": { + "provider": "lmstudio", + "model": "nomic-ai/nomic-embed-text-v1.5-GGUF" } - ], - "reranker": { - "name": "voyage", - "params": { - "model": "rerank-2", - "apiKey": "" - } - }, - "embeddingsProvider": { - "provider": "lmstudio", - "model": "nomic-ai/nomic-embed-text-v1.5-GGUF" } -} -``` + ``` + + This could also involve enabling Chromium as a backup for local documentation the [User Settings Page](../settings.md).