From 1cf69b6b9963bccfd5e926ea193498dde1f9fa6a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 23 Jun 2024 19:47:54 -0700 Subject: [PATCH] docs about rerankers [skip ci] --- .github/workflows/jetbrains-build.yaml | 2 +- docs/docs/walkthroughs/codebase-embeddings.md | 55 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-build.yaml b/.github/workflows/jetbrains-build.yaml index f60ab0768..d76cff5c6 100644 --- a/.github/workflows/jetbrains-build.yaml +++ b/.github/workflows/jetbrains-build.yaml @@ -120,7 +120,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} # Build binaries - - name: Install core node_modules + - name: Build the binaries run: | cd ../../binary npm run build diff --git a/docs/docs/walkthroughs/codebase-embeddings.md b/docs/docs/walkthroughs/codebase-embeddings.md index 803de5bd3..dbd102eca 100644 --- a/docs/docs/walkthroughs/codebase-embeddings.md +++ b/docs/docs/walkthroughs/codebase-embeddings.md @@ -211,6 +211,61 @@ export function modifyConfig(config: Config): Config { } ``` +## Reranking providers + +A reranking model improves the accuracy of codebase retrieval by breaking it into two stages. Instead of only using similarity search to go from all possible snippets to the top 10-20, we can instead get the top 100+ from similarity search and then use a more expensive model, the "reranker", to more accurately decide the top 10-20. + +Because reranking requires 100+ simultaneous invocations of a model, there are not currently any local rerankers that Continue supports. However if you are able to use any of the below options, it is strongly recommended, as they are cheap but will drastically improve the quality of codebase retrieval. + +### Voyage AI + +Voyage AI offers the best reranking model for code with their rerank-lite-1 model. After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this: + +```json title="~/.continue/config.json" +{ + "reranker": { + "name": "voyage", + "params": { + "model": "rerank-lite-1", + "apiKey": "" + } + } +} +``` + +### Cohere + +See Cohere's documentation for rerankers [here](https://docs.cohere.com/docs/rerank-2). + +```json title="~/.continue/config.json" +{ + "reranker": { + "name": "cohere", + "params": { + "model": "rerank-english-v3.0", + "apiKey": "" + } + } +} +``` + +### LLM + +If you only have access to a single LLM, then you can use it as a reranker. This is discouraged unless truly necessary, because it will be much more expensive and still less accurate than any of the above models trained specifically for the task. Note that this will not work if you are using a local model, for example with Ollama, because too many parallel requests need to be made. + +```json title="~/.continue/config.json" +{ + "reranker": { + "name": "llm", + "params": { + "modelTitle": "My Model Title" + } + } +} +``` + +The `"modelTitle"` field must match one of the models in your "models" array in config.json. + ## Customizing which files are indexed Continue respects `.gitignore` files in order to determine which files should not be indexed. If you'd like to exclude additional files, you can add them to a `.continueignore` file, which follows the exact same rules as `.gitignore`.