Create "Model providers"
This commit is contained in:
parent
a538eca05d
commit
034a206f42
87 changed files with 1197 additions and 1499 deletions
8
core/index.d.ts
vendored
8
core/index.d.ts
vendored
|
|
@ -647,6 +647,10 @@ export type ModelName =
|
|||
| "mistral-large-latest"
|
||||
| "mistral-7b"
|
||||
| "mistral-8x7b"
|
||||
| "mistral-tiny"
|
||||
| "mistral-small"
|
||||
| "mistral-medium"
|
||||
| "mistral-embed"
|
||||
// Llama 2
|
||||
| "llama2-7b"
|
||||
| "llama2-13b"
|
||||
|
|
@ -685,10 +689,6 @@ export type ModelName =
|
|||
| "gemini-1.5-pro"
|
||||
| "gemini-1.5-flash-latest"
|
||||
| "gemini-1.5-flash"
|
||||
// Mistral
|
||||
| "mistral-tiny"
|
||||
| "mistral-small"
|
||||
| "mistral-medium"
|
||||
// Tab autocomplete
|
||||
| "deepseek-1b"
|
||||
| "starcoder-1b"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
slug: /reference
|
||||
title: config.json
|
||||
slug: /customizing
|
||||
keywords: [config.json, configuration, options]
|
||||
---
|
||||
|
||||
324
docs/docs/customizing/context-providers.md
Normal file
324
docs/docs/customizing/context-providers.md
Normal file
|
|
@ -0,0 +1,324 @@
|
|||
---
|
||||
title: Context providers
|
||||
description: Type '@' to select content to the LLM as context
|
||||
keywords: [context, "@", provider, LLM]
|
||||
---
|
||||
|
||||
Context Providers allow you to type '@' and see a dropdown of content that can all be fed to the LLM as context. Every context provider is a plugin, which means if you want to reference some source of information that you don't see here, you can request (or build!) a new context provider.
|
||||
|
||||
As an example, say you are working on solving a new GitHub Issue. You type '@issue' and select the one you are working on. Continue can now see the issue title and contents. You also know that the issue is related to the files 'readme.md' and 'helloNested.py', so you type '@readme' and '@hello' to find and select them. Now these 3 "Context Items" are displayed inline with the rest of your input.
|
||||
|
||||

