Elffuss BraidHub

kikocis/continue public

61bef27a1dcd · 4.7 KiBRawPermalink
1---
2title: "How to Set Up @Codebase Context Provider in Continue"
3description: Retrieve relevant context and answers from your codebase using embeddings and keyword search.
4keywords: [talk, embeddings, reranker, codebase, experimental]
5sidebarTitle: "@Codebase"
6---
7
8Continue indexes your codebase so that it can later automatically pull in the most relevant context from throughout your workspace. This is done via a combination of embeddings-based retrieval and keyword search. By default, all embeddings are calculated locally using `transformers.js` and stored locally in `~/.continue/index`.
9
10<Info>
11 **Note:** `transformers.js` cannot be used in JetBrains IDEs. However, you can
12 select a different embeddings model from [the list
13 here](../model-roles/embeddings).
14</Info>
15
16## How to Use @Codebase and @Folder Context Providers
17
18Currently, the codebase retrieval feature is available as the "codebase" and "folder" context providers. You can use them by typing `@Codebase` or `@Folder` in the input box, and then asking a question. The contents of the input box will be compared with the embeddings from the rest of the codebase (or folder) to determine relevant files.
19
20### When @Codebase Context Provider Is Useful
21
22Here are some common use cases where it can be useful:
23
24- **Asking high-level questions about your codebase**
25 - "How do I add a new endpoint to the server?"
26 - "Do we use VS Code's CodeLens feature anywhere?"
27 - "Is there any code written already to convert HTML to markdown?"
28- **Generate code using existing samples as reference**
29 - "Generate a new React component with a date picker, using the same patterns as existing components"
30 - "Write a draft of a CLI application for this project using Python's argparse"
31 - "Implement the `foo` method in the `bar` class, following the patterns seen in other subclasses of `baz`.
32- **Use `@Folder` to ask questions about a specific folder, increasing the likelihood of relevant results**
33 - "What is the main purpose of this folder?"
34 - "How do we use VS Code's CodeLens API?"
35 - Or any of the above examples, but with `@Folder` instead of `@Codebase`
36
37### When @Codebase Context Provider Is Not Useful
38
39Here are use cases where it is not useful:
40
41- **When you need the LLM to see _literally every_ file in your codebase**
42 - "Find everywhere where the `foo` function is called"
43 - "Review our codebase and find any spelling mistakes"
44- **Refactoring tasks**
45 - "Add a new parameter to the `bar` function and update usages"
46
47## How to Configure @Codebase Context Provider Settings
48
49There are a few options that let you configure the behavior of the `@codebase` context provider, which are the same for the `@folder` context provider:
50
51<Tabs>
52 <Tab title="YAML">
53 ```yaml title="config.yaml"
54 context:
55 - provider: codebase
56 params:
57 nRetrieve: 25
58 nFinal: 5
59 useReranking: true
60 ```
61 </Tab>
62 <Tab title="JSON">
63 ```json title="config.json"
64 {
65 "contextProviders": [
66 {
67 "name": "codebase",
68 "params": {
69 "nRetrieve": 25,
70 "nFinal": 5,
71 "useReranking": true
72 }
73 }
74 ]
75 }
76 ```
77 </Tab>
78</Tabs>
79
80### `nRetrieve`
81
82Number of results to initially retrieve from vector database (default: 25)
83
84### `nFinal`
85
86Final number of results to use after re-ranking (default: 5)
87
88### `useReranking`
89
90Whether to use re-ranking, which will allow initial selection of `nRetrieve` results, then will use an LLM to select the top `nFinal` results (default: true)
91
92## How to Ignore Files During Indexing
93
94Continue 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`.
95
96Continue also supports a **global** `.continueignore` file that will be respected for all workspaces, which can be created at `~/.continue/.continueignore`.
97
98If you want to see exactly what files Continue has indexed, the metadata is stored in `~/.continue/index/index.sqlite`. You can use a tool like [DB Browser for SQLite](https://sqlitebrowser.org/) to view the `tag_catalog` table within this file.
99
100If you need to force a refresh of the index, reload the VS Code window with <kbd>cmd/ctrl</kbd> + <kbd>shift</kbd> + <kbd>p</kbd> + "Reload Window".
101
102## How Repository Map Enhances Codebase Understanding
103
104Models in the Claude 3, Llama 3.1/3.2, Gemini 1.5, and GPT-4o families will automatically use a [repository map](/customize/context/codebase#repository-map) during codebase retrieval, which allows the model to understand the structure of your codebase and use it to answer questions. Currently, the repository map only contains the filepaths in the codebase.