|
||||
|
||||
## Built-in Context Providers
|
||||
|
||||
To use any of the built-in context providers, open `~/.continue/config.json` and add it to the `contextProviders` list.
|
||||
|
||||
### Files
|
||||
|
||||
Type '@file' to reference any file in your current workspace.
|
||||
|
||||
```json
|
||||
{ "name": "file" }
|
||||
```
|
||||
|
||||
### Code
|
||||
|
||||
Type '@code' to reference specific functions or classes from throughout your project.
|
||||
|
||||
```json
|
||||
{ "name": "code" }
|
||||
```
|
||||
|
||||
### Git Diff
|
||||
|
||||
Type '@diff' to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing.
|
||||
|
||||
```json
|
||||
{ "name": "diff" }
|
||||
```
|
||||
|
||||
### Terminal
|
||||
|
||||
Type '@terminal' to reference the contents of your IDE's terminal.
|
||||
|
||||
```json
|
||||
{ "name": "terminal" }
|
||||
```
|
||||
|
||||
### Documentation
|
||||
|
||||
Type `@docs` to index and retrieve snippets from any documentation site.
|
||||
|
||||
```json
|
||||
{ "name": "docs" }
|
||||
```
|
||||
|
||||
To learn more, visit [Talk To Your Docs](../features/talk-to-your-docs.md).
|
||||
|
||||
### Open Files
|
||||
|
||||
Type '@open' to reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files.
|
||||
|
||||
```json
|
||||
{ "name": "open", "params": { "onlyPinned": true } }
|
||||
```
|
||||
|
||||
### Codebase Retrieval
|
||||
|
||||
Type '@codebase' to automatically retrieve the most relevant snippets from your codebase. Read more about indexing and retrieval [here](../features/codebase-embeddings.md).
|
||||
|
||||
```json
|
||||
{ "name": "codebase" }
|
||||
```
|
||||
|
||||
### Folders
|
||||
|
||||
Type '@folder' to use the same retrieval mechanism as '@codebase', but only on a single folder.
|
||||
|
||||
```json
|
||||
{ "name": "folder" }
|
||||
```
|
||||
|
||||
### Exact Search
|
||||
|
||||
Type '@search' to reference the results of codebase search, just like the results you would get from VS Code search. This context provider is powered by [ripgrep](https://github.com/BurntSushi/ripgrep).
|
||||
|
||||
```json
|
||||
{ "name": "search" }
|
||||
```
|
||||
|
||||
### URL
|
||||
|
||||
Type '@url' and input a URL, then Continue will convert it to a markdown document to pass to the model.
|
||||
|
||||
```json
|
||||
{ "name": "url" }
|
||||
```
|
||||
|
||||
### File Tree
|
||||
|
||||
Type '@tree' to reference the structure of your current workspace. The LLM will be able to see the nested directory structure of your project.
|
||||
|
||||
```json
|
||||
{ "name": "tree" }
|
||||
```
|
||||
|
||||
### Google
|
||||
|
||||
Type '@google' to reference the results of a Google search. For example, type "@google python tutorial" if you want to search and discuss ways of learning Python.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "google",
|
||||
"params": { "serperApiKey": "<your serper.dev api key>" }
|
||||
}
|
||||
```
|
||||
|
||||
Note: You can get an API key for free at [serper.dev](https://serper.dev).
|
||||
|
||||
### GitHub Issues
|
||||
|
||||
Type '@issue' to reference the conversation in a GitHub issue. Make sure to include your own [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to avoid being rate-limited:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "issue",
|
||||
"params": {
|
||||
"repos": [
|
||||
{
|
||||
"owner": "continuedev",
|
||||
"repo": "continue"
|
||||
}
|
||||
],
|
||||
"githubToken": "ghp_xxx"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### GitLab Merge Request
|
||||
|
||||
Type `@gitlab-mr` to reference an open MR for this branch on GitLab.
|
||||
|
||||
#### Configuration
|
||||
|
||||
You will need to create a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with the `read_api` scope. then add the following to your configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "gitlab-mr",
|
||||
"params": {
|
||||
"token": "..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Using Self-Hosted GitLab
|
||||
|
||||
You can specify the domain to communicate with by setting the `domain` parameter in your configurtion. By default this is set to `gitlab.com`.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "gitlab-mr",
|
||||
"params": {
|
||||
"token": "...",
|
||||
"domain": "gitlab.example.com"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Filtering Comments
|
||||
|
||||
If you select some code to be edited, you can have the context provider filter out comments for other files. To enable this feature, set `filterComments` to `true`.
|
||||
|
||||
### Jira Issues
|
||||
|
||||
Type '@jira' to reference the conversation in a Jira issue. Make sure to include your own [Atlassian API Token](https://id.atlassian.com/manage-profile/security/api-tokens), or use your `email` and `token`, with token set to your password for basic authentication. If you use your own Atlassian API Token, don't configure your email.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "jira",
|
||||
"params": {
|
||||
"domain": "company.atlassian.net",
|
||||
"token ": "ATATT..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Jira Datacenter Support
|
||||
|
||||
This context provider supports both Jira API version 2 and 3. It will use version 3 by default since
|
||||
that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need
|
||||
to set the API Version to 2 using the `apiVersion` property.
|
||||
|
||||
```json
|
||||
"params": {
|
||||
"apiVersion": "2",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
#### Issue Query
|
||||
|
||||
By default, the following query will be used to find issues:
|
||||
|
||||
```jql
|
||||
assignee = currentUser() AND resolution = Unresolved order by updated DESC
|
||||
```
|
||||
|
||||
You can override this query by setting the `issueQuery` parameter.
|
||||
|
||||
<!--
|
||||
Note: We are currently omitting the following providers due to bugs.
|
||||
See this issue for details: https://github.com/continuedev/continue/issues/1365
|
||||
-->
|
||||
|
||||
<!-- ### Code Outline
|
||||
|
||||
Type '@outline' to reference the outline of all currently open files. The outline of a files consists of only the function and class definitions in the file. Supported file extensions are '.js', '.mjs', '.go', '.c', '.cc', '.cs', '.cpp', '.el', '.ex', '.elm', '.java', '.ml', '.php', '.ql', '.rb', '.rs', '.ts'
|
||||
|
||||
```json
|
||||
{ "name": "outline" }
|
||||
```
|
||||
|
||||
### Code Highlights
|
||||
|
||||
Type '@highlights' to reference the 'highlights' from all currently open files. The highlights are computed using Paul Gauthier's so-called ['repomap'](https://aider.chat/docs/repomap.html) technique in [Aider Chat](https://github.com/paul-gauthier/aider). Supported file extensions are the same as for '@Outline' (behind the scenes, we use the corresponding tree-sitter grammars for language parsing).
|
||||
|
||||
```json
|
||||
{ "name": "highlights" }
|
||||
``` -->
|
||||
|
||||
### PostgreSQL
|
||||
|
||||
Type `@postgres` to reference the schema of a table, and some sample rows. A dropdown will appear, allowing you to select a specific table, or all tables.
|
||||
|
||||
The only required settings are those for creating the database connection: `host`, `port`, `user`, `password`, and `database`.
|
||||
|
||||
By default, the `schema` filter is set to `public`, and the `sampleRows` is set to 3. You may unset the schema if you want to include tables from all schemas.
|
||||
|
||||
[Here is a short demo.](https://github.com/continuedev/continue/pull/859)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "postgres",
|
||||
"params": {
|
||||
"host": "localhost",
|
||||
"port": 5436,
|
||||
"user": "myuser",
|
||||
"password": "catsarecool",
|
||||
"database": "animals",
|
||||
"schema": "public",
|
||||
"sampleRows": 3
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Database Tables
|
||||
|
||||
Type `@database` to reference table schemas you can use the drop-down or start typeing table names based off of your configuration. Configuration supports multiple databases, allowing you to specify various connection details for PostgreSQL, MySQL, SQLite. Each connection should include a unique name, the connection_type (e.g., postgres, sqlite), and the necessary connection parameters specific to each database type.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "database",
|
||||
"params": {
|
||||
"connections": [
|
||||
{
|
||||
"name": "examplePostgres",
|
||||
"connection_type": "postgres",
|
||||
"connection": {
|
||||
"user": "username",
|
||||
"host": "localhost",
|
||||
"database": "exampleDB",
|
||||
"password": "yourPassword",
|
||||
"port": 5432
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "exampleSqlite",
|
||||
"connection_type": "sqlite",
|
||||
"connection": {
|
||||
"filename": "/path/to/your/sqlite/database.db"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Debugger: Local Variables
|
||||
|
||||
Type `@locals` to reference the contents of the local variables with top n level (defaulting to 3) of call stack for that thread. A dropdown will appear, allowing you to select a specific thread to see the local variables in that thread.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "locals",
|
||||
"params": {
|
||||
"stackDepth": 3
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Repository map
|
||||
|
||||
Provides an overview of all files and the call signatures of top-level classes, functions, and methods. This helps the model better understand how a particular piece of code relates to the rest of the codebase.
|
||||
|
||||
This context provider is inpsired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html).
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "repo-map"
|
||||
}
|
||||
```
|
||||
|
||||
### Operating System
|
||||
|
||||
Type `@os` to reference the architecture and platform of your current operating system.
|
||||
|
||||
```json
|
||||
{ "name": "os" }
|
||||
```
|
||||
|
||||
### Requesting Context Providers
|
||||
|
||||
Not seeing what you want? Create an issue [here](https://github.com/continuedev/continue/issues/new?assignees=TyDunn&labels=enhancement&projects=&template=feature-request-%F0%9F%92%AA.md&title=) to request a new ContextProvider.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Tab autocomplete
|
||||
keywords: [tab, autocomplete]
|
||||
title: Autocomplete
|
||||
keywords: [autocomplete]
|
||||
---
|
||||
|
||||
Continue now provides support for tab autocomplete in [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains IDEs](https://plugins.jetbrains.com/plugin/22707-continue/edit). We will be greatly improving the experience over the next few releases, and it is always helpful to hear feedback. If you have any problems or suggestions, please let us know in our [Discord](https://discord.gg/vapESyrFmJ).
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
# Prompt files (experimental)
|
||||
---
|
||||
title: Prompt files
|
||||
---
|
||||
|
||||
Prompt files provide a convenient way to standardize common patterns and share a collection of LLM prompts with your team. They make it easy to build and use these prompts.
|
||||
|
||||
249
docs/docs/customizing/guides/build-your-own-context-provider.md
Normal file
249
docs/docs/customizing/guides/build-your-own-context-provider.md
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
---
|
||||
title: Build your own context provider
|
||||
---
|
||||
|
||||
## Introductory Example
|
||||
|
||||
To write your own context provider, you just have to implement the `CustomContextProvider`
|
||||
interface:
|
||||
|
||||
```typescript
|
||||
interface CustomContextProvider {
|
||||
title: string;
|
||||
displayTitle?: string;
|
||||
description?: string;
|
||||
renderInlineAs?: string;
|
||||
type?: ContextProviderType;
|
||||
getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]>;
|
||||
loadSubmenuItems?: (
|
||||
args: LoadSubmenuItemsArgs,
|
||||
) => Promise<ContextSubmenuItem[]>;
|
||||
}
|
||||
```
|
||||
|
||||
As an example, let's say you have a set of internal documents that have been indexed in a vector database. You've set up a simple REST API that allows internal users to query and get back relevant snippets. This context provider will send the query to this server and return the results from the vector database. The return type of `getContextItems` _must_ be an array of objects that have all of the following properties:
|
||||
|
||||
- `name`: The name of the context item, which will be displayed as a title
|
||||
- `description`: A longer description of the context item
|
||||
- `content`: The actual content of the context item, which will be fed to the LLM as context
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
const RagContextProvider: CustomContextProvider = {
|
||||
title: "rag",
|
||||
displayTitle: "RAG",
|
||||
description:
|
||||
"Retrieve snippets from our vector database of internal documents",
|
||||
|
||||
getContextItems: async (
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> => {
|
||||
const response = await fetch("https://internal_rag_server.com/retrieve", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ query }),
|
||||
});
|
||||
|
||||
const results = await response.json();
|
||||
|
||||
return results.map((result) => ({
|
||||
name: result.title,
|
||||
description: result.title,
|
||||
content: result.contents,
|
||||
}));
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
It can then be added in `config.ts` like so:
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
export function modifyConfig(config: Config): Config {
|
||||
if (!config.contextProviders) {
|
||||
config.contextProviders = [];
|
||||
}
|
||||
config.contextProviders.push(RagContextProvider);
|
||||
return config;
|
||||
}
|
||||
```
|
||||
|
||||
No modification in `config.json` is necessary.
|
||||
|
||||
## Custom Context Providers with Submenu or Query
|
||||
|
||||
There are 3 types of context providers: "normal", "query", and "submenu". The "normal" type is the default, and is what we've seen so far.
|
||||
|
||||
The **"query"** type is used when you want to display a text box to the user, and then use the contents of that text box to generate the context items. Built-in examples include "search" and "google". This text is what gets passed to the "query" argument in `getContextItems`. To implement a "query" context provider, simply set `"type": "query"` in your custom context provider object.
|
||||
|
||||
The **"submenu"** type is used when you want to display a list of searchable items in the dropdown. Built-in examples include "issue" and "folder". To implement a "submenu" context provider, set `"type": "submenu"` and implement the `loadSubmenuItems` and `getContextItems` functions. Here is an example that shows a list of all README files in the current workspace:
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
const ReadMeContextProvider: CustomContextProvider = {
|
||||
title: "readme",
|
||||
displayTitle: "README",
|
||||
description: "Reference README.md files in your workspace",
|
||||
type: "submenu",
|
||||
|
||||
getContextItems: async (
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> => {
|
||||
// 'query' is the filepath of the README selected from the dropdown
|
||||
const content = await extras.ide.readFile(query);
|
||||
return [
|
||||
{
|
||||
name: getFolder(query),
|
||||
description: getFolderAndBasename(query),
|
||||
content,
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
loadSubmenuItems: async (
|
||||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> => {
|
||||
// Filter all workspace files for READMEs
|
||||
const allFiles = await args.ide.listWorkspaceContents();
|
||||
const readmes = allFiles.filter((filepath) =>
|
||||
filepath.endsWith("README.md"),
|
||||
);
|
||||
|
||||
// Return the items that will be shown in the dropdown
|
||||
return readmes.map((filepath) => {
|
||||
return {
|
||||
id: filepath,
|
||||
title: getFolder(filepath),
|
||||
description: getFolderAndBasename(filepath),
|
||||
};
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export function modifyConfig(config: Config): Config {
|
||||
if (!config.contextProviders) {
|
||||
config.contextProviders = [];
|
||||
}
|
||||
config.contextProviders.push(ReadMeContextProvider);
|
||||
return config;
|
||||
}
|
||||
|
||||
function getFolder(path: string): string {
|
||||
return path.split(/[\/\\]/g).slice(-2)[0];
|
||||
}
|
||||
|
||||
function getFolderAndBasename(path: string): string {
|
||||
return path
|
||||
.split(/[\/\\]/g)
|
||||
.slice(-2)
|
||||
.join("/");
|
||||
}
|
||||
```
|
||||
|
||||
The flow of information in the above example is as follows:
|
||||
|
||||
1. The user types `@readme` and selects it from the dropdown, now displaying the submenu where they can search for any item returned by `loadSubmenuItems`.
|
||||
2. The user selects one of the READMEs in the submenu, enters the rest of their input, and presses enter.
|
||||
3. The `id` of the chosen `ContextSubmenuItem` is passed to `getContextItems` as the `query` argument. In this case it is the filepath of the README.
|
||||
4. The `getContextItems` function can then use the `query` to retrieve the full contents of the README and format the content before returning the context item which will be included in the prompt.
|
||||
|
||||
## Importing outside modules
|
||||
|
||||
To include outside Node modules in your config.ts, run `npm install <module_name>` from the `~/.continue` directory, and then import them in config.ts.
|
||||
|
||||
Continue will use [esbuild](https://esbuild.github.io/) to bundle your `config.ts` and any dependencies into a single Javascript file. The exact configuration used can be found [here](https://github.com/continuedev/continue/blob/5c9874400e223bbc9786a8823614a2e501fbdaf7/extensions/vscode/src/ideProtocol.ts#L45-L52).
|
||||
|
||||
## `CustomContextProvider` Reference
|
||||
|
||||
- `title`: An identifier for the context provider
|
||||
- `displayTitle` (optional): The title displayed in the dropdown
|
||||
- `description` (optional): The longer description displayed in the dropdown when hovered
|
||||
- `type` (optional): The type of context provider. Options are "normal", "query", and "submenu". Defaults to "normal".
|
||||
- `renderInlineAs` (optional): The string that will be rendered inline at the top of the prompt. If no value is provided, the `displayTitle` will be used. An empty string can be provided to prevent rendering the default `displayTitle`.
|
||||
- `getContextItems`: A function that returns the documents to include in the prompt. It should return a list of `ContextItem`s, and is given access to the following arguments:
|
||||
- `extras.fullInput`: A string representing the user's full input to the text box. This can be used for example to generate an embedding to compare against a set of other embedded documents
|
||||
- `extras.embeddingsProvider`: The embeddings provider has an `embed` function that will convert text (such as `fullInput`) to an embedding
|
||||
- `extras.llm`: The current default LLM, which you can use to make completion requests
|
||||
- `extras.ide`: An instance of the `IDE` class, which lets you gather various sources of information from the IDE, including the contents of the terminal, the list of open files, or any warnings in the currently open file.
|
||||
- `query`: (not currently used) A string representing the query
|
||||
- `loadSubmenuItems` (optional): A function that returns a list of `ContextSubmenuItem`s to display in a submenu. It is given access to an `IDE`, the same that is passed to `getContextItems`.
|
||||
|
||||
## Writing Context Providers in Other Languages
|
||||
|
||||
If you'd like to write a context provider in a language other than TypeScript, you can use the "http" context provider to call a server that hosts your own code. Add the context provider to `config.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "http",
|
||||
"params": {
|
||||
"url": "https://myserver.com/context-provider",
|
||||
"title": "http",
|
||||
"description": "Custom HTTP Context Provider",
|
||||
"displayTitle": "My Custom Context"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then, create a server that responds to requests as are made from [HttpContextProvider.ts](../../../core/context/providers/HttpContextProvider.ts). See the `hello` endpoint in [context_provider_server.py](../../../core/context/providers/context_provider_server.py) for an example that uses FastAPI.
|
||||
|
||||
## Extension API for VSCode
|
||||
|
||||
Continue exposes an API for registering context providers from a 3rd party VSCode extension. This is useful if you have a VSCode extension that provides some additional context that you would like to use in Continue. To use this API, add the following to your `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"extensionDependencies": ["continue.continue"]
|
||||
}
|
||||
```
|
||||
|
||||
Or copy `~/.continue/type/core/index.d.ts` to your extension repository.
|
||||
|
||||
Then, you can use the `registerCustomContextProvider` function to register your context provider. Your custom context provider must implement the `IContextProvider` interface.
|
||||
Here is an example:
|
||||
|
||||
```typescript
|
||||
import * as vscode from "vscode";
|
||||
|
||||
class MyCustomProvider implements IContextProvider {
|
||||
get description(): ContextProviderDescription {
|
||||
return {
|
||||
title: "custom",
|
||||
displayTitle: "Custom",
|
||||
description: "Custom description",
|
||||
type: "normal",
|
||||
};
|
||||
}
|
||||
|
||||
async getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
return [
|
||||
{
|
||||
name: "Custom",
|
||||
description: "Custom description",
|
||||
content: "Custom content",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async loadSubmenuItems(
|
||||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// create an instance of your custom provider
|
||||
const customProvider = new MyCustomProvider();
|
||||
|
||||
// get Continue extension using vscode API
|
||||
const continueExt = vscode.extensions.getExtension("continue.continue");
|
||||
|
||||
// get the API from the extension
|
||||
const continueApi = continueExt?.exports;
|
||||
|
||||
// register your custom provider
|
||||
continueApi?.registerCustomContextProvider(customProvider);
|
||||
```
|
||||
76
docs/docs/customizing/guides/how-to-self-host-a-model.md
Normal file
76
docs/docs/customizing/guides/how-to-self-host-a-model.md
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
---
|
||||
title: How to self-host a model
|
||||
---
|
||||
|
||||
You can deploy a model in your [AWS](https://github.com/continuedev/deploy-os-code-llm#aws), [GCP](https://github.com/continuedev/deploy-os-code-llm#gcp), [Azure](https://github.com/continuedev/deploy-os-code-llm#azure), [Lambda](https://lambdalabs.com/), or [other clouds](https://github.com/continuedev/deploy-os-code-llm#others-2) using:
|
||||
|
||||
- [HuggingFace TGI](https://github.com/continuedev/deploy-os-code-llm#tgi)
|
||||
- [vLLM](https://github.com/continuedev/deploy-os-code-llm#vllm)
|
||||
- [SkyPilot](https://github.com/continuedev/deploy-os-code-llm#skypilot)
|
||||
- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) (OpenAI compatible API)
|
||||
- [Lambda](https://github.com/continuedev/deploy-os-code-llm#lambda)
|
||||
|
||||
## Self-hosting an open-source model
|
||||
|
||||
For many cases, either Continue will have a built-in provider or the API you use will be OpenAI-compatible, in which case you can use the "openai" provider and change the "baseUrl" to point to the server.
|
||||
|
||||
However, if neither of these are the case, you will need to wire up a new LLM object.
|
||||
|
||||
## Authentication
|
||||
|
||||
Basic authentication can be done with any provider using the `apiKey` field:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "llama2-7b",
|
||||
"apiKey": "xxx"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
This translates to the header `"Authorization": "Bearer xxx"`.
|
||||
|
||||
If you need to send custom headers for authentication, you may use the `requestOptions.headers` property like in this example with Ollama:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "llama2-7b",
|
||||
"requestOptions": {
|
||||
"headers": {
|
||||
"X-Auth-Token": "xxx"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Similarly if your model requires a Certificate for authentication, you may use the `requestOptions.clientCertificate` property like in the example below:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "llama2-7b",
|
||||
"requestOptions": {
|
||||
"clientCertificate": {
|
||||
"cert": "C:\tempollama.pem",
|
||||
"key": "C:\tempollama.key",
|
||||
"passphrase": "c0nt!nu3"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
Before Width: | Height: | Size: 858 KiB After Width: | Height: | Size: 858 KiB |
59
docs/docs/customizing/model-providers/top-level/anthropic.md
Normal file
59
docs/docs/customizing/model-providers/top-level/anthropic.md
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
title: Anthropic
|
||||
---
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **Claude 3.5 Sonnet** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Claude 3.5 Sonnet",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-3-5-sonnet-20240620",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
Anthropic currently does not offer any autocomplete models.
|
||||
|
||||
[Click here](../../model-types/autocomplete.md) to see our full list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
Anthropic currently does not offer any embeddings models.
|
||||
|
||||
[Click here](../../model-types/embeddings.md) to see our full list of embeddings model providers.
|
||||
|
||||
## Reranking model
|
||||
|
||||
Anthropic currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see our full list of reranking model providers.
|
||||
|
||||
## Prompt caching
|
||||
|
||||
Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching).
|
||||
|
||||
Currently, we only allow caching of the system message. To enable this feature, update your your model configuration with `"cacheSystemMessage": true`:
|
||||
|
||||
```json
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
// Enable prompt caching
|
||||
"cacheSystemMessage": true,
|
||||
"title": "Anthropic",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-3-5-sonnet-20240620",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
99
docs/docs/customizing/model-providers/top-level/azure.md
Normal file
99
docs/docs/customizing/model-providers/top-level/azure.md
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
---
|
||||
title: Azure OpenAI
|
||||
---
|
||||
|
||||
## General model configuration
|
||||
|
||||
You can configure Azure OpenAI service through the UI, or you can configure it manually in `config.json`.
|
||||
|
||||
```json title="config.json"
|
||||
"models": [{
|
||||
"title": "Azure OpenAI",
|
||||
"provider": "azure",
|
||||
"model": "<YOUR_MODEL>",
|
||||
"apiBase": "<YOUR_DEPLOYMENT_BASE>",
|
||||
"engine": "<YOUR_ENGINE>",
|
||||
"apiVersion": "<YOUR_API_VERSION>",
|
||||
"apiType": "openai",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
To find out the information from _Azure AI Studio_, select the model that you would like to connect. Under the _Endpoint_ section and capture the Target URI.
|
||||
For example, Target URI of `<https://just-an-example.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2023-13-15-preview>`
|
||||
Maps to:
|
||||
|
||||
- model = gpt-4o
|
||||
- engine = gpt-4o
|
||||
- apiVersion = 2023-13-15-preview
|
||||
- apiBase = just-an-example.openai.azure.com
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **GPT-4o** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
"models": [{
|
||||
"title": "GPT-4o",
|
||||
"provider": "azure",
|
||||
"model": "gpt-4o",
|
||||
"apiBase": "<YOUR_DEPLOYMENT_BASE>",
|
||||
"engine": "<YOUR_ENGINE>",
|
||||
"apiVersion": "<YOUR_API_VERSION>",
|
||||
"apiType": "openai",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
We recommend configuring **Codestral** as your autocomplete model.
|
||||
|
||||
<!-- TODO: I don't think this is valid -->
|
||||
|
||||
```json title="config.json"
|
||||
"tabAutocompleteModel": [{
|
||||
"title": "Codestral",
|
||||
"provider": "azure",
|
||||
"model": "codestral-latest",
|
||||
"apiBase": "<YOUR_DEPLOYMENT_BASE>",
|
||||
"engine": "<YOUR_ENGINE>",
|
||||
"apiVersion": "<YOUR_API_VERSION>",
|
||||
"apiType": "openai",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **text-embedding-3-large** as your embeddings model.
|
||||
|
||||
<!-- TODO: I don't think this is valid -->
|
||||
|
||||
```json title="config.json"
|
||||
"embeddingsProvider": [{
|
||||
"provider": "azure",
|
||||
"model": "text-embedding-3-large",
|
||||
"apiBase": "<YOUR_DEPLOYMENT_BASE>",
|
||||
"engine": "<YOUR_ENGINE>",
|
||||
"apiVersion": "<YOUR_API_VERSION>",
|
||||
"apiType": "openai",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
Azure OpenAI currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see our full list of reranking model providers.
|
||||
|
||||
## Privacy
|
||||
|
||||
If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant.
|
||||
|
||||
:::info[Getting access]
|
||||
You need to apply for access to the Azure OpenAI service. Response times are typically within a few days.
|
||||
|
||||
**[Click here to apply for access to the Azure OpenAI service](https://azure.microsoft.com/en-us/products/ai-services/openai-service)**
|
||||
:::
|
||||
70
docs/docs/customizing/model-providers/top-level/bedrock.md
Normal file
70
docs/docs/customizing/model-providers/top-level/bedrock.md
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
title: Amazon Bedrock
|
||||
---
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **Claude 3.5 Sonnet** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Claude 3.5 Sonnet",
|
||||
"provider": "bedrock",
|
||||
"model": "anthropic.claude-3-5-sonnet-20240620-v1:0",
|
||||
"region": "us-east-1",
|
||||
"profile": "bedrock"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
Bedrock currently does not offer any autocomplete models.
|
||||
|
||||
[Click here](../../model-types/autocomplete.md) to see our full list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
Bedrock currently does not offer any embeddings models.
|
||||
|
||||
[Click here](../../model-types/embeddings.md) to see our full list of embeddings model providers.
|
||||
|
||||
## Reranking model
|
||||
|
||||
Bedrock currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see our full list of reranking model providers.
|
||||
|
||||
## Authentication
|
||||
|
||||
Authentication will be through temporary or long-term credentials in
|
||||
`~/.aws/credentials` under a configured profile (e.g. "bedrock").
|
||||
|
||||
```title="~/.aws/credentials
|
||||
[bedrock]
|
||||
aws_access_key_id = abcdefg
|
||||
aws_secret_access_key = hijklmno
|
||||
aws_session_token = pqrstuvwxyz # Optional: means short term creds.
|
||||
```
|
||||
|
||||
## Custom Imported Models
|
||||
|
||||
To setup Bedrock using custom imported models, add the following to your `config.json` file:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "AWS Bedrock deepseek-coder-6.7b-instruct",
|
||||
"provider": "bedrockimport",
|
||||
"model": "deepseek-coder-6.7b-instruct",
|
||||
"modelArn": "arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX",
|
||||
"region": "us-west-2",
|
||||
"profile": "bedrock"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
46
docs/docs/customizing/model-providers/top-level/deepseek.md
Normal file
46
docs/docs/customizing/model-providers/top-level/deepseek.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: DeepSeek
|
||||
---
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **deepseek-chat** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "DeepSeek Chat",
|
||||
"provider": "deepseek",
|
||||
"model": "deepseek-chat",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
We recommend configuring **deepseek-coder** as your autocomplete model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "DeepSeek Coder",
|
||||
"provider": "deepseek",
|
||||
"model": "deepseek-coder"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Embeddings model
|
||||
|
||||
DeepSeek currently does not offer any embeddings models.
|
||||
|
||||
[Click here](../../model-types/embeddings.md) to see our full list of embeddings model providers.
|
||||
|
||||
## Reranking model
|
||||
|
||||
DeepSeek currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see our full list of reranking model providers.
|
||||
50
docs/docs/customizing/model-providers/top-level/gemini.md
Normal file
50
docs/docs/customizing/model-providers/top-level/gemini.md
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
title: Gemini
|
||||
---
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **Gemini 1.5 Pro** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Gemini 1.5 Pro",
|
||||
"provider": "gemini",
|
||||
"model": "gemini-1.5-pro-latest",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
Gemini currently does not offer any autocomplete models.
|
||||
|
||||
[Click here](../../model-types/autocomplete.md) to see our full list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **text-embedding-004** as your embeddings model.
|
||||
|
||||
<!-- TODO: We should update the emebddings provider to infer `models/` -->
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": [
|
||||
{
|
||||
"provider": "gemini",
|
||||
"model": "models/text-embedding-004",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
Gemini currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see our full list of reranking model providers.
|
||||
56
docs/docs/customizing/model-providers/top-level/mistral.md
Normal file
56
docs/docs/customizing/model-providers/top-level/mistral.md
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
title: Mistral
|
||||
---
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **Mistral Large** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Mistral Large",
|
||||
"provider": "mistral",
|
||||
"model": "mistral-large-latest",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
We recommend configuring **Codestral** as your autocomplete model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Codestral",
|
||||
"provider": "mistral",
|
||||
"model": "codestral-latest"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **Mistral Embed** as your embeddings model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": [
|
||||
{
|
||||
"provider": "mistral",
|
||||
"model": "mistral-embed",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
Mistral currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see our full list of reranking model providers.
|
||||
|
|
@ -1,6 +1,51 @@
|
|||
# OpenAI
|
||||
---
|
||||
title: OpenAI
|
||||
---
|
||||
|
||||
The OpenAI class can be used to access OpenAI models like GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo.
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **GPT-4o** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "GPT-4o",
|
||||
"provider": "openai",
|
||||
"model": "gpt-4o",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
OpenAI currently does not offer any autocomplete models.
|
||||
|
||||
[Click here](../../model-types/autocomplete.md) to see our full list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **text-embedding-3-large** as your embeddings model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": [
|
||||
{
|
||||
"provider": "openai",
|
||||
"model": "text-embedding-3-large",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
OpenAI currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see our full list of reranking model providers.
|
||||
|
||||
## OpenAI compatible servers / APIs
|
||||
|
||||
|
|
@ -12,7 +57,7 @@ OpenAI compatible servers
|
|||
- [LocalAI](https://localai.io/basics/getting_started/)
|
||||
- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
|
||||
- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples)
|
||||
- [vLLM](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html) [^1]
|
||||
- [vLLM](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html)
|
||||
|
||||
OpenAI compatible APIs
|
||||
|
||||
|
|
@ -40,7 +85,3 @@ To force usage of `chat/completions` instead of `completions` endpoint you can s
|
|||
```json
|
||||
"useLegacyCompletionsEndpoint": false
|
||||
```
|
||||
|
||||
[^1]: Use the [Vllm Model Provider](./vllm.md) instead.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/OpenAI.ts)
|
||||
3
docs/docs/customizing/model-types/autocomplete.md
Normal file
3
docs/docs/customizing/model-types/autocomplete.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
title: Autocomplete models
|
||||
---
|
||||
3
docs/docs/customizing/model-types/chat.md
Normal file
3
docs/docs/customizing/model-types/chat.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
title: Chat models
|
||||
---
|
||||
3
docs/docs/customizing/model-types/embeddings.md
Normal file
3
docs/docs/customizing/model-types/embeddings.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
title: Embeddings models
|
||||
---
|
||||
3
docs/docs/customizing/model-types/reranking.md
Normal file
3
docs/docs/customizing/model-types/reranking.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
title: Reranking models
|
||||
---
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: How it works
|
||||
title: How they work
|
||||
description: Actions \-how it works
|
||||
keywords: [how, slash, commands, prompt, right click, quick fix, debug, action]
|
||||
sidebar_position: 4
|
||||
|
|
@ -1,12 +1,15 @@
|
|||
---
|
||||
title: How to use it
|
||||
title: Actions
|
||||
description: Actions \- how to use it
|
||||
sidebar_label: How to use them
|
||||
keywords: [how, slash, commands, prompt, right click, quick fix, debug, action]
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||

|
||||
|
||||
## How to use them
|
||||
|
||||
Actions are shortcuts for common use cases. For example, you might want to review code, write tests, or add a docstring.
|
||||
|
||||
## Slash commands
|
||||
|
|
@ -1,12 +1,15 @@
|
|||
---
|
||||
title: How to use it
|
||||
title: Autocomplete
|
||||
description: Autocomplete \- how to use it
|
||||
sidebar_label: How to use it
|
||||
keywords: [how]
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||

|
||||
|
||||
## How to use it
|
||||
|
||||
Tab autocomplete provides inline code suggestions as you type. To enable it, simply click the "Continue" button in the status bar at the bottom right of your IDE or ensure the "Enable Tab Autocomplete" option is checked in your IDE settings.
|
||||
|
||||
## Accepting suggestions
|
||||
|
|
|
|||
|
|
@ -43,4 +43,6 @@ You can include all of the changes you've made to your current branch by typing
|
|||
|
||||
## Other context
|
||||
|
||||
<!-- TODO: Add link + explanation of custom -->
|
||||
|
||||
Go to reference to see giant list of context providers
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
---
|
||||
title: How to use it
|
||||
title: Chat
|
||||
description: How to use Chat
|
||||
sidebar_label: How to use it
|
||||
keywords: [how, use, chat]
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||

|
||||
|
||||
## How to use it
|
||||
|
||||
Chat makes it easy to ask for help from an LLM without needing to leave the IDE. You send it a task, including any relevant information, and it replies with the text / code most likely to complete the task. If it does not give you want you want, then you can send follow up messages to clarify and adjust its approach until the task is completed.
|
||||
|
||||
Chat is best used to understand and iterate on code or as a replacement for search engine queries.
|
||||
|
|
|
|||
|
|
@ -1,572 +0,0 @@
|
|||
---
|
||||
title: Context providers
|
||||
description: Type '@' to select content to the LLM as context
|
||||
keywords: [context, "@", provider, LLM]
|
||||
---
|
||||
|
||||
Context Providers allow you to type '@' and see a dropdown of content that can all be fed to the LLM as context. Every context provider is a plugin, which means if you want to reference some source of information that you don't see here, you can request (or build!) a new context provider.
|
||||
|
||||
As an example, say you are working on solving a new GitHub Issue. You type '@issue' and select the one you are working on. Continue can now see the issue title and contents. You also know that the issue is related to the files 'readme.md' and 'helloNested.py', so you type '@readme' and '@hello' to find and select them. Now these 3 "Context Items" are displayed inline with the rest of your input.
|
||||
|
||||

|
||||
|
||||
## Built-in Context Providers
|
||||
|
||||
To use any of the built-in context providers, open `~/.continue/config.json` and add it to the `contextProviders` list.
|
||||
|
||||
### Files
|
||||
|
||||
Type '@file' to reference any file in your current workspace.
|
||||
|
||||
```json
|
||||
{ "name": "file" }
|
||||
```
|
||||
|
||||
### Code
|
||||
|
||||
Type '@code' to reference specific functions or classes from throughout your project.
|
||||
|
||||
```json
|
||||
{ "name": "code" }
|
||||
```
|
||||
|
||||
### Git Diff
|
||||
|
||||
Type '@diff' to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing.
|
||||
|
||||
```json
|
||||
{ "name": "diff" }
|
||||
```
|
||||
|
||||
### Terminal
|
||||
|
||||
Type '@terminal' to reference the contents of your IDE's terminal.
|
||||
|
||||
```json
|
||||
{ "name": "terminal" }
|
||||
```
|
||||
|
||||
### Documentation
|
||||
|
||||
Type `@docs` to index and retrieve snippets from any documentation site.
|
||||
|
||||
```json
|
||||
{ "name": "docs" }
|
||||
```
|
||||
|
||||
To learn more, visit [Talk To Your Docs](../features/talk-to-your-docs.md).
|
||||
|
||||
### Open Files
|
||||
|
||||
Type '@open' to reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files.
|
||||
|
||||
```json
|
||||
{ "name": "open", "params": { "onlyPinned": true } }
|
||||
```
|
||||
|
||||
### Codebase Retrieval
|
||||
|
||||
Type '@codebase' to automatically retrieve the most relevant snippets from your codebase. Read more about indexing and retrieval [here](../features/codebase-embeddings.md).
|
||||
|
||||
```json
|
||||
{ "name": "codebase" }
|
||||
```
|
||||
|
||||
### Folders
|
||||
|
||||
Type '@folder' to use the same retrieval mechanism as '@codebase', but only on a single folder.
|
||||
|
||||
```json
|
||||
{ "name": "folder" }
|
||||
```
|
||||
|
||||
### Exact Search
|
||||
|
||||
Type '@search' to reference the results of codebase search, just like the results you would get from VS Code search. This context provider is powered by [ripgrep](https://github.com/BurntSushi/ripgrep).
|
||||
|
||||
```json
|
||||
{ "name": "search" }
|
||||
```
|
||||
|
||||
### URL
|
||||
|
||||
Type '@url' and input a URL, then Continue will convert it to a markdown document to pass to the model.
|
||||
|
||||
```json
|
||||
{ "name": "url" }
|
||||
```
|
||||
|
||||
### File Tree
|
||||
|
||||
Type '@tree' to reference the structure of your current workspace. The LLM will be able to see the nested directory structure of your project.
|
||||
|
||||
```json
|
||||
{ "name": "tree" }
|
||||
```
|
||||
|
||||
### Google
|
||||
|
||||
Type '@google' to reference the results of a Google search. For example, type "@google python tutorial" if you want to search and discuss ways of learning Python.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "google",
|
||||
"params": { "serperApiKey": "<your serper.dev api key>" }
|
||||
}
|
||||
```
|
||||
|
||||
Note: You can get an API key for free at [serper.dev](https://serper.dev).
|
||||
|
||||
### GitHub Issues
|
||||
|
||||
Type '@issue' to reference the conversation in a GitHub issue. Make sure to include your own [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to avoid being rate-limited:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "issue",
|
||||
"params": {
|
||||
"repos": [
|
||||
{
|
||||
"owner": "continuedev",
|
||||
"repo": "continue"
|
||||
}
|
||||
],
|
||||
"githubToken": "ghp_xxx"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### GitLab Merge Request
|
||||
|
||||
Type `@gitlab-mr` to reference an open MR for this branch on GitLab.
|
||||
|
||||
#### Configuration
|
||||
|
||||
You will need to create a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with the `read_api` scope. then add the following to your configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "gitlab-mr",
|
||||
"params": {
|
||||
"token": "..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Using Self-Hosted GitLab
|
||||
|
||||
You can specify the domain to communicate with by setting the `domain` parameter in your configurtion. By default this is set to `gitlab.com`.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "gitlab-mr",
|
||||
"params": {
|
||||
"token": "...",
|
||||
"domain": "gitlab.example.com"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Filtering Comments
|
||||
|
||||
If you select some code to be edited, you can have the context provider filter out comments for other files. To enable this feature, set `filterComments` to `true`.
|
||||
|
||||
### Jira Issues
|
||||
|
||||
Type '@jira' to reference the conversation in a Jira issue. Make sure to include your own [Atlassian API Token](https://id.atlassian.com/manage-profile/security/api-tokens), or use your `email` and `token`, with token set to your password for basic authentication. If you use your own Atlassian API Token, don't configure your email.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "jira",
|
||||
"params": {
|
||||
"domain": "company.atlassian.net",
|
||||
"token ": "ATATT..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Jira Datacenter Support
|
||||
|
||||
This context provider supports both Jira API version 2 and 3. It will use version 3 by default since
|
||||
that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need
|
||||
to set the API Version to 2 using the `apiVersion` property.
|
||||
|
||||
```json
|
||||
"params": {
|
||||
"apiVersion": "2",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
#### Issue Query
|
||||
|
||||
By default, the following query will be used to find issues:
|
||||
|
||||
```jql
|
||||
assignee = currentUser() AND resolution = Unresolved order by updated DESC
|
||||
```
|
||||
|
||||
You can override this query by setting the `issueQuery` parameter.
|
||||
|
||||
<!--
|
||||
Note: We are currently omitting the following providers due to bugs.
|
||||
See this issue for details: https://github.com/continuedev/continue/issues/1365
|
||||
-->
|
||||
|
||||
<!-- ### Code Outline
|
||||
|
||||
Type '@outline' to reference the outline of all currently open files. The outline of a files consists of only the function and class definitions in the file. Supported file extensions are '.js', '.mjs', '.go', '.c', '.cc', '.cs', '.cpp', '.el', '.ex', '.elm', '.java', '.ml', '.php', '.ql', '.rb', '.rs', '.ts'
|
||||
|
||||
```json
|
||||
{ "name": "outline" }
|
||||
```
|
||||
|
||||
### Code Highlights
|
||||
|
||||
Type '@highlights' to reference the 'highlights' from all currently open files. The highlights are computed using Paul Gauthier's so-called ['repomap'](https://aider.chat/docs/repomap.html) technique in [Aider Chat](https://github.com/paul-gauthier/aider). Supported file extensions are the same as for '@Outline' (behind the scenes, we use the corresponding tree-sitter grammars for language parsing).
|
||||
|
||||
```json
|
||||
{ "name": "highlights" }
|
||||
``` -->
|
||||
|
||||
### PostgreSQL
|
||||
|
||||
Type `@postgres` to reference the schema of a table, and some sample rows. A dropdown will appear, allowing you to select a specific table, or all tables.
|
||||
|
||||
The only required settings are those for creating the database connection: `host`, `port`, `user`, `password`, and `database`.
|
||||
|
||||
By default, the `schema` filter is set to `public`, and the `sampleRows` is set to 3. You may unset the schema if you want to include tables from all schemas.
|
||||
|
||||
[Here is a short demo.](https://github.com/continuedev/continue/pull/859)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "postgres",
|
||||
"params": {
|
||||
"host": "localhost",
|
||||
"port": 5436,
|
||||
"user": "myuser",
|
||||
"password": "catsarecool",
|
||||
"database": "animals",
|
||||
"schema": "public",
|
||||
"sampleRows": 3
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Database Tables
|
||||
|
||||
Type `@database` to reference table schemas you can use the drop-down or start typeing table names based off of your configuration. Configuration supports multiple databases, allowing you to specify various connection details for PostgreSQL, MySQL, SQLite. Each connection should include a unique name, the connection_type (e.g., postgres, sqlite), and the necessary connection parameters specific to each database type.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "database",
|
||||
"params": {
|
||||
"connections": [
|
||||
{
|
||||
"name": "examplePostgres",
|
||||
"connection_type": "postgres",
|
||||
"connection": {
|
||||
"user": "username",
|
||||
"host": "localhost",
|
||||
"database": "exampleDB",
|
||||
"password": "yourPassword",
|
||||
"port": 5432
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "exampleSqlite",
|
||||
"connection_type": "sqlite",
|
||||
"connection": {
|
||||
"filename": "/path/to/your/sqlite/database.db"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Debugger: Local Variables
|
||||
|
||||
Type `@locals` to reference the contents of the local variables with top n level (defaulting to 3) of call stack for that thread. A dropdown will appear, allowing you to select a specific thread to see the local variables in that thread.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "locals",
|
||||
"params": {
|
||||
"stackDepth": 3
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Repository map
|
||||
|
||||
Provides an overview of all files and the call signatures of top-level classes, functions, and methods. This helps the model better understand how a particular piece of code relates to the rest of the codebase.
|
||||
|
||||
This context provider is inpsired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html).
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "repo-map"
|
||||
}
|
||||
```
|
||||
|
||||
### Operating System
|
||||
|
||||
Type `@os` to reference the architecture and platform of your current operating system.
|
||||
|
||||
```json
|
||||
{ "name": "os" }
|
||||
```
|
||||
|
||||
### Requesting Context Providers
|
||||
|
||||
Not seeing what you want? Create an issue [here](https://github.com/continuedev/continue/issues/new?assignees=TyDunn&labels=enhancement&projects=&template=feature-request-%F0%9F%92%AA.md&title=) to request a new ContextProvider.
|
||||
|
||||
## Building Your Own Context Provider
|
||||
|
||||
### Introductory Example
|
||||
|
||||
To write your own context provider, you just have to implement the `CustomContextProvider`
|
||||
interface:
|
||||
|
||||
```typescript
|
||||
interface CustomContextProvider {
|
||||
title: string;
|
||||
displayTitle?: string;
|
||||
description?: string;
|
||||
renderInlineAs?: string;
|
||||
type?: ContextProviderType;
|
||||
getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]>;
|
||||
loadSubmenuItems?: (
|
||||
args: LoadSubmenuItemsArgs,
|
||||
) => Promise<ContextSubmenuItem[]>;
|
||||
}
|
||||
```
|
||||
|
||||
As an example, let's say you have a set of internal documents that have been indexed in a vector database. You've set up a simple REST API that allows internal users to query and get back relevant snippets. This context provider will send the query to this server and return the results from the vector database. The return type of `getContextItems` _must_ be an array of objects that have all of the following properties:
|
||||
|
||||
- `name`: The name of the context item, which will be displayed as a title
|
||||
- `description`: A longer description of the context item
|
||||
- `content`: The actual content of the context item, which will be fed to the LLM as context
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
const RagContextProvider: CustomContextProvider = {
|
||||
title: "rag",
|
||||
displayTitle: "RAG",
|
||||
description:
|
||||
"Retrieve snippets from our vector database of internal documents",
|
||||
|
||||
getContextItems: async (
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> => {
|
||||
const response = await fetch("https://internal_rag_server.com/retrieve", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ query }),
|
||||
});
|
||||
|
||||
const results = await response.json();
|
||||
|
||||
return results.map((result) => ({
|
||||
name: result.title,
|
||||
description: result.title,
|
||||
content: result.contents,
|
||||
}));
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
It can then be added in `config.ts` like so:
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
export function modifyConfig(config: Config): Config {
|
||||
if (!config.contextProviders) {
|
||||
config.contextProviders = [];
|
||||
}
|
||||
config.contextProviders.push(RagContextProvider);
|
||||
return config;
|
||||
}
|
||||
```
|
||||
|
||||
No modification in `config.json` is necessary.
|
||||
|
||||
### Custom Context Providers with Submenu or Query
|
||||
|
||||
There are 3 types of context providers: "normal", "query", and "submenu". The "normal" type is the default, and is what we've seen so far.
|
||||
|
||||
The **"query"** type is used when you want to display a text box to the user, and then use the contents of that text box to generate the context items. Built-in examples include ["search"](#exact-search) and ["google"](#google). This text is what gets passed to the "query" argument in `getContextItems`. To implement a "query" context provider, simply set `"type": "query"` in your custom context provider object.
|
||||
|
||||
The **"submenu"** type is used when you want to display a list of searchable items in the dropdown. Built-in examples include ["issue"](#github-issues) and ["folder"](#folders). To implement a "submenu" context provider, set `"type": "submenu"` and implement the `loadSubmenuItems` and `getContextItems` functions. Here is an example that shows a list of all README files in the current workspace:
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
const ReadMeContextProvider: CustomContextProvider = {
|
||||
title: "readme",
|
||||
displayTitle: "README",
|
||||
description: "Reference README.md files in your workspace",
|
||||
type: "submenu",
|
||||
|
||||
getContextItems: async (
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> => {
|
||||
// 'query' is the filepath of the README selected from the dropdown
|
||||
const content = await extras.ide.readFile(query);
|
||||
return [
|
||||
{
|
||||
name: getFolder(query),
|
||||
description: getFolderAndBasename(query),
|
||||
content,
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
loadSubmenuItems: async (
|
||||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> => {
|
||||
// Filter all workspace files for READMEs
|
||||
const allFiles = await args.ide.listWorkspaceContents();
|
||||
const readmes = allFiles.filter((filepath) =>
|
||||
filepath.endsWith("README.md"),
|
||||
);
|
||||
|
||||
// Return the items that will be shown in the dropdown
|
||||
return readmes.map((filepath) => {
|
||||
return {
|
||||
id: filepath,
|
||||
title: getFolder(filepath),
|
||||
description: getFolderAndBasename(filepath),
|
||||
};
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export function modifyConfig(config: Config): Config {
|
||||
if (!config.contextProviders) {
|
||||
config.contextProviders = [];
|
||||
}
|
||||
config.contextProviders.push(ReadMeContextProvider);
|
||||
return config;
|
||||
}
|
||||
|
||||
function getFolder(path: string): string {
|
||||
return path.split(/[\/\\]/g).slice(-2)[0];
|
||||
}
|
||||
|
||||
function getFolderAndBasename(path: string): string {
|
||||
return path
|
||||
.split(/[\/\\]/g)
|
||||
.slice(-2)
|
||||
.join("/");
|
||||
}
|
||||
```
|
||||
|
||||
The flow of information in the above example is as follows:
|
||||
|
||||
1. The user types `@readme` and selects it from the dropdown, now displaying the submenu where they can search for any item returned by `loadSubmenuItems`.
|
||||
2. The user selects one of the READMEs in the submenu, enters the rest of their input, and presses enter.
|
||||
3. The `id` of the chosen `ContextSubmenuItem` is passed to `getContextItems` as the `query` argument. In this case it is the filepath of the README.
|
||||
4. The `getContextItems` function can then use the `query` to retrieve the full contents of the README and format the content before returning the context item which will be included in the prompt.
|
||||
|
||||
### Importing outside modules
|
||||
|
||||
To include outside Node modules in your config.ts, run `npm install <module_name>` from the `~/.continue` directory, and then import them in config.ts.
|
||||
|
||||
Continue will use [esbuild](https://esbuild.github.io/) to bundle your `config.ts` and any dependencies into a single Javascript file. The exact configuration used can be found [here](https://github.com/continuedev/continue/blob/5c9874400e223bbc9786a8823614a2e501fbdaf7/extensions/vscode/src/ideProtocol.ts#L45-L52).
|
||||
|
||||
### `CustomContextProvider` Reference
|
||||
|
||||
- `title`: An identifier for the context provider
|
||||
- `displayTitle` (optional): The title displayed in the dropdown
|
||||
- `description` (optional): The longer description displayed in the dropdown when hovered
|
||||
- `type` (optional): The type of context provider. Options are "normal", "query", and "submenu". Defaults to "normal".
|
||||
- `renderInlineAs` (optional): The string that will be rendered inline at the top of the prompt. If no value is provided, the `displayTitle` will be used. An empty string can be provided to prevent rendering the default `displayTitle`.
|
||||
- `getContextItems`: A function that returns the documents to include in the prompt. It should return a list of `ContextItem`s, and is given access to the following arguments:
|
||||
- `extras.fullInput`: A string representing the user's full input to the text box. This can be used for example to generate an embedding to compare against a set of other embedded documents
|
||||
- `extras.embeddingsProvider`: The embeddings provider has an `embed` function that will convert text (such as `fullInput`) to an embedding
|
||||
- `extras.llm`: The current default LLM, which you can use to make completion requests
|
||||
- `extras.ide`: An instance of the `IDE` class, which lets you gather various sources of information from the IDE, including the contents of the terminal, the list of open files, or any warnings in the currently open file.
|
||||
- `query`: (not currently used) A string representing the query
|
||||
- `loadSubmenuItems` (optional): A function that returns a list of `ContextSubmenuItem`s to display in a submenu. It is given access to an `IDE`, the same that is passed to `getContextItems`.
|
||||
|
||||
### Writing Context Providers in Other Languages
|
||||
|
||||
If you'd like to write a context provider in a language other than TypeScript, you can use the "http" context provider to call a server that hosts your own code. Add the context provider to `config.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "http",
|
||||
"params": {
|
||||
"url": "https://myserver.com/context-provider",
|
||||
"title": "http",
|
||||
"description": "Custom HTTP Context Provider",
|
||||
"displayTitle": "My Custom Context"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then, create a server that responds to requests as are made from [HttpContextProvider.ts](../../../core/context/providers/HttpContextProvider.ts). See the `hello` endpoint in [context_provider_server.py](../../../core/context/providers/context_provider_server.py) for an example that uses FastAPI.
|
||||
|
||||
### Extension API for VSCode
|
||||
|
||||
Continue exposes an API for registering context providers from a 3rd party VSCode extension. This is useful if you have a VSCode extension that provides some additional context that you would like to use in Continue. To use this API, add the following to your `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"extensionDependencies": ["continue.continue"]
|
||||
}
|
||||
```
|
||||
|
||||
Or copy `~/.continue/type/core/index.d.ts` to your extension repository.
|
||||
|
||||
Then, you can use the `registerCustomContextProvider` function to register your context provider. Your custom context provider must implement the `IContextProvider` interface.
|
||||
Here is an example:
|
||||
|
||||
```typescript
|
||||
import * as vscode from "vscode";
|
||||
|
||||
class MyCustomProvider implements IContextProvider {
|
||||
get description(): ContextProviderDescription {
|
||||
return {
|
||||
title: "custom",
|
||||
displayTitle: "Custom",
|
||||
description: "Custom description",
|
||||
type: "normal",
|
||||
};
|
||||
}
|
||||
|
||||
async getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
return [
|
||||
{
|
||||
name: "Custom",
|
||||
description: "Custom description",
|
||||
content: "Custom content",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async loadSubmenuItems(
|
||||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// create an instance of your custom provider
|
||||
const customProvider = new MyCustomProvider();
|
||||
|
||||
// get Continue extension using vscode API
|
||||
const continueExt = vscode.extensions.getExtension("continue.continue");
|
||||
|
||||
// get the API from the extension
|
||||
const continueApi = continueExt?.exports;
|
||||
|
||||
// register your custom provider
|
||||
continueApi?.registerCustomContextProvider(customProvider);
|
||||
```
|
||||
|
|
@ -1,12 +1,16 @@
|
|||
---
|
||||
title: How to use it
|
||||
title: Edit
|
||||
sidebar_position: 1
|
||||
sidebar_label: How to use it
|
||||
description: How to use Edit
|
||||
keywords: [edit, cmd l, use]
|
||||
slug: /docs/edit
|
||||
---
|
||||
|
||||

|
||||
|
||||
## How to use it
|
||||
|
||||
Edit is a convenient way to modify code without leaving your current file. Highlight a block of code, describe your code changes, and a diff will be streamed inline to your file which you can accept or reject.
|
||||
|
||||
Edit is best used for small, quick changes such as:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ keywords:
|
|||
|
||||

|
||||
|
||||
**Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom experiences inside [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)**
|
||||
**Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom experiences inside [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)**.
|
||||
|
||||
- [Chat](/chat/how-to-use-it.md) to understand and iterate on code in the sidebar
|
||||
- [Autocomplete](/autocomplete/how-to-use-it.md) to recieve inline code suggestions as you type
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
title: Code configuration
|
||||
---
|
||||
|
||||
To allow added flexibility and eventually support an entire plugin ecosystem, Continue can be configured programmatically in a TypeScript file, `~/.continue/config.ts`.
|
||||
|
||||
Whenever Continue loads, it carries out the following steps:
|
||||
|
||||
1. Load `~/.continue/config.json`
|
||||
2. Convert this into a `Config` object
|
||||
3. If `~/.continue/config.ts` exists and has defined `modifyConfig` correctly, call `modifyConfig` with the `Config` object to generate the final configuration
|
||||
|
||||
Defining a `modifyConfig` function allows you to make any final modifications to your initial `config.json`. Here's an example that sets the temperature to a random number and maxTokens to 1024:
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
export function modifyConfig(config: Config): Config {
|
||||
config.completionOptions = {
|
||||
...config.completionOptions,
|
||||
temperature: Math.random(),
|
||||
maxTokens: 1024,
|
||||
};
|
||||
return config;
|
||||
}
|
||||
```
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
---
|
||||
title: Quick actions (experimental, VS Code only)
|
||||
description: Quick Actions streamline your development workflow by allowing quick edits on selected classes or functions
|
||||
keywords: [experimental, automate, configuration, quick, actions]
|
||||
toc_max_heading_level: 5
|
||||
---
|
||||
|
||||
Quick Actions streamline your development workflow by providing a tool to quickly select an entire class or function to perform a quick edit on. Configure custom actions to execute complex operations with a single click.
|
||||
|
||||

|
||||
|
||||
## How It Works
|
||||
|
||||
:::info[Note]
|
||||
For the language of the file you have open, you must have the Language Server Protocol extension installed.
|
||||
:::
|
||||
|
||||
Quick Actions use a CodeLens provider to add interactive elements above functions and classes in your code.
|
||||
|
||||
By default, Quick Actions include a single predefined action:
|
||||
|
||||
- `Continue`: This action allows you to perform a quick edit on the selected class or function.
|
||||
|
||||
## How to disable Quick Actions
|
||||
|
||||
Quick Actions are enabled by default _for pre-release versions of Contine_.
|
||||
|
||||
To disable Quick Actions, open the settings menu (`⌘ + ,`), search for `"continue.enableQuickActions"`, and toggle the checkbox to disable.
|
||||
|
||||
## Custom Quick Actions
|
||||
|
||||
Custom Quick Actions allow you to tailor functionality to your specific needs, extending beyond the default actions. You can easily configure these custom actions in your `~/.continue/config.json` file.
|
||||
|
||||
:::info
|
||||
[View the Configuration Options reference](../reference/config) for specific schema details.
|
||||
:::
|
||||
|
||||
### Example Use Cases
|
||||
|
||||
#### 1. Write an inline unit test
|
||||
|
||||
A quick action that generates and inserts a unit test above the selected code.
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
"experimental": {
|
||||
"quickActions": [
|
||||
{
|
||||
"title": "Unit test",
|
||||
"prompt": "Write a unit test for this code. Do not change anything about the code itself.",
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### 2. Send code to chat panel to learn more about it
|
||||
|
||||
The default "Explain" aims to provide a brief overview of the code. This quick action sends the prompt and the code to the chat to provides a more detailed explanation.
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
"experimental": {
|
||||
"quickActions": [
|
||||
{
|
||||
"title": "Detailed explanation",
|
||||
"prompt": "Explain the following code in detail, including all methods and properties.",
|
||||
"sendToChat": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### 3. Create a Typescript interface
|
||||
|
||||
A quick action that generates and inserts a Typescript interface above the selected code.
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
"experimental": {
|
||||
"quickActions": [
|
||||
{
|
||||
"title": "Create Interface",
|
||||
"prompt": "Create a new Typescript interface for the following code.",
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Share your feedback
|
||||
|
||||
We'd love to hear your thoughts on Quick Actions! Share your feedback and help us improve.
|
||||
|
||||
<!-- Discord Feedback channel -->
|
||||
|
||||
<a href="https://discord.com/channels/1108621136150929458/1156679146932535376" className="button button--primary">Give Feedback on Discord</a>
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
# Anthropic
|
||||
|
||||
To setup Anthropic, obtain an API key from [here](https://www.anthropic.com/api) and add the following to your `config.json` file:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Anthropic",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-3-5-sonnet-20240620",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Anthropic.ts)
|
||||
|
||||
## Prompt caching
|
||||
|
||||
Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching).
|
||||
|
||||
Currently, we only allow caching of the system message. To enable this feature, update your your model configuration with `"cacheSystemMessage": true`:
|
||||
|
||||
```json
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
// Enable prompt caching
|
||||
"cacheSystemMessage": true,
|
||||
"title": "Anthropic",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-3-5-sonnet-20240620",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
# Azure OpenAI
|
||||
|
||||
If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant.
|
||||
|
||||
:::info[Getting access]
|
||||
You need to apply for access to the Azure OpenAI service. Response times are typically within a few days.
|
||||
|
||||
**[Click here to apply for access to the Azure OpenAI service](https://azure.microsoft.com/en-us/products/ai-services/openai-service)**
|
||||
:::
|
||||
|
||||
## Configuration
|
||||
|
||||
You can configure Azure OpenAI service through the UI, or you can configure it manually in `config.json`.
|
||||
|
||||
```json title="config.json"
|
||||
"models": [{
|
||||
"title": "Azure OpenAI",
|
||||
"provider": "azure",
|
||||
"model": "<YOUR_MODEL>",
|
||||
"apiBase": "<YOUR_DEPLOYMENT_BASE>",
|
||||
"engine": "<YOUR_ENGINE>",
|
||||
"apiVersion": "<YOUR_API_VERSION>",
|
||||
"apiType": "openai",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
To find out the information from _Azure AI Studio_, select the model that you would like to connect. Under the _Endpoint_ section and capture the Target URI.
|
||||
For example, Target URI of https://just-an-example.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2023-13-15-preview
|
||||
Maps to:
|
||||
|
||||
- model = gpt-4o
|
||||
- engine = gpt-4o
|
||||
- apiVersion = 2023-13-15-preview
|
||||
- apiBase = just-an-example.openai.azure.com
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
# Amazon Bedrock
|
||||
|
||||
To setup Bedrock, add the following to your `config.json` file:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Bedrock: Claude 3.5 Sonnet",
|
||||
"provider": "bedrock",
|
||||
"model": "anthropic.claude-3-5-sonnet-20240620-v1:0",
|
||||
"region": "us-east-1",
|
||||
"profile": "bedrock"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Authentication will be through temporary or long-term credentials in
|
||||
~/.aws/credentials under a configured profile (e.g. "bedrock").
|
||||
|
||||
```title="~/.aws/credentials
|
||||
[bedrock]
|
||||
aws_access_key_id = abcdefg
|
||||
aws_secret_access_key = hijklmno
|
||||
aws_session_token = pqrstuvwxyz # Optional: means short term creds.
|
||||
```
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
# DeepSeek
|
||||
|
||||
To setup DeepSeek, obtain an API key from [here](https://www.deepseek.com/) and add the following to your `config.json` file:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Deepseek",
|
||||
"provider": "deepseek",
|
||||
"model": "deepseek-code", // Or any other DeepSeek model
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
# Gemini
|
||||
|
||||
The Google Gemini API is currently in beta. You can [create an API key in Google AI Studio](https://aistudio.google.com) and use `gemini-1.5-pro-latest`. Change `~/.continue/config.json` to include the following entry in the "models" array:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Gemini Pro",
|
||||
"provider": "gemini",
|
||||
"model": "gemini-1.5-pro-latest",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Google has also released a more lightweight version of the model that still has a one-million-token context window and multimodal capabilities named Gemini Flash. It can be accessed by adding an entry in the models array similar to the above, but substituting "flash" for "pro" in the `title` and `model` values.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Gemini.ts)
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# Mistral API
|
||||
|
||||
The [Mistral](https://mistral.ai) API provides hosted access to their models, including Mistral-7b, Mixtral, and the very capable mistral-medium. After you obtain your API key [here](https://docs.mistral.ai/), Continue can be configured as shown here:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"provider": "mistral",
|
||||
"title": "Codestral",
|
||||
"model": "codestral-latest",
|
||||
"apiKey": "<API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Mistral.ts)
|
||||
|
|
@ -1,347 +0,0 @@
|
|||
---
|
||||
title: Configuration
|
||||
description: Configure your LLM and model provider
|
||||
keywords: [configure, llm, provider]
|
||||
---
|
||||
|
||||
# Configuration
|
||||
|
||||
Want a quick and easy setup for Continue? We've got you covered with some sample `config.json` files for different scenarios. Just copy and paste them into your `config.json` by clicking the gear icon at the bottom right of the Continue sidebar.
|
||||
|
||||
## Quick Setup Options
|
||||
|
||||
You can use Continue in different ways. Here are some quick setups for common uses:
|
||||
|
||||
- [Free Trial](#free-trial) - Try Continue without any additional setup.
|
||||
- [Best Overall Experience](#best-overall-experience) - Utilize the hand picked models for the best experience.
|
||||
- [Local and Offline](#local-and-offline-configuration) - Use local models for offline use with better privacy.
|
||||
|
||||
### Free Trial
|
||||
|
||||
The `free-trial` lets new users try out Continue with GPT-4o, Llama3, Claude 3.5, and other models using a ContinueDev proxy server that securely makes API calls to these services.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "GPT-4o (trial)",
|
||||
"provider": "free-trial",
|
||||
"model": "gpt-4o"
|
||||
}
|
||||
],
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Codestral (trial)",
|
||||
"provider": "free-trial",
|
||||
"model": "AUTODETECT"
|
||||
},
|
||||
"embeddingsProvider": {
|
||||
"provider": "free-trial"
|
||||
},
|
||||
"reranker": {
|
||||
"name": "free-trial"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Best Overall Experience
|
||||
|
||||
This setup uses Claude 3.5 Sonnet for chatting, Codestral for autocomplete, and Voyage AI for embeddings and reranking.
|
||||
|
||||
**What You Need:**
|
||||
|
||||
1. Get an Anthropic API key from [Anthropic Console](https://console.anthropic.com/account/keys)
|
||||
2. Get a Codestral API key from [Mistral AI's La Plateforme](https://console.mistral.ai/codestral)
|
||||
3. Get an Voyage AI API key from [Voyage AI Dashboard](https://dash.voyageai.com/)
|
||||
4. Replace `[CODESTRAL_API_KEY]`, `[ANTHROPIC_API_KEY]`, and `[VOYAGE_API_KEY]` with the keys you got from the above links.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Claude 3.5 Sonnet",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-3-5-sonnet-20240620",
|
||||
"apiKey": "[ANTHROPIC_API_KEY]"
|
||||
}
|
||||
],
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Codestral",
|
||||
"provider": "mistral",
|
||||
"model": "codestral-latest",
|
||||
"apiKey": "[CODESTRAL_API_KEY]"
|
||||
},
|
||||
"embeddingsProvider": {
|
||||
"provider": "openai",
|
||||
"model": "voyage-code-2",
|
||||
"apiBase": "https://api.voyageai.com/v1/",
|
||||
"apiKey": "[VOYAGE_AI_API_KEY]"
|
||||
},
|
||||
"reranker": {
|
||||
"name": "voyage",
|
||||
"params": {
|
||||
"apiKey": "[VOYAGE_AI_API_KEY]"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Local and Offline Configuration
|
||||
|
||||
This configuration leverages Ollama for all functionalities - chat, autocomplete, and embeddings - ensuring that no code is transmitted outside your machine, allowing Continue to be run even on an air-gapped computer.
|
||||
|
||||
**What You Need:**
|
||||
|
||||
1. Download Ollama from [Ollama's Official Site](https://ollama.ai)
|
||||
2. Pull the required models:
|
||||
- For chat: `ollama pull llama3:8b`
|
||||
- For autocomplete: `ollama pull starcoder2:3b`
|
||||
- For embeddings: `ollama pull nomic-embed-text`
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "AUTODETECT"
|
||||
}
|
||||
],
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Starcoder 2 3b",
|
||||
"provider": "ollama",
|
||||
"model": "starcoder2:3b"
|
||||
},
|
||||
"embeddingsProvider": {
|
||||
"provider": "ollama",
|
||||
"model": "nomic-embed-text"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you require a fully air-gapped setup, you may also want to:
|
||||
|
||||
1. For VS Code, manually download the latest .vsix file from the [Open VSX Registry](https://open-vsx.org/extension/Continue/continue) rather than the VS Code Marketplace and [install it to VS Code](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix). For JetBrains, manually download the .zip file from the [JetBrains Plugin Repository](https://plugins.jetbrains.com/plugin/22707-continue) and [install it to your IDE](https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk).
|
||||
2. Open `~/.continue/config.json` and set `"allowAnonymousTelemetry": false`. This will stop Continue from attempting requests to PostHog for [anonymous telemetry](../telemetry.md).
|
||||
|
||||
## Setting up chat models
|
||||
|
||||
In `config.json`, you'll find the `models` property, a list of the models that you have saved to use with Continue:
|
||||
|
||||
```json
|
||||
"models": [
|
||||
{
|
||||
"title": "GPT-4o",
|
||||
"provider": "free-trial",
|
||||
"model": "gpt-4o"
|
||||
},
|
||||
{
|
||||
"title": "GPT-4o Mini",
|
||||
"provider": "free-trial",
|
||||
"model": "gpt-4o-mini"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
Just by specifying the `model` and `provider` properties, we will automatically detect prompt templates and other important information, but if you're looking to do something beyond this basic setup, we'll explain a few other options below.
|
||||
|
||||
## Self-hosting an open-source model
|
||||
|
||||
For many cases, either Continue will have a built-in provider or the API you use will be OpenAI-compatible, in which case you can use the "openai" provider and change the "baseUrl" to point to the server.
|
||||
|
||||
However, if neither of these are the case, you will need to wire up a new LLM object. Learn how to do this [here](#defining-a-custom-llm-provider).
|
||||
|
||||
## Authentication
|
||||
|
||||
Basic authentication can be done with any provider using the `apiKey` field:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "llama2-7b",
|
||||
"apiKey": "xxx"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
This translates to the header `"Authorization": "Bearer xxx"`.
|
||||
|
||||
If you need to send custom headers for authentication, you may use the `requestOptions.headers` property like in this example with Ollama:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "llama2-7b",
|
||||
"requestOptions": {
|
||||
"headers": {
|
||||
"X-Auth-Token": "xxx"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Similarly if your model requires a Certificate for authentication, you may use the `requestOptions.clientCertificate` property like in the example below:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "llama2-7b",
|
||||
"requestOptions": {
|
||||
"clientCertificate": {
|
||||
"cert": "C:\tempollama.pem",
|
||||
"key": "C:\tempollama.key",
|
||||
"passphrase": "c0nt!nu3"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Context Length
|
||||
|
||||
Continue by default knows the context length for common models. For example, it will automatically assume 200k tokens for Claude 3. For Ollama, the context length is determined automatically by asking Ollama. If neither of these are sufficient, you can manually specify the context length by using hte `"contextLength"` property in your model in config.json.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "My Custom Model",
|
||||
"provider": "openai",
|
||||
"model": "my-model",
|
||||
"contextLength": 8192,
|
||||
"apiBase": "http://localhost:8000/v1"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Customizing the Chat Template
|
||||
|
||||
Most open-source models expect a specific chat format, for example llama2 and codellama expect the input to look like `"[INST] How do I write bubble sort in Rust? [/INST]"`. Continue will automatically attempt to detect the correct prompt format based on the `model`value that you provide, but if you are receiving nonsense responses, you can use the `template` property to explicitly set the format that you expect. The options are: `["llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml", "openchat", "neural-chat", "none"]`.
|
||||
|
||||
If you want to create an entirely new chat template, this can be done in [config.ts](../customization/code-config.md) by defining a function and adding it to the `templateMessages` property of your `LLM`. Here is an example of `templateMessages` for the Alpaca/Vicuna format:
|
||||
|
||||
```typescript
|
||||
function templateAlpacaMessages(msgs: ChatMessage[]): string {
|
||||
let prompt = "";
|
||||
|
||||
if (msgs[0].role === "system") {
|
||||
prompt += `${msgs[0].content}\n`;
|
||||
msgs.pop(0);
|
||||
}
|
||||
|
||||
prompt += "### Instruction:\n";
|
||||
for (let msg of msgs) {
|
||||
prompt += `${msg.content}\n`;
|
||||
}
|
||||
|
||||
prompt += "### Response:\n";
|
||||
|
||||
return prompt;
|
||||
}
|
||||
```
|
||||
|
||||
It can then be used like this:
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
function modifyConfig(config: Config): Config {
|
||||
const model = config.models.find(
|
||||
(model) => model.title === "My Alpaca Model",
|
||||
);
|
||||
if (model) {
|
||||
model.templateMessages = templateAlpacaMessages;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
```
|
||||
|
||||
This exact function and a few other default implementations are available in [`core/llm/templates/chat.ts`](https://github.com/continuedev/continue/blob/main/core/llm/templates/chat.ts).
|
||||
|
||||
## Customizing the /edit Prompt
|
||||
|
||||
You also have access to customize the prompt used in the '/edit' slash command. We already have a well-engineered prompt for GPT-4 and sensible defaults for less powerful open-source models, but you might wish to play with the prompt and try to find a more reliable alternative if you are for example getting English as well as code in your output.
|
||||
|
||||
To customize the prompt, use the `promptTemplates` property of any model, which is a dictionary, and set the "edit" key to a template string with Mustache syntax. The 'filePrefix', 'fileSuffix', 'codeToEdit', 'language', 'contextItems', and 'userInput' variables are available in the template. Here is an example of how it can be set in `config.ts`:
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
const codellamaEditPrompt = `\`\`\`{{{language}}}
|
||||
{{{codeToEdit}}}
|
||||
\`\`\`
|
||||
[INST] You are an expert programmer and personal assistant. Your task is to rewrite the above code with these instructions: "{{{userInput}}}"
|
||||
|
||||
Your answer should be given inside of a code block. It should use the same kind of indentation as above.
|
||||
[/INST] Sure! Here's the rewritten code you requested:
|
||||
\`\`\`{{{language}}}`;
|
||||
|
||||
function modifyConfig(config: Config): Config {
|
||||
config.models[0].promptTemplates["edit"] = codellamaEditPrompt;
|
||||
return config;
|
||||
}
|
||||
```
|
||||
|
||||
You can find all existing templates for /edit in [`core/llm/templates/edit.ts`](https://github.com/continuedev/continue/blob/main/core/llm/templates/edit.ts).
|
||||
|
||||
## Defining a Custom LLM Provider
|
||||
|
||||
If you are using an LLM API that isn't already [supported by Continue](./model-providers.md), and is not an OpenAI-compatible API, you'll need to define a `CustomLLM` object in `config.ts`. This object only requires one of (or both of) a `streamComplete` or `streamChat` function. Here is an example:
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
export function modifyConfig(config: Config): Config {
|
||||
config.models.push({
|
||||
options: {
|
||||
title: "My Custom LLM",
|
||||
model: "mistral-7b",
|
||||
},
|
||||
streamCompletion: async function* (
|
||||
prompt: string,
|
||||
options: CompletionOptions,
|
||||
fetch,
|
||||
) {
|
||||
// Make the API call here
|
||||
|
||||
// Then yield each part of the completion as it is streamed
|
||||
// This is a toy example that will count to 10
|
||||
for (let i = 0; i < 10; i++) {
|
||||
yield `- ${i}\n`;
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
}
|
||||
},
|
||||
});
|
||||
return config;
|
||||
}
|
||||
```
|
||||
|
||||
## Customizing the LLM capability
|
||||
|
||||
Sometimes when you use certain third-party interface providers, such as [one api](https://github.com/songquanpeng/one-api), [openRouter](https://openrouter.ai/), etc., they offer openai-compatible interfaces, but the model names are highly different.
|
||||
|
||||
Continue cannot determine the capabilities of the model, whether it supports uploading images or files, etc. You can clearly inform Continue about the capabilities of the model.
|
||||
|
||||
```typescript title="~/.continue/config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "kimi",
|
||||
"provider": "openai",
|
||||
"model": "moonshot-kimi",
|
||||
"contextLength": 8192,
|
||||
"apiBase": "https://any-your-thrid-part-OpenAI-compatible-api-provider/v1",
|
||||
"capabilities": {
|
||||
"uploadImage": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
---
|
||||
title: Model Providers
|
||||
description: Configure and integrate various LLM (Large Language Model) providers for chat, autocomplete, and embedding models, whether self-hosted, remote, or via SaaS.
|
||||
keywords:
|
||||
[
|
||||
large language models,
|
||||
LLM providers,
|
||||
open-source LLM,
|
||||
commercial LLM,
|
||||
self-hosted LLM,
|
||||
remote LLM,
|
||||
SaaS LLM,
|
||||
AI model configuration,
|
||||
AI providers,
|
||||
OpenAI,
|
||||
Anthropic,
|
||||
Gemini,
|
||||
Ollama,
|
||||
HuggingFace,
|
||||
Amazon Bedrock,
|
||||
Amazon SageMaker,
|
||||
]
|
||||
---
|
||||
|
||||
Configure and integrate various LLM (Large Language Model) providers for chat, autocomplete, and embedding models, whether self-hosted, remote, or via SaaS.
|
||||
|
||||
To select the ones you want to use, add them to your `config.json`.
|
||||
|
||||
## Self-hosted
|
||||
|
||||
### Local
|
||||
|
||||
You can run a model on your local computer using:
|
||||
|
||||
- [Ollama](../reference/Model%20Providers/ollama.md)
|
||||
- [LM Studio](../reference/Model%20Providers/lmstudio.md)
|
||||
- [Llama.cpp](../reference/Model%20Providers/llamacpp.md)
|
||||
- [KoboldCpp](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
- [llamafile](../reference/Model%20Providers/llamafile) (OpenAI compatible server)
|
||||
- [LocalAI](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
- [Text generation web UI](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
- [FastChat](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
- [llama-cpp-python](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples) (OpenAI compatible server)
|
||||
- [IPEX-LLM](../reference/Model%20Providers/ipex_llm.md) (Local LLM on Intel GPU)
|
||||
- [Msty](../reference/Model%20Providers/msty.md)
|
||||
- [IBM watsonx](../reference/Model%20Providers/watsonx.md)
|
||||
- [Nvidia NIMS](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
|
||||
### Remote
|
||||
|
||||
You can deploy a model in your [AWS](https://github.com/continuedev/deploy-os-code-llm#aws), [GCP](https://github.com/continuedev/deploy-os-code-llm#gcp), [Azure](https://github.com/continuedev/deploy-os-code-llm#azure), [Lambda](https://lambdalabs.com/), or [other clouds](https://github.com/continuedev/deploy-os-code-llm#others-2) using:
|
||||
|
||||
- [HuggingFace TGI](https://github.com/continuedev/deploy-os-code-llm#tgi)
|
||||
- [vLLM](https://github.com/continuedev/deploy-os-code-llm#vllm)
|
||||
- [SkyPilot](https://github.com/continuedev/deploy-os-code-llm#skypilot)
|
||||
- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) (OpenAI compatible API)
|
||||
- [Lambda](https://github.com/continuedev/deploy-os-code-llm#lambda)
|
||||
|
||||
## SaaS
|
||||
|
||||
### Open-source and commercial models
|
||||
|
||||
You can access both open-source and commercial LLMs via:
|
||||
|
||||
- [OpenRouter](../reference/Model%20Providers/openrouter.md)
|
||||
- [Kindo](../reference/Model%20Providers/kindo.md)
|
||||
- [Nvidia NIMS](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
|
||||
### Open-source models
|
||||
|
||||
You can run open-source LLMs with cloud services like:
|
||||
|
||||
- [Codestral API](../walkthroughs/set-up-codestral.md)
|
||||
- [Together](../reference/Model%20Providers/togetherllm.md)
|
||||
- [HuggingFace Inference Endpoints](../reference/Model%20Providers/huggingfaceinferenceapi.md)
|
||||
- [Anyscale Endpoints](../reference/Model%20Providers/openai.md) (OpenAI compatible API)
|
||||
- [Replicate](../reference/Model%20Providers/replicatellm.md)
|
||||
- [Deepinfra](../reference/Model%20Providers/deepinfra.md)
|
||||
- [Groq](../reference/Model%20Providers/openai.md) (OpenAI compatible API)
|
||||
|
||||
### Commercial models
|
||||
|
||||
You can use commercial LLMs via APIs using:
|
||||
|
||||
- [Anthrophic API](../reference/Model%20Providers/anthropicllm.md)
|
||||
- [OpenAI API](../reference/Model%20Providers/openai.md)
|
||||
- [Azure OpenAI Service](../reference/Model%20Providers/openai.md)
|
||||
- [Amazon Bedrock](../reference/Model%20Providers/bedrock.md)
|
||||
- [Google Gemini API](../reference/Model%20Providers/geminiapi.md)
|
||||
- [Mistral API](../reference/Model%20Providers/mistral.md)
|
||||
- [Voyage AI API](../features/codebase-embeddings.md#openai)
|
||||
- [Cohere API](../reference/Model%20Providers/cohere.md)
|
||||
|
||||
**In addition to selecting providers, you will need to figure out [what models to use](./select-model.md).**
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
---
|
||||
title: Overview
|
||||
description: Get started with Continue and tailor it to your needs
|
||||
keywords: [setup, customization, models, configuration, LLMs]
|
||||
---
|
||||
|
||||
# Overview
|
||||
|
||||
Continue is a flexible AI coding assistant that allows you to choose and customize your Large Language Models (LLMs). This guide will help you get started and make Continue work best for you.
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. When you first install Continue, you can use it immediately with our free proxy server.
|
||||
2. As you get familiar with Continue, you can set up your own API keys and customize your experience.
|
||||
|
||||
## Choosing Your Models
|
||||
|
||||
Continue works with a variety of LLMs:
|
||||
|
||||
- Commercial models (e.g., Claude 3 Opus via Anthropic API)
|
||||
- Open-source models (e.g., Llama 3 running locally with Ollama)
|
||||
- And many options in between
|
||||
|
||||
You'll need to select models for three main functions:
|
||||
|
||||
- [Chat](select-model.md#chat)
|
||||
- [Autocomplete](select-model.md#autocomplete)
|
||||
- [Embeddings](select-model.md#embeddings)
|
||||
|
||||
## Customization Options
|
||||
|
||||
Continue offers deep customization through `config.json` and `config.ts` files. These are located in:
|
||||
|
||||
- MacOS: `~/.continue/`
|
||||
- Windows: `%userprofile%\.continue`
|
||||
|
||||
You can customize:
|
||||
|
||||
1. [Basic Configuration](configuration.md)
|
||||
2. [Model Providers](model-providers.md)
|
||||
3. [Model Selection](select-model.md)
|
||||
4. [Context Providers](../customization/context-providers.md)
|
||||
5. [Slash Commands](../customization/slash-commands.md)
|
||||
6. [Advanced Options](../reference/config.mdx)
|
||||
|
||||
## Sharing Your Configuration
|
||||
|
||||
To share your Continue setup with a team:
|
||||
|
||||
1. Create a `.continuerc.json` file in your project's root directory.
|
||||
2. Use the same JSON Schema as `config.json`.
|
||||
3. This file will automatically apply on top of the local `config.json`.
|
||||
|
||||
Get started with Continue today and shape it to fit your coding workflow perfectly!
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
---
|
||||
title: Select models
|
||||
description: Configure LLMs
|
||||
keywords: [llama-3, gpt-4, claude-3, gemini-pro, deepseek]
|
||||
---
|
||||
|
||||
# Select models
|
||||
|
||||
Continue makes it easy to use different models for chat, autocomplete, and embeddings. To select the models you want to use, add them to your `config.json`.
|
||||
|
||||
## Chat
|
||||
|
||||
You likely want to use a model that is 30B+ parameters for chat.
|
||||
|
||||
### Open-source LLMs
|
||||
|
||||
_We currently recommend the following open-source models:_
|
||||
|
||||
#### Llama 3 from Meta
|
||||
|
||||
- Unlimited GPU: `llama3-70b`
|
||||
- Limited GPU: `llama3-8B`
|
||||
|
||||
#### DeepSeek Coder v2 from DeepSeek
|
||||
|
||||
- Unlimited GPU: `deepseek-coder-v2:236b`
|
||||
- Limited GPU: `deepseek-coder-v2:16b`
|
||||
|
||||
_You can also use other open-source chat models by adding them to your `config.json`._
|
||||
|
||||
### Commercial LLMs
|
||||
|
||||
#### Claude 3 from Anthropic
|
||||
|
||||
- Unlimited budget: `claude-3-5-sonnet-20240620`
|
||||
- Limited budget: `claude-3-5-sonnet-20240620`
|
||||
|
||||
#### GPT-4o from OpenAI
|
||||
|
||||
- Unlimited budget: `gpt-4o`
|
||||
- Limited budget: `gpt-4o-mini`
|
||||
|
||||
#### Gemini Pro from Google
|
||||
|
||||
- Unlimited budget: `gemini-pro-1.5-latest`
|
||||
- Limited budget: `gemini-flash-1.5-latest` or `gemini-pro-1.0`
|
||||
|
||||
_You can also use other commercial chat models by adding them to your `config.json`._
|
||||
|
||||
## Autocomplete
|
||||
|
||||
You likely want to use a model that is 1-15B parameters for autocomplete. You can read more about it [here](../features/tab-autocomplete.md)
|
||||
|
||||
### Commercial LLMs
|
||||
|
||||
#### Codestral from Mistral
|
||||
|
||||
Our current recommendation for autocomplete, if you are able to choose any model, is `codestral-latest` from [Mistral's API](../walkthroughs/set-up-codestral.md).
|
||||
|
||||
### Open-source LLMs
|
||||
|
||||
_We currently recommend the following open-source models:_
|
||||
|
||||
#### DeepSeek Coder v2 from DeepSeek
|
||||
|
||||
- Unlimited GPU: `deepseek-coder-v2:16b`
|
||||
- Limited GPU: `deepseek-coder:6.7b` or `deepseek-coder:1.3b`
|
||||
|
||||
#### StarCoder 2 from Hugging Face
|
||||
|
||||
- Unlimited GPU: `starcoder-2-7b`
|
||||
- Limited GPU: `starcoder-2-3b`
|
||||
|
||||
_You can also use other autocomplete models by adding them to your `config.json`._
|
||||
|
||||
## Embeddings
|
||||
|
||||
We recommend the following embeddings models, which are used for codebase retrieval as described [here](../features/codebase-embeddings.md#embeddings-providers)
|
||||
|
||||
### Open-source models
|
||||
|
||||
- `nomic-embed-text`
|
||||
|
||||
### Commercial models
|
||||
|
||||
- `voyage-code-2`
|
||||
|
||||
_You can also use other embeddings models by adding them to your `config.json`._
|
||||
|
||||
**In addition to selecting models, you will need to figure out [what model providers to use](./model-providers.md).**
|
||||
|
|
@ -69,7 +69,7 @@ const config = {
|
|||
// Replace with your project's social card
|
||||
image: "https://docs.continue.dev/img/continue-social-card.png",
|
||||
navbar: {
|
||||
title: "Continue",
|
||||
title: "Continue Docs",
|
||||
logo: {
|
||||
alt: "Continue Logo",
|
||||
src: "img/logo.png",
|
||||
|
|
@ -78,15 +78,10 @@ const config = {
|
|||
items: [
|
||||
{
|
||||
type: "docSidebar",
|
||||
sidebarId: "docsSidebar",
|
||||
sidebarId: "customizingSidebar",
|
||||
position: "left",
|
||||
label: "Docs",
|
||||
},
|
||||
{
|
||||
type: "docSidebar",
|
||||
sidebarId: "referenceSidebar",
|
||||
position: "left",
|
||||
label: "Reference",
|
||||
label: "Customizing",
|
||||
href: "/customizing",
|
||||
},
|
||||
{
|
||||
to: "https://github.com/continuedev/continue",
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
const sidebars = {
|
||||
docsSidebar: [
|
||||
{
|
||||
type: "doc",
|
||||
id: "docs/introduction",
|
||||
},
|
||||
"docs/introduction",
|
||||
{
|
||||
type: "category",
|
||||
label: "Getting started",
|
||||
|
|
@ -21,6 +18,10 @@ const sidebars = {
|
|||
{
|
||||
type: "category",
|
||||
label: "Chat",
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "docs/chat/how-to-use-it",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
|
|
@ -31,6 +32,10 @@ const sidebars = {
|
|||
{
|
||||
type: "category",
|
||||
label: "Autocomplete",
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "docs/autocomplete/how-to-use-it",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
|
|
@ -41,6 +46,10 @@ const sidebars = {
|
|||
{
|
||||
type: "category",
|
||||
label: "Edit",
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "docs/edit/how-to-use-it",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
|
|
@ -51,6 +60,10 @@ const sidebars = {
|
|||
{
|
||||
type: "category",
|
||||
label: "Actions",
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "docs/actions/how-to-use-them",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
|
|
@ -58,70 +71,65 @@ const sidebars = {
|
|||
},
|
||||
],
|
||||
},
|
||||
"docs/context-providers",
|
||||
"docs/slash-commands",
|
||||
"docs/development-data",
|
||||
"docs/telemetry",
|
||||
"docs/troubleshooting",
|
||||
{
|
||||
type: "link",
|
||||
label: "Customizing",
|
||||
href: "/customizing",
|
||||
},
|
||||
],
|
||||
referenceSidebar: [
|
||||
"reference/config",
|
||||
customizingSidebar: [
|
||||
{
|
||||
type: "category",
|
||||
label: "Set up",
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "reference/setup",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "LLM providers",
|
||||
label: "Model providers",
|
||||
collapsed: false,
|
||||
link: {
|
||||
type: "generated-index",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "reference/llm-providers",
|
||||
dirName: "customizing/model-providers/top-level",
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "More",
|
||||
link: {
|
||||
type: "generated-index",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "customizing/model-providers/more",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "Embeddings providers",
|
||||
label: "Model types",
|
||||
link: {
|
||||
type: "generated-index",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "reference/embeddings-providers",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "Reranking providers",
|
||||
link: {
|
||||
type: "generated-index",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "reference/reranking-providers",
|
||||
dirName: "customizing/model-types",
|
||||
},
|
||||
],
|
||||
},
|
||||
"customizing/context-providers",
|
||||
"customizing/slash-commands",
|
||||
"customizing/development-data",
|
||||
{
|
||||
type: "category",
|
||||
label: "Deep dives",
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "reference/deep-dives",
|
||||
dirName: "customizing/deep-dives",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -131,11 +139,12 @@ const sidebars = {
|
|||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "reference/guides",
|
||||
dirName: "customizing/guides",
|
||||
},
|
||||
],
|
||||
},
|
||||
"reference/changelog",
|
||||
"customizing/config",
|
||||
"customizing/changelog",
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
|||
22
docs/src/components/RecommendedModels.jsx
Normal file
22
docs/src/components/RecommendedModels.jsx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export default function RecommendedModels({ isLocal }) {
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<h2>Recommended chat model</h2>
|
||||
<p>Test</p>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Recommended autocomplete model</h2>
|
||||
<p>Test</p>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Recommended embeddings model</h2>
|
||||
<p>Test</p>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Recommended reranking model</h2>
|
||||
<p>Test</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
3
docs/static/schemas/config.json
vendored
3
docs/static/schemas/config.json
vendored
|
|
@ -972,7 +972,8 @@
|
|||
"open-mixtral-8x7b",
|
||||
"open-mixtral-8x22b",
|
||||
"mistral-small-latest",
|
||||
"mistral-large-latest"
|
||||
"mistral-large-latest",
|
||||
"mistral-embed"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue