Merge branch 'dev' into nate/lazy-edit
This commit is contained in:
commit
191a38c8fb
325 changed files with 6962 additions and 8244 deletions
3
.changes/extensions/vscode/0.8.51.md
Normal file
3
.changes/extensions/vscode/0.8.51.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
## 0.8.51 - 2024-09-05
|
||||
### Fixed
|
||||
* Fixed CRLF bug causing diff streams to treat every line as changed on Windows
|
||||
15
.changes/extensions/vscode/0.9.210.md
Normal file
15
.changes/extensions/vscode/0.9.210.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
## 0.9.210 - 2024-09-15
|
||||
|
||||
### Added
|
||||
|
||||
- NVIDIA NIMs embeddings provider
|
||||
- SambaNova LLM Provider
|
||||
- Support for OpenAI's new o1-preview and o1-mini models
|
||||
|
||||
### Changed
|
||||
|
||||
- Use Chromium only as a fallback after asking user
|
||||
|
||||
### Fixed
|
||||
|
||||
- Increased default maxTokens, and autodetect for common models
|
||||
4
.changes/unreleased/Added-20240915-163755.yaml
Normal file
4
.changes/unreleased/Added-20240915-163755.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
project: extensions/intellij
|
||||
kind: Added
|
||||
body: Support for the "search" context provider
|
||||
time: 2024-09-15T16:37:55.460922-07:00
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
project: extensions/vscode
|
||||
kind: Changed
|
||||
body: Use Chromium only as a fallback after asking user
|
||||
time: 2024-09-05T13:08:13.018136-07:00
|
||||
4
.changes/unreleased/Fixed-20240915-163641.yaml
Normal file
4
.changes/unreleased/Fixed-20240915-163641.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
project: extensions/intellij
|
||||
kind: Fixed
|
||||
body: Fixed bug where only first module would be recognized
|
||||
time: 2024-09-15T16:36:41.899428-07:00
|
||||
27
.github/workflows/main.yaml
vendored
27
.github/workflows/main.yaml
vendored
|
|
@ -163,7 +163,7 @@ jobs:
|
|||
# 6. Upload the .vsix as an artifact
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.target }}
|
||||
name: ${{ env.target }}-vsix
|
||||
path: "extensions/vscode/*.vsix"
|
||||
|
||||
release:
|
||||
|
|
@ -182,21 +182,18 @@ jobs:
|
|||
git config --local user.name "GitHub Action"
|
||||
|
||||
# Download the .vsix artifacts
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: "*-vsix"
|
||||
path: vsix-artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
files: |
|
||||
alpine-x64/*.vsix
|
||||
darwin-arm64/*.vsix
|
||||
darwin-x64/*.vsix
|
||||
linux-arm64/*.vsix
|
||||
linux-armhf/*.vsix
|
||||
linux-x64/*.vsix
|
||||
win32-x64/*.vsix
|
||||
win32-arm64/*.vsix
|
||||
vsix-artifacts/*.vsix
|
||||
token: ${{ secrets.CI_GITHUB_TOKEN }}
|
||||
repository: continuedev/continue
|
||||
|
||||
|
|
@ -220,13 +217,17 @@ jobs:
|
|||
run: git pull origin main
|
||||
|
||||
# 1. Download the artifacts
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: "*-vsix"
|
||||
path: vsix-artifacts
|
||||
merge-multiple: true
|
||||
|
||||
# 2. Publish the extension to VS Code Marketplace
|
||||
- name: Publish to VS Code Marketplace
|
||||
run: |
|
||||
cd extensions/vscode
|
||||
npx vsce publish --packagePath ../../alpine-x64/*.vsix ../../darwin-arm64/*.vsix ../../darwin-x64/*.vsix ../../linux-arm64/*.vsix ../../linux-armhf/*.vsix ../../linux-x64/*.vsix ../../win32-x64/*.vsix ../../win32-arm64/*.vsix
|
||||
npx vsce publish --packagePath ../../vsix-artifacts/*.vsix
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
|
||||
|
||||
|
|
@ -235,7 +236,7 @@ jobs:
|
|||
continue-on-error: true
|
||||
run: |
|
||||
cd extensions/vscode
|
||||
npx ovsx publish -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../alpine-x64/*.vsix ../../darwin-arm64/*.vsix ../../darwin-x64/*.vsix ../../linux-arm64/*.vsix ../../linux-armhf/*.vsix ../../linux-x64/*.vsix ../../win32-x64/*.vsix ../../win32-arm64/*.vsix
|
||||
npx ovsx publish -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix
|
||||
|
||||
# 4. Update the package.json version and push changes
|
||||
# - name: Update version in package.json
|
||||
|
|
|
|||
27
.github/workflows/preview.yaml
vendored
27
.github/workflows/preview.yaml
vendored
|
|
@ -158,7 +158,7 @@ jobs:
|
|||
# 6. Upload the .vsix as an artifact
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.target }}
|
||||
name: ${{ env.target }}-vsix
|
||||
path: "extensions/vscode/*.vsix"
|
||||
|
||||
release:
|
||||
|
|
@ -177,21 +177,18 @@ jobs:
|
|||
git config --local user.name "GitHub Action"
|
||||
|
||||
# Download the .vsix artifacts
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: "*-vsix"
|
||||
path: vsix-artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
files: |
|
||||
alpine-x64/*.vsix
|
||||
darwin-arm64/*.vsix
|
||||
darwin-x64/*.vsix
|
||||
linux-arm64/*.vsix
|
||||
linux-armhf/*.vsix
|
||||
linux-x64/*.vsix
|
||||
win32-x64/*.vsix
|
||||
win32-arm64/*.vsix
|
||||
vsix-artifacts/*.vsix
|
||||
token: ${{ secrets.CI_GITHUB_TOKEN }}
|
||||
repository: continuedev/continue
|
||||
prerelease: true
|
||||
|
|
@ -216,13 +213,17 @@ jobs:
|
|||
run: git pull origin dev
|
||||
|
||||
# 1. Download the artifacts
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: "*-vsix"
|
||||
path: vsix-artifacts
|
||||
merge-multiple: true
|
||||
|
||||
# 2. Publish the extension to VS Code Marketplace
|
||||
- name: Publish to VS Code Marketplace
|
||||
run: |
|
||||
cd extensions/vscode
|
||||
npx vsce publish --pre-release --packagePath ../../alpine-x64/*.vsix ../../darwin-arm64/*.vsix ../../darwin-x64/*.vsix ../../linux-arm64/*.vsix ../../linux-armhf/*.vsix ../../linux-x64/*.vsix ../../win32-x64/*.vsix ../../win32-arm64/*.vsix
|
||||
npx vsce publish --pre-release --packagePath ../../vsix-artifacts/*.vsix
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
|
||||
|
||||
|
|
@ -231,7 +232,7 @@ jobs:
|
|||
continue-on-error: true
|
||||
run: |
|
||||
cd extensions/vscode
|
||||
npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../alpine-x64/*.vsix ../../darwin-arm64/*.vsix ../../darwin-x64/*.vsix ../../linux-arm64/*.vsix ../../linux-armhf/*.vsix ../../linux-x64/*.vsix ../../win32-x64/*.vsix ../../win32-arm64/*.vsix
|
||||
npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix
|
||||
|
||||
# 4. Update the package.json version and push changes
|
||||
# - name: Update version in package.json
|
||||
|
|
|
|||
46
README.md
46
README.md
|
|
@ -26,55 +26,35 @@
|
|||
|
||||
<p></p>
|
||||
|
||||
## Easily understand code sections
|
||||
## Chat
|
||||
|
||||

|
||||
[Chat](https://continue.dev/docs/chat/how-to-use-it) makes it easy to ask for help from an LLM without needing to leave the IDE
|
||||
|
||||
VS Code: `cmd+L` (MacOS) / `ctrl+L` (Windows)
|
||||

|
||||
|
||||
JetBrains: `cmd+J` (MacOS) / `ctrl+J` (Windows)
|
||||
## Autocomplete
|
||||
|
||||
## Tab to autocomplete code suggestions
|
||||
[Autocomplete](https://continue.dev/docs/autocomplete/how-to-use-it) provides inline code suggestions as you type
|
||||
|
||||

|
||||
|
||||
VS Code: `tab` (MacOS) / `tab` (Windows)
|
||||
## Edit
|
||||
|
||||
JetBrains: `tab` (MacOS) / `tab` (Windows)
|
||||
[Edit](https://continue.dev/docs/edit/how-to-use-it) is a convenient way to modify code without leaving your current file
|
||||
|
||||
## Refactor functions where you are coding
|
||||

|
||||
|
||||

|
||||
## Actions
|
||||
|
||||
VS Code: `cmd+I` (MacOS) / `ctrl+I` (Windows)
|
||||
[Actions](https://continue.dev/docs/actions/how-to-use-it) are shortcuts for common use cases.
|
||||
|
||||
JetBrains: `cmd+I` (MacOS) / `ctrl+I` (Windows)
|
||||
|
||||
## Ask questions about your codebase
|
||||
|
||||

|
||||
|
||||
VS Code: `cmd+enter` (MacOS) / `ctrl+enter` (Windows)
|
||||
|
||||
JetBrains: `cmd+enter` (MacOS) / `ctrl+enter` (Windows)
|
||||
|
||||
## Quickly use documentation as context
|
||||
|
||||

|
||||
|
||||
VS Code: `@docs` (MacOS) / `@docs` (Windows)
|
||||
|
||||
JetBrains: `@docs` (MacOS) / `@docs` (Windows)
|
||||

|
||||
|
||||
</div>
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Download for [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)
|
||||
|
||||
You can try out Continue with our free trial models before configuring your setup.
|
||||
|
||||
Learn more about the models and providers [here](https://continue.dev/docs/setup/overview).
|
||||
Learn about how to install and use Continue in the docs [here](https://continue.dev/docs/getting-started)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
@ -82,4 +62,4 @@ Check out the [contribution ideas board](https://github.com/orgs/continuedev/pro
|
|||
|
||||
## License
|
||||
|
||||
[Apache 2.0 © 2023 Continue Dev, Inc.](./LICENSE)
|
||||
[Apache 2.0 © 2023 Continue Dev, Inc.](./LICENSE)
|
||||
2
binary/package-lock.json
generated
2
binary/package-lock.json
generated
|
|
@ -48,7 +48,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.10",
|
||||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ You can also set up tab-autocomplete with a local LM Studio instance by followin
|
|||
|
||||
Example:
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Starcoder2 3b",
|
||||
|
|
@ -40,7 +40,7 @@ Example:
|
|||
|
||||
All of the configuration options available for chat models are available to use for tab-autocomplete. For example, if you wanted to use a remote vLLM instance you would edit your `config.json` like this (note that it is not inside the models array), filling in the correct model name and vLLM endpoint:
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
|
|
@ -54,7 +54,7 @@ All of the configuration options available for chat models are available to use
|
|||
|
||||
As another example, say you want to use a different model, `deepseek-coder:6.7b-base`, with Ollama:
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
|
|
@ -100,7 +100,7 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
|
|||
|
||||
### Full example
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
|
|
|
|||
|
|
@ -311,10 +311,17 @@ export class CompletionProvider {
|
|||
|
||||
// Get completion
|
||||
const llm = await this.getLlm();
|
||||
|
||||
if (!llm) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Ignore empty API keys for Mistral since we currently write
|
||||
// a template provider without one during onboarding
|
||||
if (llm.providerName === "mistral" && llm.apiKey === "") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Set temperature (but don't overrride)
|
||||
if (llm.completionOptions.temperature === undefined) {
|
||||
llm.completionOptions.temperature = 0.01;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,13 @@ import {
|
|||
IdeSettings,
|
||||
ILLM,
|
||||
} from "../index.js";
|
||||
import Ollama from "../llm/llms/Ollama.js";
|
||||
import { GlobalContext } from "../util/GlobalContext.js";
|
||||
import { finalToBrowserConfig } from "./load.js";
|
||||
import {
|
||||
LOCAL_ONBOARDING_CHAT_MODEL,
|
||||
ONBOARDING_LOCAL_MODEL_TITLE,
|
||||
} from "./onboarding.js";
|
||||
import ControlPlaneProfileLoader from "./profile/ControlPlaneProfileLoader.js";
|
||||
import { IProfileLoader } from "./profile/IProfileLoader.js";
|
||||
import LocalProfileLoader from "./profile/LocalProfileLoader.js";
|
||||
|
|
@ -279,9 +284,18 @@ export class ConfigHandler {
|
|||
|
||||
async llmFromTitle(title?: string): Promise<ILLM> {
|
||||
const config = await this.loadConfig();
|
||||
const model =
|
||||
config.models.find((m) => m.title === title) || config.models[0];
|
||||
const model = config.models.find((m) => m.title === title);
|
||||
if (!model) {
|
||||
if (title === ONBOARDING_LOCAL_MODEL_TITLE) {
|
||||
// Special case, make calls to Ollama before we have it in the config
|
||||
const ollama = new Ollama({
|
||||
model: LOCAL_ONBOARDING_CHAT_MODEL,
|
||||
});
|
||||
return ollama;
|
||||
} else if (config.models.length > 0) {
|
||||
return config.models[0];
|
||||
}
|
||||
|
||||
throw new Error("No model found");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,28 @@ import {
|
|||
ModelDescription,
|
||||
SerializedContinueConfig,
|
||||
SlashCommandDescription,
|
||||
} from "../index.js";
|
||||
} from "../";
|
||||
|
||||
export const DEFAULT_CHAT_MODEL_CONFIG: ModelDescription = {
|
||||
model: "claude-3-5-sonnet-20240620",
|
||||
provider: "anthropic",
|
||||
apiKey: "",
|
||||
title: "Claude 3.5 Sonnet",
|
||||
};
|
||||
|
||||
export const DEFAULT_AUTOCOMPLETE_MODEL_CONFIG: ModelDescription = {
|
||||
title: "Codestral",
|
||||
provider: "mistral",
|
||||
model: "codestral-latest",
|
||||
apiKey: "",
|
||||
};
|
||||
|
||||
export const FREE_TRIAL_MODELS: ModelDescription[] = [
|
||||
{
|
||||
title: "Claude 3 Sonnet (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "claude-3-sonnet-20240229",
|
||||
},
|
||||
{
|
||||
title: "GPT-4o (Free Trial)",
|
||||
provider: "free-trial",
|
||||
|
|
@ -25,11 +44,6 @@ export const FREE_TRIAL_MODELS: ModelDescription[] = [
|
|||
provider: "free-trial",
|
||||
model: "codestral",
|
||||
},
|
||||
{
|
||||
title: "Claude 3 Sonnet (Free Trial)",
|
||||
provider: "free-trial",
|
||||
model: "claude-3-sonnet-20240229",
|
||||
},
|
||||
];
|
||||
|
||||
export const defaultContextProvidersVsCode: ContextProviderWithParams[] = [
|
||||
|
|
@ -91,7 +105,8 @@ export const defaultSlashCommandsJetBrains = [
|
|||
];
|
||||
|
||||
export const defaultConfig: SerializedContinueConfig = {
|
||||
models: [],
|
||||
models: [DEFAULT_CHAT_MODEL_CONFIG],
|
||||
tabAutocompleteModel: DEFAULT_AUTOCOMPLETE_MODEL_CONFIG,
|
||||
customCommands: [
|
||||
{
|
||||
name: "test",
|
||||
|
|
@ -100,17 +115,13 @@ export const defaultConfig: SerializedContinueConfig = {
|
|||
description: "Write unit tests for highlighted code",
|
||||
},
|
||||
],
|
||||
tabAutocompleteModel: {
|
||||
title: "Starcoder2 3b",
|
||||
provider: "ollama",
|
||||
model: "starcoder2:3b",
|
||||
},
|
||||
contextProviders: defaultContextProvidersVsCode,
|
||||
slashCommands: defaultSlashCommandsVscode,
|
||||
};
|
||||
|
||||
export const defaultConfigJetBrains: SerializedContinueConfig = {
|
||||
models: FREE_TRIAL_MODELS,
|
||||
models: [DEFAULT_CHAT_MODEL_CONFIG],
|
||||
tabAutocompleteModel: DEFAULT_AUTOCOMPLETE_MODEL_CONFIG,
|
||||
customCommands: [
|
||||
{
|
||||
name: "test",
|
||||
|
|
@ -119,11 +130,6 @@ export const defaultConfigJetBrains: SerializedContinueConfig = {
|
|||
description: "Write unit tests for highlighted code",
|
||||
},
|
||||
],
|
||||
tabAutocompleteModel: {
|
||||
title: "Starcoder2 3b",
|
||||
provider: "ollama",
|
||||
model: "starcoder2:3b",
|
||||
},
|
||||
contextProviders: defaultContextProvidersJetBrains,
|
||||
slashCommands: defaultSlashCommandsJetBrains,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ async function intermediateToFinalConfig(
|
|||
(model) => model.providerName === "free-trial",
|
||||
);
|
||||
if (freeTrialModels.length > 0) {
|
||||
const ghAuthToken = await ide.getGitHubAuthToken();
|
||||
const ghAuthToken = await ide.getGitHubAuthToken({});
|
||||
for (const model of freeTrialModels) {
|
||||
(model as FreeTrial).setupGhAuthToken(ghAuthToken);
|
||||
}
|
||||
|
|
@ -341,7 +341,7 @@ async function intermediateToFinalConfig(
|
|||
// This shouldn't happen
|
||||
throw new Error("Free trial cannot be used with control plane");
|
||||
}
|
||||
const ghAuthToken = await ide.getGitHubAuthToken();
|
||||
const ghAuthToken = await ide.getGitHubAuthToken({});
|
||||
(llm as FreeTrial).setupGhAuthToken(ghAuthToken);
|
||||
}
|
||||
return llm;
|
||||
|
|
|
|||
|
|
@ -1,56 +1,51 @@
|
|||
import { SerializedContinueConfig } from "../index.js";
|
||||
import { FREE_TRIAL_MODELS } from "./default.js";
|
||||
import { SerializedContinueConfig } from "../";
|
||||
import { FREE_TRIAL_MODELS } from "./default";
|
||||
|
||||
export const TRIAL_FIM_MODEL = "codestral-latest";
|
||||
export const ONBOARDING_LOCAL_MODEL_TITLE = "Ollama";
|
||||
export const LOCAL_ONBOARDING_FIM_MODEL = "starcoder2:3b";
|
||||
export const LOCAL_ONBOARDING_CHAT_MODEL = "llama3.1:8b";
|
||||
export const LOCAL_ONBOARDING_CHAT_TITLE = "Llama 3.1 8B";
|
||||
|
||||
export function setupApiKeysMode(
|
||||
/**
|
||||
* We set the "best" chat + autocopmlete models by default
|
||||
* whenever a user doesn't have a config.json
|
||||
*/
|
||||
export function setupBestConfig(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
...config,
|
||||
models: config.models.filter((model) => model.provider !== "free-trial"),
|
||||
embeddingsProvider: {
|
||||
provider: "free-trial",
|
||||
},
|
||||
reranker: {
|
||||
name: "free-trial",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function setupLocalMode(
|
||||
export function setupLocalConfig(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
...config,
|
||||
models: [
|
||||
{
|
||||
title: "Llama 3",
|
||||
title: LOCAL_ONBOARDING_CHAT_TITLE,
|
||||
provider: "ollama",
|
||||
model: "llama3",
|
||||
},
|
||||
{
|
||||
title: ONBOARDING_LOCAL_MODEL_TITLE,
|
||||
provider: "ollama",
|
||||
model: "AUTODETECT",
|
||||
model: LOCAL_ONBOARDING_CHAT_MODEL,
|
||||
},
|
||||
...config.models.filter((model) => model.provider !== "free-trial"),
|
||||
],
|
||||
tabAutocompleteModel: {
|
||||
title: "Starcoder 3b",
|
||||
provider: "ollama",
|
||||
model: "starcoder2:3b",
|
||||
model: LOCAL_ONBOARDING_FIM_MODEL,
|
||||
},
|
||||
embeddingsProvider: {
|
||||
provider: "ollama",
|
||||
model: "nomic-embed-text",
|
||||
},
|
||||
reranker: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export function setupFreeTrialMode(
|
||||
export function setupQuickstartConfig(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
|
|
@ -73,16 +68,16 @@ export function setupFreeTrialMode(
|
|||
};
|
||||
}
|
||||
|
||||
export function setupLocalAfterFreeTrial(
|
||||
export function setupLocalConfigAfterFreeTrial(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
...config,
|
||||
models: [
|
||||
{
|
||||
title: "Llama 3",
|
||||
title: LOCAL_ONBOARDING_CHAT_TITLE,
|
||||
provider: "ollama",
|
||||
model: "llama3",
|
||||
model: LOCAL_ONBOARDING_CHAT_MODEL,
|
||||
},
|
||||
{
|
||||
title: ONBOARDING_LOCAL_MODEL_TITLE,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
import { ContinueProxyReranker } from "../../context/rerankers/ContinueProxyReranker.js";
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js";
|
||||
import {
|
||||
ControlPlaneClient,
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL,
|
||||
} from "../../control-plane/client.js";
|
||||
import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js";
|
||||
import {
|
||||
ContinueConfig,
|
||||
ContinueRcJson,
|
||||
IDE,
|
||||
IdeSettings,
|
||||
|
|
@ -33,7 +38,7 @@ export default async function doLoadConfig(
|
|||
const ideSettings = await ideSettingsPromise;
|
||||
const workOsAccessToken = await controlPlaneClient.getAccessToken();
|
||||
|
||||
const newConfig = await loadFullConfigNode(
|
||||
let newConfig = await loadFullConfigNode(
|
||||
ide,
|
||||
workspaceConfigs,
|
||||
ideSettings,
|
||||
|
|
@ -56,34 +61,59 @@ export default async function doLoadConfig(
|
|||
// TODO: pass config to pre-load non-system TTS models
|
||||
await TTS.setup();
|
||||
|
||||
// Set up control plane proxy if configured
|
||||
let controlPlaneProxyUrl: string =
|
||||
(newConfig as any).controlPlane?.proxyUrl ??
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL;
|
||||
if (!controlPlaneProxyUrl.endsWith("/")) {
|
||||
controlPlaneProxyUrl += "/";
|
||||
}
|
||||
const controlPlaneProxyInfo = {
|
||||
workspaceId,
|
||||
controlPlaneProxyUrl,
|
||||
workOsAccessToken,
|
||||
};
|
||||
|
||||
if (newConfig.analytics) {
|
||||
await TeamAnalytics.setup(
|
||||
newConfig.analytics as any, // TODO: Need to get rid of index.d.ts once and for all
|
||||
uniqueId,
|
||||
ideInfo.extensionVersion,
|
||||
controlPlaneClient,
|
||||
workspaceId,
|
||||
controlPlaneProxyInfo,
|
||||
);
|
||||
}
|
||||
|
||||
[...newConfig.models, ...(newConfig.tabAutocompleteModels ?? [])].forEach(
|
||||
newConfig = await injectControlPlaneProxyInfo(
|
||||
newConfig,
|
||||
controlPlaneProxyInfo,
|
||||
);
|
||||
|
||||
return newConfig;
|
||||
}
|
||||
|
||||
// Pass ControlPlaneProxyInfo to objects that need it
|
||||
async function injectControlPlaneProxyInfo(
|
||||
config: ContinueConfig,
|
||||
info: ControlPlaneProxyInfo,
|
||||
): Promise<ContinueConfig> {
|
||||
[...config.models, ...(config.tabAutocompleteModels ?? [])].forEach(
|
||||
async (model) => {
|
||||
if (model.providerName === "continue-proxy") {
|
||||
(model as ContinueProxy).workOsAccessToken = workOsAccessToken;
|
||||
(model as ContinueProxy).controlPlaneProxyInfo = info;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (newConfig.embeddingsProvider?.providerName === "continue-proxy") {
|
||||
if (config.embeddingsProvider?.providerName === "continue-proxy") {
|
||||
(
|
||||
newConfig.embeddingsProvider as ContinueProxyEmbeddingsProvider
|
||||
).workOsAccessToken = workOsAccessToken;
|
||||
config.embeddingsProvider as ContinueProxyEmbeddingsProvider
|
||||
).controlPlaneProxyInfo = info;
|
||||
}
|
||||
|
||||
if (newConfig.reranker?.name === "continue-proxy") {
|
||||
(newConfig.reranker as ContinueProxyReranker).workOsAccessToken =
|
||||
workOsAccessToken;
|
||||
if (config.reranker?.name === "continue-proxy") {
|
||||
(config.reranker as ContinueProxyReranker).controlPlaneProxyInfo = info;
|
||||
}
|
||||
|
||||
return newConfig;
|
||||
return config;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { RequestOptions } from "../../../index.js";
|
||||
import { RequestOptions } from "../../../";
|
||||
// @ts-ignore
|
||||
import adf2md from "adf-to-md";
|
||||
|
||||
interface JiraClientOptions {
|
||||
domain: string;
|
||||
username: string;
|
||||
|
|
@ -112,7 +113,7 @@ export class JiraClient {
|
|||
if (typeof issue.fields.description === "string") {
|
||||
result.description = issue.fields.description;
|
||||
} else if (issue.fields.description) {
|
||||
result.description = adf2md(issue.fields.description).result;
|
||||
result.description = adf2md.validate(issue.fields.description).result;
|
||||
} else {
|
||||
result.description = "";
|
||||
}
|
||||
|
|
@ -122,7 +123,7 @@ export class JiraClient {
|
|||
const body =
|
||||
typeof comment.body === "string"
|
||||
? comment.body
|
||||
: adf2md(comment.body).result;
|
||||
: adf2md.validate(comment.body).result;
|
||||
|
||||
return {
|
||||
body,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class OSContextProvider extends BaseContextProvider {
|
|||
return [
|
||||
{
|
||||
description: "Your operating system and CPU",
|
||||
content: `I am running ${platform} on ${cpu}.`,
|
||||
content: `I am running ${platform === "win32" ? "Windows" : platform} on ${cpu}.`,
|
||||
name: "os",
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,21 +1,15 @@
|
|||
import fetch from "node-fetch";
|
||||
import { CONTROL_PLANE_URL } from "../../control-plane/client.js";
|
||||
import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js";
|
||||
import { Chunk, Reranker } from "../../index.js";
|
||||
|
||||
export class ContinueProxyReranker implements Reranker {
|
||||
name = "continue-proxy";
|
||||
|
||||
private _workOsAccessToken: string | undefined = undefined;
|
||||
private _controlPlaneProxyInfo?: ControlPlaneProxyInfo;
|
||||
|
||||
get workOsAccessToken(): string | undefined {
|
||||
return this._workOsAccessToken;
|
||||
}
|
||||
|
||||
set workOsAccessToken(value: string | undefined) {
|
||||
if (this._workOsAccessToken !== value) {
|
||||
this._workOsAccessToken = value;
|
||||
this.params.apiKey = value!;
|
||||
}
|
||||
set controlPlaneProxyInfo(value: ControlPlaneProxyInfo) {
|
||||
this.params.apiKey = value.workOsAccessToken!;
|
||||
this._controlPlaneProxyInfo = value;
|
||||
}
|
||||
|
||||
constructor(
|
||||
|
|
@ -26,7 +20,10 @@ export class ContinueProxyReranker implements Reranker {
|
|||
) {}
|
||||
|
||||
async rerank(query: string, chunks: Chunk[]): Promise<number[]> {
|
||||
const url = new URL("/model-proxy/v1/rerank", CONTROL_PLANE_URL);
|
||||
const url = new URL(
|
||||
"openai/v1/rerank",
|
||||
this._controlPlaneProxyInfo?.controlPlaneProxyUrl,
|
||||
);
|
||||
const resp = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {
|
|||
ContextProviderExtras,
|
||||
} from "../../index.js";
|
||||
import TransformersJsEmbeddingsProvider from "../../indexing/embeddings/TransformersJsEmbeddingsProvider.js";
|
||||
import { resolveRelativePathInWorkspace } from "../../util/ideUtils.js";
|
||||
import { getRelativePath } from "../../util/index.js";
|
||||
import { RetrievalPipelineOptions } from "./pipelines/BaseRetrievalPipeline.js";
|
||||
import NoRerankerRetrievalPipeline from "./pipelines/NoRerankerRetrievalPipeline.js";
|
||||
|
|
@ -66,6 +67,14 @@ export async function retrieveContextItemsFromEmbeddings(
|
|||
? RerankerRetrievalPipeline
|
||||
: NoRerankerRetrievalPipeline;
|
||||
|
||||
if (filterDirectory) {
|
||||
// Handle relative paths
|
||||
filterDirectory = await resolveRelativePathInWorkspace(
|
||||
filterDirectory,
|
||||
extras.ide,
|
||||
);
|
||||
}
|
||||
|
||||
const pipelineOptions: RetrievalPipelineOptions = {
|
||||
nFinal,
|
||||
nRetrieve,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import { Analytics } from "@continuedev/config-types";
|
||||
import os from "node:os";
|
||||
import ContinueProxyAnalyticsProvider from "./analytics/ContinueProxyAnalyticsProvider.js";
|
||||
import { IAnalyticsProvider } from "./analytics/IAnalyticsProvider.js";
|
||||
import {
|
||||
ControlPlaneProxyInfo,
|
||||
IAnalyticsProvider,
|
||||
} from "./analytics/IAnalyticsProvider.js";
|
||||
import LogStashAnalyticsProvider from "./analytics/LogStashAnalyticsProvider.js";
|
||||
import PostHogAnalyticsProvider from "./analytics/PostHogAnalyticsProvider.js";
|
||||
import { ControlPlaneClient } from "./client.js";
|
||||
|
|
@ -41,7 +44,7 @@ export class TeamAnalytics {
|
|||
uniqueId: string,
|
||||
extensionVersion: string,
|
||||
controlPlaneClient: ControlPlaneClient,
|
||||
workspaceId?: string,
|
||||
controlPlaneProxyInfo: ControlPlaneProxyInfo,
|
||||
) {
|
||||
TeamAnalytics.uniqueId = uniqueId;
|
||||
TeamAnalytics.os = os.platform();
|
||||
|
|
@ -52,7 +55,11 @@ export class TeamAnalytics {
|
|||
TeamAnalytics.provider = undefined;
|
||||
} else {
|
||||
TeamAnalytics.provider = createAnalyticsProvider(config);
|
||||
await TeamAnalytics.provider?.setup(config, uniqueId, workspaceId);
|
||||
await TeamAnalytics.provider?.setup(
|
||||
config,
|
||||
uniqueId,
|
||||
controlPlaneProxyInfo,
|
||||
);
|
||||
|
||||
if (config.provider === "continue-proxy") {
|
||||
(
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
import { Analytics } from "@continuedev/config-types";
|
||||
import fetch from "node-fetch";
|
||||
import { CONTROL_PLANE_URL, ControlPlaneClient } from "../client.js";
|
||||
import { IAnalyticsProvider } from "./IAnalyticsProvider.js";
|
||||
import { ControlPlaneClient } from "../client.js";
|
||||
import {
|
||||
ControlPlaneProxyInfo,
|
||||
IAnalyticsProvider,
|
||||
} from "./IAnalyticsProvider.js";
|
||||
|
||||
export default class ContinueProxyAnalyticsProvider
|
||||
implements IAnalyticsProvider
|
||||
{
|
||||
uniqueId?: string;
|
||||
workspaceId?: string;
|
||||
controlPlaneProxyInfo?: ControlPlaneProxyInfo;
|
||||
|
||||
controlPlaneClient?: ControlPlaneClient;
|
||||
|
||||
|
|
@ -16,8 +19,8 @@ export default class ContinueProxyAnalyticsProvider
|
|||
properties: { [key: string]: any },
|
||||
): Promise<void> {
|
||||
const url = new URL(
|
||||
`proxy/analytics/${this.workspaceId}/capture`,
|
||||
CONTROL_PLANE_URL,
|
||||
`proxy/analytics/${this.controlPlaneProxyInfo?.workspaceId}/capture`,
|
||||
this.controlPlaneProxyInfo?.controlPlaneProxyUrl,
|
||||
).toString();
|
||||
fetch(url, {
|
||||
method: "POST",
|
||||
|
|
@ -35,10 +38,10 @@ export default class ContinueProxyAnalyticsProvider
|
|||
async setup(
|
||||
config: Analytics,
|
||||
uniqueId: string,
|
||||
workspaceId?: string,
|
||||
controlPlaneProxyInfo?: ControlPlaneProxyInfo,
|
||||
): Promise<void> {
|
||||
this.uniqueId = uniqueId;
|
||||
this.workspaceId = workspaceId;
|
||||
this.controlPlaneProxyInfo = controlPlaneProxyInfo;
|
||||
}
|
||||
|
||||
async shutdown(): Promise<void> {}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,18 @@ export interface AnalyticsMetadata {
|
|||
extensionVersion: string;
|
||||
}
|
||||
|
||||
export interface ControlPlaneProxyInfo {
|
||||
workspaceId?: string;
|
||||
controlPlaneProxyUrl: string;
|
||||
workOsAccessToken?: string;
|
||||
}
|
||||
|
||||
export interface IAnalyticsProvider {
|
||||
capture(event: string, properties: { [key: string]: any }): Promise<void>;
|
||||
setup(
|
||||
config: Analytics,
|
||||
uniqueId: string,
|
||||
workspaceId?: string,
|
||||
controlPlaneProxyInfo?: ControlPlaneProxyInfo,
|
||||
): Promise<void>;
|
||||
shutdown(): Promise<void>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
import { Analytics } from "@continuedev/config-types";
|
||||
import net from "node:net";
|
||||
import { IAnalyticsProvider } from "./IAnalyticsProvider.js";
|
||||
import {
|
||||
ControlPlaneProxyInfo,
|
||||
IAnalyticsProvider,
|
||||
} from "./IAnalyticsProvider.js";
|
||||
|
||||
export default class LogStashAnalyticsProvider implements IAnalyticsProvider {
|
||||
private host?: string;
|
||||
|
|
@ -31,7 +34,7 @@ export default class LogStashAnalyticsProvider implements IAnalyticsProvider {
|
|||
async setup(
|
||||
config: Analytics,
|
||||
uniqueId: string,
|
||||
workspaceId?: string,
|
||||
controlPlaneProxyInfo?: ControlPlaneProxyInfo,
|
||||
): Promise<void> {
|
||||
if (!config.url) {
|
||||
console.warn("LogStashAnalyticsProvider is missing a URL");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import { Analytics } from "@continuedev/config-types";
|
||||
import { IAnalyticsProvider } from "./IAnalyticsProvider.js";
|
||||
import {
|
||||
ControlPlaneProxyInfo,
|
||||
IAnalyticsProvider,
|
||||
} from "./IAnalyticsProvider.js";
|
||||
|
||||
export default class PostHogAnalyticsProvider implements IAnalyticsProvider {
|
||||
client?: any;
|
||||
|
|
@ -19,7 +22,7 @@ export default class PostHogAnalyticsProvider implements IAnalyticsProvider {
|
|||
async setup(
|
||||
config: Analytics,
|
||||
uniqueId: string,
|
||||
workspaceId?: string,
|
||||
controlPlaneProxyInfo?: ControlPlaneProxyInfo,
|
||||
): Promise<void> {
|
||||
if (!config || !config.clientKey || !config.url) {
|
||||
this.client = undefined;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ export interface ControlPlaneWorkspace {
|
|||
|
||||
export interface ControlPlaneModelDescription extends ModelDescription {}
|
||||
|
||||
export const DEFAULT_CONTROL_PLANE_PROXY_URL =
|
||||
process.env.CONTROL_PLANE_ENV === "local"
|
||||
? "http://localhost:3001/proxy"
|
||||
: "https://control-plane-proxy.continue.dev/";
|
||||
|
||||
export const CONTROL_PLANE_URL =
|
||||
process.env.CONTROL_PLANE_ENV === "local"
|
||||
? "http://localhost:3001/"
|
||||
|
|
|
|||
32
core/core.ts
32
core/core.ts
|
|
@ -3,10 +3,10 @@ import type { ContextItemId, IDE, IndexingProgressUpdate } from ".";
|
|||
import { CompletionProvider } from "./autocomplete/completionProvider";
|
||||
import { ConfigHandler } from "./config/ConfigHandler";
|
||||
import {
|
||||
setupApiKeysMode,
|
||||
setupFreeTrialMode,
|
||||
setupLocalAfterFreeTrial,
|
||||
setupLocalMode,
|
||||
setupBestConfig,
|
||||
setupLocalConfig,
|
||||
setupLocalConfigAfterFreeTrial,
|
||||
setupQuickstartConfig,
|
||||
} from "./config/onboarding";
|
||||
import { createNewPromptFile } from "./config/promptFile";
|
||||
import { addModel, addOpenAIKey, deleteModel } from "./config/util";
|
||||
|
|
@ -468,7 +468,7 @@ export class Core {
|
|||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`Error listing Ollama models: ${e}`);
|
||||
console.debug(`Error listing Ollama models: ${e}`);
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
|
|
@ -606,31 +606,27 @@ export class Core {
|
|||
on("completeOnboarding", (msg) => {
|
||||
const mode = msg.data.mode;
|
||||
|
||||
Telemetry.capture("onboardingSelection", {
|
||||
mode,
|
||||
});
|
||||
|
||||
if (mode === "custom") {
|
||||
if (mode === "Custom") {
|
||||
return;
|
||||
}
|
||||
|
||||
let editConfigJsonCallback: Parameters<typeof editConfigJson>[0];
|
||||
|
||||
switch (mode) {
|
||||
case "local":
|
||||
editConfigJsonCallback = setupLocalMode;
|
||||
case "Local":
|
||||
editConfigJsonCallback = setupLocalConfig;
|
||||
break;
|
||||
|
||||
case "freeTrial":
|
||||
editConfigJsonCallback = setupFreeTrialMode;
|
||||
case "Quickstart":
|
||||
editConfigJsonCallback = setupQuickstartConfig;
|
||||
break;
|
||||
|
||||
case "localAfterFreeTrial":
|
||||
editConfigJsonCallback = setupLocalAfterFreeTrial;
|
||||
case "LocalAfterFreeTrial":
|
||||
editConfigJsonCallback = setupLocalConfigAfterFreeTrial;
|
||||
break;
|
||||
|
||||
case "apiKeys":
|
||||
editConfigJsonCallback = setupApiKeysMode;
|
||||
case "Best":
|
||||
editConfigJsonCallback = setupBestConfig;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
17
core/index.d.ts
vendored
17
core/index.d.ts
vendored
|
|
@ -1,3 +1,5 @@
|
|||
import { GetGhTokenArgs } from "./protocol/ide";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
ide?: "vscode";
|
||||
|
|
@ -509,7 +511,7 @@ export interface IDE {
|
|||
getGitRootPath(dir: string): Promise<string | undefined>;
|
||||
listDir(dir: string): Promise<[string, FileType][]>;
|
||||
getLastModified(files: string[]): Promise<{ [path: string]: number }>;
|
||||
getGitHubAuthToken(): Promise<string | undefined>;
|
||||
getGitHubAuthToken(args: GetGhTokenArgs): Promise<string | undefined>;
|
||||
|
||||
// LSP
|
||||
gotoDefinition(location: Location): Promise<RangeInFile[]>;
|
||||
|
|
@ -663,6 +665,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"
|
||||
|
|
@ -701,10 +707,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"
|
||||
|
|
@ -798,7 +800,9 @@ export type EmbeddingsProviderName =
|
|||
| "gemini"
|
||||
| "continue-proxy"
|
||||
| "deepinfra"
|
||||
| "voyage";
|
||||
| "nvidia"
|
||||
| "voyage"
|
||||
| "mistral";
|
||||
|
||||
export interface EmbedOptions {
|
||||
apiBase?: string;
|
||||
|
|
@ -809,6 +813,7 @@ export interface EmbedOptions {
|
|||
apiVersion?: string;
|
||||
requestOptions?: RequestOptions;
|
||||
maxChunkSize?: number;
|
||||
maxBatchSize?: number;
|
||||
// AWS options
|
||||
profile?: string;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import { open, type Database } from "sqlite";
|
||||
import sqlite3 from "sqlite3";
|
||||
import lancedb, { Connection } from "vectordb";
|
||||
import { ConfigHandler } from "../../config/ConfigHandler";
|
||||
import DocsContextProvider from "../../context/providers/DocsContextProvider";
|
||||
import {
|
||||
Chunk,
|
||||
ContinueConfig,
|
||||
|
|
@ -11,6 +9,9 @@ import {
|
|||
IndexingProgressUpdate,
|
||||
SiteIndexingConfig,
|
||||
} from "../..";
|
||||
import { ConfigHandler } from "../../config/ConfigHandler";
|
||||
import { addContextProvider } from "../../config/util";
|
||||
import DocsContextProvider from "../../context/providers/DocsContextProvider";
|
||||
import { FromCoreProtocol, ToCoreProtocol } from "../../protocol";
|
||||
import { GlobalContext } from "../../util/GlobalContext";
|
||||
import { IMessenger } from "../../util/messenger";
|
||||
|
|
@ -31,7 +32,6 @@ import {
|
|||
SiteIndexingResults,
|
||||
} from "./preIndexed";
|
||||
import preIndexedDocs from "./preIndexedDocs";
|
||||
import { addContextProvider } from "../../config/util";
|
||||
|
||||
// Purposefully lowercase because lancedb converts
|
||||
export interface LanceDbDocsRow {
|
||||
|
|
@ -250,6 +250,10 @@ export default class DocsService {
|
|||
}
|
||||
}
|
||||
|
||||
Telemetry.capture("docs_pages_crawled", {
|
||||
count: processedPages,
|
||||
});
|
||||
|
||||
const chunks: Chunk[] = [];
|
||||
const embeddings: number[][] = [];
|
||||
|
||||
|
|
@ -533,9 +537,8 @@ export default class DocsService {
|
|||
private async getLanceTableNameFromEmbeddingsProvider(
|
||||
isPreIndexedDoc: boolean,
|
||||
) {
|
||||
const embeddingsProvider = await this.getEmbeddingsProvider(
|
||||
isPreIndexedDoc,
|
||||
);
|
||||
const embeddingsProvider =
|
||||
await this.getEmbeddingsProvider(isPreIndexedDoc);
|
||||
const embeddingsProviderId = this.removeInvalidLanceTableNameChars(
|
||||
embeddingsProvider.id,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ abstract class BaseEmbeddingsProvider implements IBaseEmbeddingsProvider {
|
|||
}
|
||||
}
|
||||
defaultOptions?: EmbedOptions | undefined;
|
||||
maxBatchSize?: number | undefined;
|
||||
get maxBatchSize(): number | undefined {
|
||||
return this.options.maxBatchSize ?? (this.constructor as typeof BaseEmbeddingsProvider).maxBatchSize;
|
||||
}
|
||||
|
||||
abstract embed(chunks: string[]): Promise<number[][]>;
|
||||
|
||||
|
|
@ -53,7 +55,7 @@ abstract class BaseEmbeddingsProvider implements IBaseEmbeddingsProvider {
|
|||
return this.options.maxChunkSize ?? DEFAULT_MAX_CHUNK_SIZE;
|
||||
}
|
||||
|
||||
static getBatchedChunks(chunks: string[]): string[][] {
|
||||
getBatchedChunks(chunks: string[]): string[][] {
|
||||
if (!this.maxBatchSize) {
|
||||
console.warn(
|
||||
`${this.getBatchedChunks.name} should only be called if 'maxBatchSize' is defined`,
|
||||
|
|
@ -62,15 +64,10 @@ abstract class BaseEmbeddingsProvider implements IBaseEmbeddingsProvider {
|
|||
return [chunks];
|
||||
}
|
||||
|
||||
if (chunks.length > this.maxBatchSize) {
|
||||
return [chunks];
|
||||
}
|
||||
|
||||
const batchedChunks = [];
|
||||
|
||||
for (let i = 0; i < chunks.length; i += this.maxBatchSize) {
|
||||
const batchSizedChunk = chunks.slice(i, i + this.maxBatchSize);
|
||||
batchedChunks.push(batchSizedChunk);
|
||||
batchedChunks.push(chunks.slice(i, i + this.maxBatchSize));
|
||||
}
|
||||
|
||||
return batchedChunks;
|
||||
|
|
|
|||
|
|
@ -18,16 +18,7 @@ class CohereEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
this.options.apiBase += "/";
|
||||
}
|
||||
|
||||
const batchedChunks = [];
|
||||
for (
|
||||
let i = 0;
|
||||
i < chunks.length;
|
||||
i += CohereEmbeddingsProvider.maxBatchSize
|
||||
) {
|
||||
batchedChunks.push(
|
||||
chunks.slice(i, i + CohereEmbeddingsProvider.maxBatchSize),
|
||||
);
|
||||
}
|
||||
const batchedChunks = this.getBatchedChunks(chunks);
|
||||
return (
|
||||
await Promise.all(
|
||||
batchedChunks.map(async (batch) => {
|
||||
|
|
|
|||
|
|
@ -1,24 +1,16 @@
|
|||
import { CONTROL_PLANE_URL } from "../../control-plane/client.js";
|
||||
import { EmbeddingsProviderName, EmbedOptions } from "../../index.js";
|
||||
import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js";
|
||||
import { EmbeddingsProviderName } from "../../index.js";
|
||||
import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider.js";
|
||||
|
||||
class ContinueProxyEmbeddingsProvider extends OpenAIEmbeddingsProvider {
|
||||
static providerName: EmbeddingsProviderName = "continue-proxy";
|
||||
static defaultOptions: Partial<EmbedOptions> | undefined = {
|
||||
apiBase: new URL("/model-proxy/v1", CONTROL_PLANE_URL).toString(),
|
||||
};
|
||||
|
||||
private _workOsAccessToken: string | undefined = undefined;
|
||||
|
||||
get workOsAccessToken(): string | undefined {
|
||||
return this._workOsAccessToken;
|
||||
}
|
||||
|
||||
set workOsAccessToken(value: string | undefined) {
|
||||
if (this._workOsAccessToken !== value) {
|
||||
this._workOsAccessToken = value;
|
||||
this.options.apiKey = value;
|
||||
}
|
||||
set controlPlaneProxyInfo(value: ControlPlaneProxyInfo) {
|
||||
this.options.apiKey = value.workOsAccessToken;
|
||||
this.options.apiBase = new URL(
|
||||
"openai/v1",
|
||||
value.controlPlaneProxyUrl,
|
||||
).toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,16 +24,7 @@ class FreeTrialEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
const batchedChunks = [];
|
||||
for (
|
||||
let i = 0;
|
||||
i < chunks.length;
|
||||
i += FreeTrialEmbeddingsProvider.maxBatchSize
|
||||
) {
|
||||
batchedChunks.push(
|
||||
chunks.slice(i, i + FreeTrialEmbeddingsProvider.maxBatchSize),
|
||||
);
|
||||
}
|
||||
const batchedChunks = this.getBatchedChunks(chunks);
|
||||
return (
|
||||
await Promise.all(
|
||||
batchedChunks.map(async (batch) => {
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ class GeminiEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
const batches = GeminiEmbeddingsProvider.getBatchedChunks(chunks);
|
||||
const batchedChunks = this.getBatchedChunks(chunks);
|
||||
|
||||
const results = await Promise.all(
|
||||
batches.map((batch) => this.getSingleBatchEmbedding(batch)),
|
||||
batchedChunks.map((batch) => this.getSingleBatchEmbedding(batch)),
|
||||
);
|
||||
return results.flat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js";
|
|||
|
||||
class HuggingFaceTEIEmbeddingsProvider extends BaseEmbeddingsProvider {
|
||||
static providerName: EmbeddingsProviderName = "huggingface-tei";
|
||||
maxBatchSize = 32;
|
||||
private _maxBatchSize?: number;
|
||||
get maxBatchSize(): number | undefined {
|
||||
return this._maxBatchSize ?? super.maxBatchSize;
|
||||
}
|
||||
|
||||
static defaultOptions: Partial<EmbedOptions> | undefined = {
|
||||
apiBase: "http://localhost:8080",
|
||||
|
|
@ -24,18 +27,16 @@ class HuggingFaceTEIEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
}
|
||||
this.doInfoRequest().then((response) => {
|
||||
this.options.model = response.model_id;
|
||||
this.maxBatchSize = response.max_client_batch_size;
|
||||
this._maxBatchSize = response.max_client_batch_size;
|
||||
});
|
||||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
const promises = [];
|
||||
for (let i = 0; i < chunks.length; i += this.maxBatchSize) {
|
||||
promises.push(
|
||||
this.doEmbedRequest(chunks.slice(i, i + this.maxBatchSize)),
|
||||
);
|
||||
}
|
||||
const results = await Promise.all(promises);
|
||||
const batchedChunks = this.getBatchedChunks(chunks);
|
||||
|
||||
const results = await Promise.all(
|
||||
batchedChunks.map((batch) => this.doEmbedRequest(batch)),
|
||||
);
|
||||
return results.flat();
|
||||
}
|
||||
|
||||
|
|
|
|||
14
core/indexing/embeddings/MistralEmbeddingsProvider.ts
Normal file
14
core/indexing/embeddings/MistralEmbeddingsProvider.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { EmbeddingsProviderName, EmbedOptions } from "../../index.js";
|
||||
import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider.js";
|
||||
|
||||
class MistralEmbeddingsProvider extends OpenAIEmbeddingsProvider {
|
||||
static providerName: EmbeddingsProviderName = "mistral";
|
||||
static maxBatchSize = 128;
|
||||
|
||||
static defaultOptions: Partial<EmbedOptions> | undefined = {
|
||||
apiBase: "https://api.mistral.ai/v1/",
|
||||
model: "mistral-embed",
|
||||
};
|
||||
}
|
||||
|
||||
export default MistralEmbeddingsProvider;
|
||||
80
core/indexing/embeddings/NvidiaEmbeddingsProvider.ts
Normal file
80
core/indexing/embeddings/NvidiaEmbeddingsProvider.ts
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
import { Response } from "node-fetch";
|
||||
import { EmbeddingsProviderName, EmbedOptions } from "../../index.js";
|
||||
import { withExponentialBackoff } from "../../util/withExponentialBackoff.js";
|
||||
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js";
|
||||
|
||||
class NvidiaEmbeddingsProvider extends BaseEmbeddingsProvider {
|
||||
static maxBatchSize = 96;
|
||||
|
||||
static providerName: EmbeddingsProviderName = "nvidia";
|
||||
|
||||
static defaultOptions: Partial<EmbedOptions> | undefined = {
|
||||
apiBase: "https://integrate.api.nvidia.com/v1/",
|
||||
model: "nvidia/nv-embedqa-mistral-7b-v2",
|
||||
};
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
|
||||
if (!this.options.apiBase?.endsWith("/")) {
|
||||
this.options.apiBase += "/";
|
||||
}
|
||||
|
||||
const batchedChunks = [];
|
||||
for (
|
||||
let i = 0;
|
||||
i < chunks.length;
|
||||
i += NvidiaEmbeddingsProvider.maxBatchSize
|
||||
) {
|
||||
batchedChunks.push(
|
||||
chunks.slice(i, i + NvidiaEmbeddingsProvider.maxBatchSize),
|
||||
);
|
||||
}
|
||||
return (
|
||||
await Promise.all(
|
||||
batchedChunks.map(async (batch) => {
|
||||
if (batch.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Input list must be non empty and all elements must be non empty, therefore, for all empty elements replace it with a token
|
||||
const emptyToken = '[EMPTY]';
|
||||
for (let i = 0; i < batch.length; i++) {
|
||||
if (batch[i].trim() === '') {
|
||||
batch[i] = emptyToken;
|
||||
}
|
||||
}
|
||||
|
||||
const fetchWithBackoff = () =>
|
||||
withExponentialBackoff<Response>(() =>
|
||||
this.fetch(new URL("embeddings", this.options.apiBase), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
input: batch,
|
||||
model: this.options.model,
|
||||
input_type: 'passage',
|
||||
truncate: "END",
|
||||
}),
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.options.apiKey}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const resp = await fetchWithBackoff();
|
||||
|
||||
if (!resp.ok) {
|
||||
throw new Error(await resp.text());
|
||||
}
|
||||
|
||||
const data = (await resp.json()) as any;
|
||||
return data.data.map(
|
||||
(result: { embedding: number[] }) => result.embedding,
|
||||
);
|
||||
}),
|
||||
)
|
||||
).flat();
|
||||
}
|
||||
}
|
||||
|
||||
export default NvidiaEmbeddingsProvider;
|
||||
|
|
@ -35,16 +35,7 @@ class OpenAIEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
const batchedChunks = [];
|
||||
for (
|
||||
let i = 0;
|
||||
i < chunks.length;
|
||||
i += OpenAIEmbeddingsProvider.maxBatchSize
|
||||
) {
|
||||
batchedChunks.push(
|
||||
chunks.slice(i, i + OpenAIEmbeddingsProvider.maxBatchSize),
|
||||
);
|
||||
}
|
||||
const batchedChunks = this.getBatchedChunks(chunks);
|
||||
return (
|
||||
await Promise.all(
|
||||
batchedChunks.map(async (batch) => {
|
||||
|
|
|
|||
|
|
@ -7,9 +7,11 @@ import DeepInfraEmbeddingsProvider from "./DeepInfraEmbeddingsProvider.js";
|
|||
import FreeTrialEmbeddingsProvider from "./FreeTrialEmbeddingsProvider.js";
|
||||
import GeminiEmbeddingsProvider from "./GeminiEmbeddingsProvider.js";
|
||||
import HuggingFaceTEIEmbeddingsProvider from "./HuggingFaceTEIEmbeddingsProvider.js";
|
||||
import MistralEmbeddingsProvider from "./MistralEmbeddingsProvider.js";
|
||||
import OllamaEmbeddingsProvider from "./OllamaEmbeddingsProvider.js";
|
||||
import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider.js";
|
||||
import TransformersJsEmbeddingsProvider from "./TransformersJsEmbeddingsProvider.js";
|
||||
import NvidiaEmbeddingsProvider from "./NvidiaEmbeddingsProvider.js";
|
||||
import VoyageEmbeddingsProvider from "./VoyageEmbeddingsProvider.js";
|
||||
|
||||
type EmbeddingsProviderConstructor = new (
|
||||
|
|
@ -30,5 +32,7 @@ export const allEmbeddingsProviders: Record<
|
|||
gemini: GeminiEmbeddingsProvider,
|
||||
"continue-proxy": ContinueProxyEmbeddingsProvider,
|
||||
deepinfra: DeepInfraEmbeddingsProvider,
|
||||
nvidia: NvidiaEmbeddingsProvider,
|
||||
voyage: VoyageEmbeddingsProvider,
|
||||
mistral: MistralEmbeddingsProvider,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ const PROVIDER_SUPPORTS_IMAGES: ModelProvider[] = [
|
|||
"bedrock",
|
||||
"sagemaker",
|
||||
"continue-proxy",
|
||||
"openrouter",
|
||||
];
|
||||
|
||||
const MODEL_SUPPORTS_IMAGES: string[] = [
|
||||
|
|
@ -79,9 +80,11 @@ function modelSupportsImages(
|
|||
provider: ModelProvider,
|
||||
model: string,
|
||||
title: string | undefined,
|
||||
capabilities: ModelCapability | undefined
|
||||
capabilities: ModelCapability | undefined,
|
||||
): boolean {
|
||||
if (capabilities?.uploadImage !== undefined) {return capabilities.uploadImage;}
|
||||
if (capabilities?.uploadImage !== undefined) {
|
||||
return capabilities.uploadImage;
|
||||
}
|
||||
if (!PROVIDER_SUPPORTS_IMAGES.includes(provider)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const DEFAULT_MAX_TOKENS = 1024;
|
||||
const DEFAULT_CONTEXT_LENGTH = 4096;
|
||||
const DEFAULT_MAX_TOKENS = 2048;
|
||||
const DEFAULT_CONTEXT_LENGTH = 8096;
|
||||
const DEFAULT_TEMPERATURE = 0.5;
|
||||
|
||||
const DEFAULT_ARGS = {
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
};
|
||||
|
||||
this.model = options.model;
|
||||
// Use @continuedev/llm-info package to autodetect certain parameters
|
||||
const llmInfo = findLlmInfo(this.model);
|
||||
|
||||
const templateType =
|
||||
|
|
@ -149,7 +150,16 @@ export abstract class BaseLLM implements ILLM {
|
|||
this.completionOptions = {
|
||||
...options.completionOptions,
|
||||
model: options.model || "gpt-4",
|
||||
maxTokens: options.completionOptions?.maxTokens ?? DEFAULT_MAX_TOKENS,
|
||||
maxTokens:
|
||||
options.completionOptions?.maxTokens ??
|
||||
(llmInfo?.maxCompletionTokens
|
||||
? Math.min(
|
||||
llmInfo.maxCompletionTokens,
|
||||
// Even if the model has a large maxTokens, we don't want to use that every time,
|
||||
// because it takes away from the context length
|
||||
this.contextLength / 4,
|
||||
)
|
||||
: DEFAULT_MAX_TOKENS),
|
||||
};
|
||||
if (CompletionOptionsForModels[options.model as ModelName]) {
|
||||
this.completionOptions = mergeJson(
|
||||
|
|
@ -325,6 +335,20 @@ ${prompt}`;
|
|||
) {
|
||||
text =
|
||||
"You may need to add pre-paid credits before using the OpenAI API.";
|
||||
} else if (
|
||||
resp.status === 401 &&
|
||||
(resp.url.includes("api.mistral.ai") ||
|
||||
resp.url.includes("codestral.mistral.ai"))
|
||||
) {
|
||||
if (resp.url.includes("codestral.mistral.ai")) {
|
||||
throw new Error(
|
||||
'You are using a Mistral API key, which is not compatible with the Codestral API. Please either obtain a Codestral API key, or use the Mistral API by setting "apiBase" to "https://api.mistral.ai/v1" in config.json.',
|
||||
);
|
||||
} else {
|
||||
throw new Error(
|
||||
'You are using a Codestral API key, which is not compatible with the Mistral API. Please either obtain a Mistral API key, or use the the Codestral API by setting "apiBase" to "https://codestral.mistral.ai/v1" in config.json.',
|
||||
);
|
||||
}
|
||||
}
|
||||
throw new Error(
|
||||
`HTTP ${resp.status} ${resp.statusText} from ${resp.url}\n\n${text}`,
|
||||
|
|
@ -334,8 +358,14 @@ ${prompt}`;
|
|||
return resp;
|
||||
} catch (e: any) {
|
||||
// Errors to ignore
|
||||
if (!e.message.includes("/api/show")) {
|
||||
console.warn(
|
||||
if (e.message.includes("/api/tags")) {
|
||||
throw new Error(`Error fetching tags: ${e.message}`);
|
||||
} else if (e.message.includes("/api/show")) {
|
||||
throw new Error(
|
||||
`HTTP ${e.response.status} ${e.response.statusText} from ${e.response.url}\n\n${e.response.body}`,
|
||||
);
|
||||
} else {
|
||||
console.debug(
|
||||
`${e.message}\n\nCode: ${e.code}\nError number: ${e.errno}\nSyscall: ${e.erroredSysCall}\nType: ${e.type}\n\n${e.stack}`,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -89,9 +89,15 @@ class OpenAI extends BaseLLM {
|
|||
return model;
|
||||
}
|
||||
|
||||
private isO1Model(model?: string): boolean {
|
||||
return (
|
||||
!!model && (model.startsWith("o1-preview") || model.startsWith("o1-mini"))
|
||||
);
|
||||
}
|
||||
|
||||
protected _convertArgs(options: any, messages: ChatMessage[]) {
|
||||
const url = new URL(this.apiBase!);
|
||||
const finalOptions = {
|
||||
const finalOptions: any = {
|
||||
messages: messages.map(this._convertMessage),
|
||||
model: this._convertModelName(options.model),
|
||||
max_tokens: options.maxTokens,
|
||||
|
|
@ -99,6 +105,7 @@ class OpenAI extends BaseLLM {
|
|||
top_p: options.topP,
|
||||
frequency_penalty: options.frequencyPenalty,
|
||||
presence_penalty: options.presencePenalty,
|
||||
stream: options.stream ?? true,
|
||||
stop:
|
||||
// Jan + Azure OpenAI don't truncate and will throw an error
|
||||
this.maxStopWords !== undefined
|
||||
|
|
@ -113,6 +120,21 @@ class OpenAI extends BaseLLM {
|
|||
: options.stop,
|
||||
};
|
||||
|
||||
// OpenAI o1-preview and o1-mini:
|
||||
if (this.isO1Model(options.model)) {
|
||||
// a) use max_completion_tokens instead of max_tokens
|
||||
finalOptions.max_completion_tokens = options.maxTokens;
|
||||
finalOptions.max_tokens = undefined;
|
||||
|
||||
// b) don't support streaming currently
|
||||
finalOptions.stream = false;
|
||||
|
||||
// c) don't support system message
|
||||
finalOptions.messages = finalOptions.messages?.filter(
|
||||
(message: any) => message?.role !== "system",
|
||||
);
|
||||
}
|
||||
|
||||
return finalOptions;
|
||||
}
|
||||
|
||||
|
|
@ -216,12 +238,9 @@ class OpenAI extends BaseLLM {
|
|||
return;
|
||||
}
|
||||
|
||||
const body = {
|
||||
...this._convertArgs(options, messages),
|
||||
stream: true,
|
||||
};
|
||||
const body = this._convertArgs(options, messages);
|
||||
// Empty messages cause an error in LM Studio
|
||||
body.messages = body.messages.map((m) => ({
|
||||
body.messages = body.messages.map((m: any) => ({
|
||||
...m,
|
||||
content: m.content === "" ? " " : m.content,
|
||||
})) as any;
|
||||
|
|
@ -231,6 +250,13 @@ class OpenAI extends BaseLLM {
|
|||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
// Handle non-streaming response
|
||||
if (body.stream === false) {
|
||||
const data = await response.json();
|
||||
yield data.choices[0].message;
|
||||
return;
|
||||
}
|
||||
|
||||
for await (const value of streamSse(response)) {
|
||||
if (value.choices?.[0]?.delta?.content) {
|
||||
yield value.choices[0].delta;
|
||||
|
|
|
|||
|
|
@ -1,23 +1,15 @@
|
|||
import { CONTROL_PLANE_URL } from "../../../control-plane/client.js";
|
||||
import { ControlPlaneProxyInfo } from "../../../control-plane/analytics/IAnalyticsProvider.js";
|
||||
import type { LLMOptions, ModelProvider } from "../../../index.js";
|
||||
import OpenAI from "../OpenAI.js";
|
||||
|
||||
class ContinueProxy extends OpenAI {
|
||||
private _workOsAccessToken: string | undefined = undefined;
|
||||
|
||||
get workOsAccessToken(): string | undefined {
|
||||
return this._workOsAccessToken;
|
||||
set controlPlaneProxyInfo(value: ControlPlaneProxyInfo) {
|
||||
this.apiKey = value.workOsAccessToken;
|
||||
this.apiBase = new URL("openai/v1/", value.controlPlaneProxyUrl).toString();
|
||||
}
|
||||
|
||||
set workOsAccessToken(value: string | undefined) {
|
||||
if (this._workOsAccessToken !== value) {
|
||||
this._workOsAccessToken = value;
|
||||
this.apiKey = value;
|
||||
}
|
||||
}
|
||||
static providerName: ModelProvider = "continue-proxy";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: new URL("/model-proxy/v1", CONTROL_PLANE_URL).toString(),
|
||||
useLegacyCompletionsEndpoint: false,
|
||||
};
|
||||
|
||||
|
|
|
|||
16
core/package-lock.json
generated
16
core/package-lock.json
generated
|
|
@ -13,7 +13,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.10",
|
||||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
@ -25,8 +25,8 @@
|
|||
"cheerio": "^1.0.0-rc.12",
|
||||
"commander": "^12.0.0",
|
||||
"comment-json": "^4.2.3",
|
||||
"dbinfoz": "^0.1.4",
|
||||
"diff": "^7.0.0",
|
||||
"dbinfoz": "^0.11.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
"follow-redirects": "^1.15.5",
|
||||
|
|
@ -3130,9 +3130,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/llm-info": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/llm-info/-/llm-info-1.0.1.tgz",
|
||||
"integrity": "sha512-fmRXuOSwJ9ogBPSDduoedHF3WVg1rge3o8SRRg1hkUagRnxwZqtQj1sS5SjQyAqjQv6VPMGPDEtD77Za/hc4Jg=="
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/llm-info/-/llm-info-1.0.2.tgz",
|
||||
"integrity": "sha512-B5VFcZlwlwQg6htbIjCjj3z/pj3I929BzgWowiLzxYC40ag+v3e/hM9EDGWCEdNIT+PDMchAwS67iNB+WhE7qg=="
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.17.19",
|
||||
|
|
@ -6756,9 +6756,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/dbinfoz": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/dbinfoz/-/dbinfoz-0.1.4.tgz",
|
||||
"integrity": "sha512-MB56+xS571ip7qoXqxdnOUtXebbWaqoZN+S++W51SQYJRSjQFGEIPucNmxgeQlBGJ1vM4mQNV47wzV6fcrezZg==",
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/dbinfoz/-/dbinfoz-0.11.0.tgz",
|
||||
"integrity": "sha512-l7REBd9pwTBI6PWSk/dx+zCpSE2tiJdSKfApeoOajnSgyMJgkwGfhpPO2mV76MLQeKPaSm0mMKxmoqd38SaHmw==",
|
||||
"dependencies": {
|
||||
"mysql2": "^3.9.1",
|
||||
"pg": "^8.11.3",
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.10",
|
||||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
"cheerio": "^1.0.0-rc.12",
|
||||
"commander": "^12.0.0",
|
||||
"comment-json": "^4.2.3",
|
||||
"dbinfoz": "^0.1.4",
|
||||
"dbinfoz": "^0.11.0",
|
||||
"diff": "^7.0.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
|
|
|
|||
|
|
@ -22,6 +22,13 @@ export type ProtocolGeneratorType<T> = AsyncGenerator<{
|
|||
content: T;
|
||||
}>;
|
||||
|
||||
export type OnboardingModes =
|
||||
| "Local"
|
||||
| "Best"
|
||||
| "Custom"
|
||||
| "Quickstart"
|
||||
| "LocalAfterFreeTrial";
|
||||
|
||||
export interface ListHistoryOptions {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
|
|
@ -137,13 +144,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
"index/indexingProgressBarInitialized": [undefined, void];
|
||||
completeOnboarding: [
|
||||
{
|
||||
mode:
|
||||
| "local"
|
||||
| "apiKeys"
|
||||
| "custom"
|
||||
| "freeTrial"
|
||||
| "localAfterFreeTrial"
|
||||
| "bestExperience";
|
||||
mode: OnboardingModes;
|
||||
},
|
||||
void,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { ControlPlaneSessionInfo } from "../control-plane/client";
|
||||
import type {
|
||||
ContinueRcJson,
|
||||
DiffLine,
|
||||
FileType,
|
||||
IDE,
|
||||
IdeInfo,
|
||||
IdeSettings,
|
||||
IndexTag,
|
||||
|
|
@ -11,8 +11,12 @@ import type {
|
|||
Range,
|
||||
RangeInFile,
|
||||
Thread,
|
||||
IDE,
|
||||
} from "../";
|
||||
import { ControlPlaneSessionInfo } from "../control-plane/client";
|
||||
|
||||
export interface GetGhTokenArgs {
|
||||
force?: boolean;
|
||||
}
|
||||
|
||||
export type ToIdeFromWebviewOrCoreProtocol = {
|
||||
// Methods from IDE type
|
||||
|
|
@ -78,7 +82,7 @@ export type ToIdeFromWebviewOrCoreProtocol = {
|
|||
|
||||
gotoDefinition: [{ location: Location }, RangeInFile[]];
|
||||
|
||||
getGitHubAuthToken: [undefined, string | undefined];
|
||||
getGitHubAuthToken: [GetGhTokenArgs, string | undefined];
|
||||
getControlPlaneSessionInfo: [
|
||||
{ silent: boolean },
|
||||
ControlPlaneSessionInfo | undefined,
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & {
|
|||
setColors: [{ [key: string]: string }, void];
|
||||
"jetbrains/editorInsetRefresh": [undefined, void];
|
||||
addApiKey: [undefined, void];
|
||||
setupLocalModel: [undefined, void];
|
||||
setupLocalConfig: [undefined, void];
|
||||
incrementFtc: [undefined, void];
|
||||
openOnboarding: [undefined, void];
|
||||
openOnboardingCard: [undefined, void];
|
||||
applyCodeFromChat: [undefined, void];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import {
|
|||
ToastType,
|
||||
} from "../index.d.js";
|
||||
|
||||
import { GetGhTokenArgs } from "../protocol/ide.js";
|
||||
import { getContinueGlobalPath } from "./paths.js";
|
||||
|
||||
class FileSystemIde implements IDE {
|
||||
|
|
@ -50,7 +51,7 @@ class FileSystemIde implements IDE {
|
|||
enableDebugLogs: false,
|
||||
};
|
||||
}
|
||||
async getGitHubAuthToken(): Promise<string | undefined> {
|
||||
async getGitHubAuthToken(args: GetGhTokenArgs): Promise<string | undefined> {
|
||||
return undefined;
|
||||
}
|
||||
async getLastModified(files: string[]): Promise<{ [path: string]: number }> {
|
||||
|
|
@ -76,8 +77,8 @@ class FileSystemIde implements IDE {
|
|||
dirent.isDirectory()
|
||||
? (2 as FileType.Directory)
|
||||
: dirent.isSymbolicLink()
|
||||
? (64 as FileType.SymbolicLink)
|
||||
: (1 as FileType.File),
|
||||
? (64 as FileType.SymbolicLink)
|
||||
: (1 as FileType.File),
|
||||
]);
|
||||
return Promise.resolve(all);
|
||||
}
|
||||
|
|
|
|||
21
core/util/ideUtils.ts
Normal file
21
core/util/ideUtils.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { IDE } from "..";
|
||||
|
||||
export async function resolveRelativePathInWorkspace(
|
||||
path: string,
|
||||
ide: IDE,
|
||||
): Promise<string | undefined> {
|
||||
const pathSep = await ide.pathSep();
|
||||
if (path.startsWith(pathSep)) {
|
||||
return path;
|
||||
}
|
||||
|
||||
const workspaces = await ide.getWorkspaceDirs();
|
||||
for (const workspace of workspaces) {
|
||||
const fullPath = `${workspace}${pathSep}${path}`;
|
||||
if (await ide.fileExists(fullPath)) {
|
||||
return fullPath;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
|
@ -10,9 +10,11 @@ import type {
|
|||
Range,
|
||||
RangeInFile,
|
||||
Thread,
|
||||
ToastType,
|
||||
} from "../index.js";
|
||||
import { ToIdeFromWebviewOrCoreProtocol } from "../protocol/ide.js";
|
||||
import {
|
||||
GetGhTokenArgs,
|
||||
ToIdeFromWebviewOrCoreProtocol,
|
||||
} from "../protocol/ide.js";
|
||||
import { FromIdeProtocol } from "../protocol/index.js";
|
||||
|
||||
export class MessageIde implements IDE {
|
||||
|
|
@ -43,8 +45,8 @@ export class MessageIde implements IDE {
|
|||
getIdeSettings(): Promise<IdeSettings> {
|
||||
return this.request("getIdeSettings", undefined);
|
||||
}
|
||||
getGitHubAuthToken(): Promise<string | undefined> {
|
||||
return this.request("getGitHubAuthToken", undefined);
|
||||
getGitHubAuthToken(args: GetGhTokenArgs): Promise<string | undefined> {
|
||||
return this.request("getGitHubAuthToken", args);
|
||||
}
|
||||
getLastModified(files: string[]): Promise<{ [path: string]: number }> {
|
||||
return this.request("getLastModified", { files });
|
||||
|
|
@ -58,7 +60,7 @@ export class MessageIde implements IDE {
|
|||
|
||||
showToast: IDE["showToast"] = (...params) => {
|
||||
return this.request("showToast", params);
|
||||
}
|
||||
};
|
||||
|
||||
getRepoName(dir: string): Promise<string | undefined> {
|
||||
return this.request("getRepoName", { dir });
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ export class ReverseMessageIde {
|
|||
}
|
||||
|
||||
private initializeListeners() {
|
||||
this.on("getGitHubAuthToken", () => {
|
||||
return this.ide.getGitHubAuthToken();
|
||||
this.on("getGitHubAuthToken", (data) => {
|
||||
return this.ide.getGitHubAuthToken(data);
|
||||
});
|
||||
|
||||
this.on("getLastModified", (data) => {
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
# 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,594 +0,0 @@
|
|||
---
|
||||
title: Context Providers
|
||||
description: Type '@' to select content to the LLM as context
|
||||
keywords: [context, "@", provider, LLM]
|
||||
---
|
||||
|
||||
# Context Providers
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Using Github Enterprise Server
|
||||
|
||||
When using with Github Enterprise Server, you can set the `domain` parameter to your server's hostname. By default this is set to `github.com`.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "issue",
|
||||
"params": {
|
||||
"repos": [
|
||||
{
|
||||
"owner": "continuedev",
|
||||
"repo": "continue"
|
||||
}
|
||||
],
|
||||
"githubToken": "ghp_xxx",
|
||||
"domain": "github.acme-inc.com"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 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,19 +0,0 @@
|
|||
---
|
||||
title: Other Configuration
|
||||
description: Swap out different LLM providers
|
||||
keywords: [temperature, custom policies, custom system message]
|
||||
---
|
||||
|
||||
# Other Configuration
|
||||
|
||||
See the [config.json Reference](../reference/config) for the full list of configuration options.
|
||||
|
||||
## Customize System Message
|
||||
|
||||
You can write your own system message, a set of instructions that will always be top-of-mind for the LLM, by setting the `systemMessage` property to any string. For example, you might request "Please make all responses as concise as possible and never repeat something you have already explained."
|
||||
|
||||
System messages can also reference files. For example, if there is a markdown file (e.g. at `/Users/nate/Documents/docs/reference.md`) you'd like the LLM to know about, you can reference it with [Mustache](http://mustache.github.io/mustache.5.html) templating like this: "Please reference this documentation: \{\{ Users/nate/Documents/docs/reference.md \}\}". As of now, you must use an absolute path.
|
||||
|
||||
## Temperature
|
||||
|
||||
Set `temperature` to any value between 0 and 1. Higher values will make the LLM more creative, while lower values will make it more predictable. The default is 0.5.
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
title: Overview
|
||||
description: Continue can be deeply customized
|
||||
keywords: [custom, slash commands, models, context providers]
|
||||
---
|
||||
|
||||
# Overview
|
||||
|
||||
Continue can be deeply customized by editing `config.json` and `config.ts` on your machine. You can find these files in the `~/.continue/` directory on MacOS and the `%userprofile%\.continue` directory on Windows. These files are created the first time you run Continue.
|
||||
|
||||
Currently, you can customize the following:
|
||||
|
||||
- [Models](../setup/select-model.md) and [Model Providers](../setup/model-providers.md)
|
||||
- [Context Providers](./context-providers.md)
|
||||
- [Slash Commands](./slash-commands.md)
|
||||
- [Other configuration options](../reference/config.mdx)
|
||||
|
||||
If you'd like to share Continue configuration with others, you can add a `.continuerc.json` to the root of your project. It has the same JSON Schema definition as `config.json`, and will automatically be applied on top of the local `config.json`.
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
---
|
||||
title: Slash Commands
|
||||
description: Shortcuts that can be activated by prefacing your input with '/'
|
||||
keywords: [slash command, custom commands, step]
|
||||
---
|
||||
|
||||
# Slash Commands
|
||||
|
||||
Slash commands are shortcuts that can be activated by typing '/' and selecting from the dropdown. For example, the built-in '/edit' slash command lets you stream edits directly into your editor.
|
||||
|
||||

|
||||
|
||||
## Built-in Slash Commands
|
||||
|
||||
To use any of the built-in slash commands, open `~/.continue/config.json` and add it to the `slashCommands` list.
|
||||
|
||||
### `/edit`
|
||||
|
||||
Select code with ctrl/cmd + L (VS Code) or ctrl/cmd + J (JetBrains), and then type "/edit", followed by instructions for the edit. Continue will stream the changes into a side-by-side diff editor.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "edit",
|
||||
"description": "Edit highlighted code"
|
||||
}
|
||||
```
|
||||
|
||||
### `/comment`
|
||||
|
||||
Comment works just like /edit, except it will automatically prompt the LLM to comment the code.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "comment",
|
||||
"description": "Write comments for the highlighted code"
|
||||
}
|
||||
```
|
||||
|
||||
### `/share`
|
||||
|
||||
Type "/share" to generate a shareable markdown transcript of your current chat history.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "share",
|
||||
"description": "Export the current chat session to markdown",
|
||||
"params": { "outputDir": "~/.continue/session-transcripts" }
|
||||
}
|
||||
```
|
||||
|
||||
Use the `outputDir` parameter to specify where you want to the markdown file to be saved.
|
||||
|
||||
### `/cmd`
|
||||
|
||||
Generate a shell command from natural language and (only in VS Code) automatically paste it into the terminal.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "cmd",
|
||||
"description": "Generate a shell command"
|
||||
}
|
||||
```
|
||||
|
||||
### `/commit`
|
||||
|
||||
Shows the LLM your current git diff and asks it to generate a commit message.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "commit",
|
||||
"description": "Generate a commit message for the current changes"
|
||||
}
|
||||
```
|
||||
|
||||
### `/http`
|
||||
|
||||
Write a custom slash command at your own HTTP endpoint. Set 'url' in the params object for the endpoint you have setup. The endpoint should return a sequence of string updates, which will be streamed to the Continue sidebar. See our basic [FastAPI example](https://github.com/continuedev/continue/blob/74002369a5e435735b83278fb965e004ae38a97d/core/context/providers/context_provider_server.py#L34-L45) for reference.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "http",
|
||||
"description": "Does something custom",
|
||||
"params": { "url": "<my server endpoint>" }
|
||||
}
|
||||
```
|
||||
|
||||
### `/issue`
|
||||
|
||||
Describe the issue you'd like to generate, and Continue will turn into a well-formatted title and body, then give you a link to the draft so you can submit. Make sure to set the URL of the repository you want to generate issues for.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "issue",
|
||||
"description": "Generate a link to a drafted GitHub issue",
|
||||
"params": { "repositoryUrl": "https://github.com/continuedev/continue" }
|
||||
}
|
||||
```
|
||||
|
||||
### `/so`
|
||||
|
||||
The StackOverflow slash command will automatically pull results from StackOverflow to answer your question, quoting links along with its answer.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "so",
|
||||
"description": "Reference StackOverflow to answer the question"
|
||||
}
|
||||
```
|
||||
|
||||
### `/onboard`
|
||||
|
||||
The Onboard slash command helps to familiarize yourself with a new project by analyzing the project structure, READMEs, and dependency files. It identifies key folders, explains their purpose, and highlights popular packages used. Additionally, it offers insights into the project's architecture.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "onboard",
|
||||
"description": "Familiarize yourself with the codebase"
|
||||
}
|
||||
```
|
||||
|
||||
## Custom Slash Commands
|
||||
|
||||
There are two ways to add custom slash commands:
|
||||
|
||||
1. With natural language prompts - this is simpler and only requires writing a string or string template.
|
||||
2. With a custom function - this gives you full access to the Continue SDK and allows you to write arbitrary Typescript code.
|
||||
|
||||
### "Custom Commands" (Use Natural Language)
|
||||
|
||||
You can add custom slash commands by adding to the `customCommands` property in `config.json`.
|
||||
|
||||
- `name`: the name of the command, which will be invoked with `/name`
|
||||
- `description`: a short description of the command, which will appear in the dropdown
|
||||
- `prompt`: a templated prompt to send to the LLM
|
||||
|
||||
Custom commands are great when you are frequently reusing a prompt. For example, if you've crafted a great prompt and frequently ask the LLM to check for mistakes in your code, you could add a command like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
customCommands=[{
|
||||
"name": "check",
|
||||
"description": "Check for mistakes in my code",
|
||||
"prompt": "{{{ input }}}\n\nPlease read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:\n- Syntax errors\n- Logic errors\n- Security vulnerabilities\n- Performance issues\n- Anything else that looks wrong\n\nOnce you find an error, please explain it as clearly as possible, but without using extra words. For example, instead of saying 'I think there is a syntax error on line 5', you should say 'Syntax error on line 5'. Give your answer as one bullet point per mistake found."
|
||||
}]
|
||||
```
|
||||
|
||||
#### Templating
|
||||
|
||||
The `prompt` property supports templating with Handlebars syntax. You can use the following variables:
|
||||
|
||||
- `input` (used in the example above): any additional input entered with the slash command. For example, if you type `/test only write one test`, `input` will be `only write one test`. This will also include highlighted code blocks.
|
||||
- File names: You can reference any file by providing an absolute path or a path relative to the current working directory.
|
||||
|
||||
### Custom Slash Commands
|
||||
|
||||
If you want to go a step further than writing custom commands with natural language, you can write a custom function that returns the response. This requires using `config.ts` instead of `config.json`.
|
||||
|
||||
To do this, push a new `SlashCommand` object to the `slashCommands` list. This object contains "name", the name that you will type to invoke the slash command, "description", the description seen in the dropdown menu, and "run". The `run` function is any async generator that should yield strings as you want them to be streamed to the UI. As an argument to the function, you have access to a `ContinueSDK` object with utilities such as access to certain information/actions within the IDE, the current language model, and a few other utilities. For example, here is a slash command that generates a commit message:
|
||||
|
||||
```typescript title="~/.continue/config.ts"
|
||||
export function modifyConfig(config: Config): Config {
|
||||
config.slashCommands?.push({
|
||||
name: "commit",
|
||||
description: "Write a commit message",
|
||||
run: async function* (sdk) {
|
||||
const diff = await sdk.ide.getDiff();
|
||||
for await (const message of sdk.llm.streamComplete(
|
||||
`${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`,
|
||||
{
|
||||
maxTokens: 20,
|
||||
},
|
||||
)) {
|
||||
yield message;
|
||||
}
|
||||
},
|
||||
});
|
||||
return config;
|
||||
}
|
||||
```
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
title: 📝 Changelog
|
||||
title: Changelog
|
||||
description: Changelogs for the latest releases of the VSCode and JetBrains extensions
|
||||
keywords: [changelog]
|
||||
hide_table_of_contents: true
|
||||
---
|
||||
|
||||
import VSCodeChangelog from "../../extensions/vscode/CHANGELOG.md";
|
||||
import IntelliJChangelog from "../../extensions/intellij/CHANGELOG.md";
|
||||
import VSCodeChangelog from "../../../extensions/vscode/CHANGELOG.md";
|
||||
import JetBrainsChangelog from "../../../extensions/intellij/CHANGELOG.md";
|
||||
|
||||
Below are the changelogs for the latest releases of the VSCode and JetBrains extensions. Prior to 2024-07-02, the changelogs do not reflect all updates.
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ import TOCInline from "@theme/TOCInline";
|
|||
<TOCInline
|
||||
toc={toc.filter(
|
||||
(node) =>
|
||||
node.value === "VSCode Changelog" || node.value === "IntelliJ Changelog",
|
||||
node.value === "VSCode Changelog" || node.value === "JetBrains Changelog",
|
||||
)}
|
||||
/>
|
||||
|
||||
|
|
@ -25,6 +25,6 @@ import TOCInline from "@theme/TOCInline";
|
|||
|
||||
<VSCodeChangelog />
|
||||
|
||||
## IntelliJ Changelog
|
||||
## JetBrains Changelog
|
||||
|
||||
<IntelliJChangelog />
|
||||
<JetBrainsChangelog />
|
||||
|
|
@ -1,9 +1,16 @@
|
|||
---
|
||||
title: config.json Reference
|
||||
keywords: [config.json, configuration, options]
|
||||
---
|
||||
|
||||
import Schema from "@site/static/schemas/config.json";
|
||||
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
|
||||
|
||||
# Configuration Options
|
||||
# Configuration options
|
||||
|
||||
The following shows the JSON Schema definition for `config.json`. You can also define a partial `config.json` object in a file called `.continuerc.json` at the root of your workspace. This will be [applied on top of](https://github.com/continuedev/continue/blob/74c1eb5e25c517c575f72d26227d31d5d2ea18ed/extensions/vscode/src/ideProtocol.ts#L165-L173) any configuration from `config.json`.
|
||||
The following shows the JSON Schema definition for `config.json`.
|
||||
|
||||
You can also define a partial `config.json` object in a file called `.continuerc.json` at the root of your workspace. This will be applied on top of any configuration from `config.json`.
|
||||
|
||||
<JSONSchemaViewer
|
||||
schema={Schema}
|
||||
445
docs/docs/customize/context-providers.md
Normal file
445
docs/docs/customize/context-providers.md
Normal file
|
|
@ -0,0 +1,445 @@
|
|||
---
|
||||
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 `config.json` and add it to the `contextProviders` list.
|
||||
|
||||
### Files
|
||||
|
||||
Type '@file' to reference any file in your current workspace.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "file"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Code
|
||||
|
||||
Type '@code' to reference specific functions or classes from throughout your project.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "diff"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Terminal
|
||||
|
||||
Type '@terminal' to reference the contents of your IDE's terminal.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "terminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Documentation
|
||||
|
||||
Type `@docs` to index and retrieve snippets from any documentation site.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
To learn more, visit `[@docs](../customize/deep-dives/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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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](../customize/deep-dives/codebase.md).
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "codebase"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Folders
|
||||
|
||||
Type '@folder' to use the same retrieval mechanism as '@codebase', but only on a single folder.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "search"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### URL
|
||||
|
||||
Type '@url' and input a URL, then Continue will convert it to a markdown document to pass to the model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "jira",
|
||||
"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 title="config.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 title="config.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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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 title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "repo-map"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Operating System
|
||||
|
||||
Type `@os` to reference the architecture and platform of your current operating system.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"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,8 +1,9 @@
|
|||
# Tab Autocomplete (beta)
|
||||
---
|
||||
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).
|
||||
|
||||
## Setting up with Codestral (recommended)
|
||||
### Setting up with Codestral (recommended)
|
||||
|
||||
If you want to have the best autocomplete experience, we recommend using Codestral, which is available through the [Mistral API](https://console.mistral.ai/). To do this, obtain an API key and add it to your `config.json`:
|
||||
|
||||
|
|
@ -17,9 +18,9 @@ If you want to have the best autocomplete experience, we recommend using Codestr
|
|||
}
|
||||
```
|
||||
|
||||
## Setting up with Ollama (default)
|
||||
### Setting up with Ollama (default)
|
||||
|
||||
We recommend setting up tab-autocomplete with a local Ollama instance. To do this, first download the latest version of Ollama from [here](https://ollama.ai). Then, run the following command to download our recommended model:
|
||||
If you'd like to run your autocomplete model locally, we recommend using Ollama. To do this, first download the latest version of Ollama from [here](https://ollama.ai). Then, run the following command to download our recommended model:
|
||||
|
||||
```bash
|
||||
ollama run starcoder2:3b
|
||||
|
|
@ -27,35 +28,11 @@ ollama run starcoder2:3b
|
|||
|
||||
Once it has been downloaded, you should begin to see completions in VS Code.
|
||||
|
||||
## Setting up with LM Studio
|
||||
|
||||
You can also set up tab-autocomplete with a local LM Studio instance by following these steps:
|
||||
|
||||
1. Download the latest version of LM Studio from [here](https://lmstudio.ai/)
|
||||
2. Download a model (e.g. search for `second-state/StarCoder2-3B-GGUF` and choose one of the options there)
|
||||
3. Go to the server section (button is on the left), select your model from the dropdown at the top, and click "Start Server"
|
||||
4. Go to the "My Models" section (button is on the left), find your selected model, and copy the name the path (example: `second-state/StarCoder2-3B-GGUF/starcoder2-3b-Q8_0.gguf`); this will be used as the "model" attribute in Continue
|
||||
5. Go to Continue and modify the configurations for a [custom model](#setting-up-a-custom-model)
|
||||
6. Set the "provider" to `lmstudio` and the "model" to the path copied earlier
|
||||
|
||||
Example:
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Starcoder2 3b",
|
||||
"model": "second-state/StarCoder2-3B-GGUF/starcoder2-3b-Q8_0.gguf",
|
||||
"provider": "lmstudio",
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Setting up a custom model
|
||||
### Setting up a custom model
|
||||
|
||||
All of the configuration options available for chat models are available to use for tab-autocomplete. For example, if you wanted to use a remote Ollama instance you would edit your `config.json` like this (note that it is not inside the models array):
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
|
|
@ -67,17 +44,7 @@ All of the configuration options available for chat models are available to use
|
|||
}
|
||||
```
|
||||
|
||||
If you aren't yet familiar with the available options, you can learn more in our [overview](../setup/overview.md).
|
||||
|
||||
### What model should I use?
|
||||
|
||||
If you are running the model locally, we recommend `starcoder2:3b`.
|
||||
|
||||
If you find it to be too slow, you should try `deepseek-coder:1.3b-base`.
|
||||
|
||||
If you have a bit more compute, or are running a model in the cloud, you can upgrade to `deepseek-coder:6.7b-base`.
|
||||
|
||||
Regardless of what you are willing to spend, we do not recommend using GPT or Claude for autocomplete. Learn why [below](#i-want-better-completions-should-i-use-gpt-4).
|
||||
If you aren't yet familiar with the available options, you can find the full reference [here](../config.mdx).
|
||||
|
||||
## Configuration Options
|
||||
|
||||
|
|
@ -106,7 +73,7 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
|
|||
|
||||
### Full example
|
||||
|
||||
```json title=~/.continue/config.json
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
|
|
@ -115,14 +82,14 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
|
|||
"apiBase": "https://<my endpoint>"
|
||||
},
|
||||
"tabAutocompleteOptions": {
|
||||
"useCopyBuffer": false,
|
||||
"maxPromptTokens": 400,
|
||||
"prefixPercentage": 0.5
|
||||
"debounceDelay": 500,
|
||||
"maxPromptTokens": 1500,
|
||||
"disableInFiles": ["*.md"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
## FAQs
|
||||
|
||||
### I want better completions, should I use GPT-4?
|
||||
|
||||
|
|
@ -144,20 +111,10 @@ Follow these steps to ensure that everything is set up correctly:
|
|||
|
||||
Depending on your hardware, you may want to try a smaller, faster model. If 3b isn't working for you we recommend trying `deepseek-coder:1.3b-base`.
|
||||
|
||||
### Completions don't know about my code
|
||||
|
||||
We are working on this! Right now Continue uses the Language Server Protocol to add definitions to the prompt, as well as using similarity search over recently edited files. We will be improving the accuracy of this system greatly over the next few weeks.
|
||||
|
||||
### Completions contain formatting errors
|
||||
|
||||
If you're seeing a common pattern of mistake that might be helpful to report, please share in Discord. We will do our best to fix it as soon as possible.
|
||||
|
||||
### Completions are only ever single-line
|
||||
|
||||
To ensure that you receive multi-line completions, you can set `"multilineCompletions": "always"` in `tabAutocompleteOptions`. By default, it is `"auto"`. If you still find that you are only seeing single-line completions, this may be because some models tend to produce shorter completions when starting in the middle of a file. You can try temporarily moving text below your cursor out of your active file, or switching to a larger model.
|
||||
|
||||
## FAQs
|
||||
|
||||
### Can I configure a "trigger key" for autocomplete?
|
||||
|
||||
Yes, in VS Code, if you don't want to be shown suggestions automatically you can:
|
||||
|
|
@ -184,6 +141,6 @@ Alternatively, open VS Code settings, search for "Continue" and uncheck the box
|
|||
|
||||
Open Settings -> Tools -> Continue and uncheck the box for "Enable Tab Autocomplete".
|
||||
|
||||
## Feedback
|
||||
#### Feedback
|
||||
|
||||
If you're turning off autocomplete, we'd love to hear how we can improve! Please let us know in our [Discord](https://discord.gg/vapESyrFmJ) or file an issue on GitHub.
|
||||
72
docs/docs/customize/deep-dives/codebase.md
Normal file
72
docs/docs/customize/deep-dives/codebase.md
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
description: Talk to your codebase
|
||||
keywords: [talk, embeddings, reranker, codebase, experimental]
|
||||
---
|
||||
|
||||
# @codebase
|
||||
|
||||
Continue indexes your codebase so that it can later automatically pull in the most relevant context from throughout your workspace. This is done via a combination of embeddings-based retrieval and keyword search. By default, all embeddings are calculated locally with `all-MiniLM-L6-v2` and stored locally in `~/.continue/index`.
|
||||
|
||||
Currently, the codebase retrieval feature is available as the "codebase" and "folder" context providers. You can use them by typing `@codebase` or `@folder` in the input box, and then asking a question. The contents of the input box will be compared with the embeddings from the rest of the codebase (or folder) to determine relevant files.
|
||||
|
||||
Here are some common use cases where it can be useful:
|
||||
|
||||
- Asking high-level questions about your codebase
|
||||
- "How do I add a new endpoint to the server?"
|
||||
- "Do we use VS Code's CodeLens feature anywhere?"
|
||||
- "Is there any code written already to convert HTML to markdown?"
|
||||
- Generate code using existing samples as reference
|
||||
- "Generate a new React component with a date picker, using the same patterns as existing components"
|
||||
- "Write a draft of a CLI application for this project using Python's argparse"
|
||||
- "Implement the `foo` method in the `bar` class, following the patterns seen in other subclasses of `baz`.
|
||||
- Use `@folder` to ask questions about a specific folder, increasing the likelihood of relevant results
|
||||
- "What is the main purpose of this folder?"
|
||||
- "How do we use VS Code's CodeLens API?"
|
||||
- Or any of the above examples, but with `@folder` instead of `@codebase`
|
||||
|
||||
Here are use cases where it is not useful:
|
||||
|
||||
- When you need the LLM to see _literally every_ file in your codebase
|
||||
- "Find everywhere where the `foo` function is called"
|
||||
- "Review our codebase and find any spelling mistakes"
|
||||
- Refactoring
|
||||
- "Add a new parameter to the `bar` function and update usages"
|
||||
|
||||
## Configuration
|
||||
|
||||
There are a few options that let you configure the behavior of the codebase context provider. These can be set in `config.json`, and are the same for the codebase and folder context providers:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "codebase",
|
||||
"params": {
|
||||
"nRetrieve": 25,
|
||||
"nFinal": 5,
|
||||
"useReranking": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `nRetrieve`
|
||||
|
||||
Number of results to initially retrieve from vector database (default: 25)
|
||||
|
||||
### `nFinal`
|
||||
|
||||
Final number of results to use after re-ranking (default: 5)
|
||||
|
||||
### `useReranking`
|
||||
|
||||
Whether to use re-ranking, which will allow initial selection of `nRetrieve` results, then will use an LLM to select the top `nFinal` results (default: true)
|
||||
|
||||
## Ignore files during indexing
|
||||
|
||||
Continue respects `.gitignore` files in order to determine which files should not be indexed. If you'd like to exclude additional files, you can add them to a `.continueignore` file, which follows the exact same rules as `.gitignore`.
|
||||
|
||||
If you want to see exactly what files Continue has indexed, the metadata is stored in `~/.continue/index/index.sqlite`. You can use a tool like [DB Browser for SQLite](https://sqlitebrowser.org/) to view the `tag_catalog` table within this file.
|
||||
|
||||
If you need to force a refresh of the index, reload the VS Code window with `cmd/ctrl + shift + p` + "Reload Window".
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
---
|
||||
title: Talk To Your Docs
|
||||
description: Learn how to access and search your project's documentation directly within Continue
|
||||
keywords: [documentation, indexing, context provider, embeddings]
|
||||
keywords: [documentation, indexing, context provider, embeddings, docs]
|
||||
toc_max_heading_level: 5
|
||||
---
|
||||
|
||||
# @docs
|
||||
|
||||
The [`@docs` context provider](http://localhost:3000/customization/context-providers#documentation) allows you to interact with your documentation directly within Continue. This feature enables you to index any static site or GitHub markdown pages, making it easier to access and utilize your documentation while coding.
|
||||
|
||||
## Enabling the `@docs` context provider
|
||||
|
|
@ -73,7 +74,7 @@ By default, we use a lighter weight tool to crawl documentation sites that canno
|
|||
|
||||
If you want to crawl a site that is dynamically generated, or you get an error while attempting to crawl a site, you can enable the experimental `useChromiumForDocsCrawling` feature in your `config.json`. This will download and install Chromium to `~/.continue/.utils`.
|
||||
|
||||
```json title=config.json
|
||||
```json title="config.json"
|
||||
"experimental": {
|
||||
"useChromiumForDocsCrawling": true
|
||||
}
|
||||
|
|
@ -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.
|
||||
|
||||
|
|
@ -33,7 +35,7 @@ Write unit tests for the above selected code, following each of these instructio
|
|||
- Don't explain how to set up `jest`
|
||||
```
|
||||
|
||||
Now to use this prompt, you can highlight code and use `cmd/ctrl+L` to select it in the Continue sidebar.
|
||||
Now to use this prompt, you can highlight code and use `cmd/ctrl + L` to select it in the Continue sidebar.
|
||||
|
||||
Then, type "/" to see the list of slash commands and choose the one called "test". Press enter and the LLM will respond given the instructions from your prompt file.
|
||||
|
||||
|
|
@ -77,7 +79,7 @@ The following built-in variables are currently available:
|
|||
|
||||
### Context providers
|
||||
|
||||
Any [context provider](../customization/context-providers.md) that you have added to your config can be referenced using the name of the context provider. Context providers that receive an input are also supported.
|
||||
Any [context provider](../context-providers.md) that you have added to your config can be referenced using the name of the context provider. Context providers that receive an input are also supported.
|
||||
|
||||
- `{{{ terminal }}}` - The contents of the terminal
|
||||
- `{{{ url "https://github.com/continuedev/continue" }}}` - The contents of a URL
|
||||
9
docs/docs/customize/development-data.md
Normal file
9
docs/docs/customize/development-data.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
title: Development data
|
||||
description: Collecting data on how you build software
|
||||
keywords: [development data, dev data, LLM-aided development]
|
||||
---
|
||||
|
||||
When you use Continue, you automatically collect data on how you build software. By default, this development data is saved to `.continue/dev_data` on your local machine. When combined with the code that you ultimately commit, it can be used to improve the LLM that you or your team use (if you allow).
|
||||
|
||||
You can read more about how development data is generated as a byproduct of LLM-aided development and why we believe that you should start collecting it now: [It’s time to collect data on how you build software](https://blog.continue.dev/its-time-to-collect-data-on-how-you-build-software)
|
||||
|
Before Width: | Height: | Size: 858 KiB After Width: | Height: | Size: 858 KiB |
|
|
@ -1,8 +1,8 @@
|
|||
# SambaNova Cloud
|
||||
|
||||
The SambaNova Cloud is a cloud platform for running large AI models with the world record Llama 3.1 70B/405B performance. You can sign up [here](https://cloud.sambanova.ai/), copy your API key on the initial welcome screen, and then hit the play button on any model from the [model list](https://community.sambanova.ai/t/quick-start-guide/104). Change `~/.continue/config.json` to look like this:
|
||||
The SambaNova Cloud is a cloud platform for running large AI models with the world record Llama 3.1 70B/405B performance. You can sign up [here](https://cloud.sambanova.ai/), copy your API key on the initial welcome screen, and then hit the play button on any model from the [model list](https://community.sambanova.ai/t/quick-start-guide/104).
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Cloudflare Workers AI can be used for both chat and tab autocompletion in Continue. To setup Cloudflare Workers AI, add the following to your `config.json` file:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
56
docs/docs/customize/model-providers/more/cohere.md
Normal file
56
docs/docs/customize/model-providers/more/cohere.md
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# Cohere
|
||||
|
||||
Before using Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **Command-R Plus** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Cohere",
|
||||
"provider": "cohere",
|
||||
"model": "command-r-plus",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
Cohere currently does not offer any autocomplete models.
|
||||
|
||||
[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **embed-english-v3.0** as your embeddings model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "cohere",
|
||||
"model": "embed-english-v3.0",
|
||||
"apiKey": "<COHERE_API_KEY>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
We recommend configuring **rerank-english-v3.0** as your reranking model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "cohere",
|
||||
"params": {
|
||||
"model": "rerank-english-v3.0",
|
||||
"apiKey": "<COHERE_API_KEY>"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[DeepInfra](https://deepinfra.com) provides inference for open-source models at very low cost. To get started with DeepInfra, obtain your API key [here](https://deepinfra.com/dash). Then, find the model you want to use [here](https://deepinfra.com/models?type=text-generation) and copy the name of the model. Continue can then be configured to use the `DeepInfra` LLM class, like the example here:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[Flowise](https://flowiseai.com/) is a low-code/no-code drag & drop tool with the aim to make it easy for people to visualize and build LLM apps. Continue can then be configured to use the `Flowise` LLM class, like the example here:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
31
docs/docs/customize/model-providers/more/free-trial.md
Normal file
31
docs/docs/customize/model-providers/more/free-trial.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
title: Free Trial
|
||||
slug: ../free-trial
|
||||
---
|
||||
|
||||
The `"free-trial"` provider lets new users quickly try out the best experience in Continue using our API keys through a secure proxy server. To prevent abuse, we will ask you to sign in with GitHub, which you can read more about below.
|
||||
|
||||
While the Continue extension is always free to use, we cannot support infinite free LLM usage for all of our users. You will eventually need to either:
|
||||
|
||||
1. Select an open-source model to use for free [locally](../top-level/ollama.md), or
|
||||
2. Add your own API key for [Anthropic](../top-level/anthropic.md) or [another LLM provider](/customize/model-providers)
|
||||
|
||||
## FAQ about the trial
|
||||
|
||||
Continue asks free trial users to sign in so that we can prevent abuse of our API endpoints. If you are not using the free trial, we will not ask you to sign in.
|
||||
|
||||
### How do I stop Continue from asking me to sign in?
|
||||
|
||||
Remove all models from the "models" array or "tabAutocompleteModel" with `"provider": "free-trial"`, and we will never request sign in.
|
||||
|
||||
### What information is collected?
|
||||
|
||||
Continue uses your GitHub username and no other information, for the sole purpose of limiting requests.
|
||||
|
||||
### What happens if I don't sign in?
|
||||
|
||||
If you don't sign in, you can still use every feature of Continue, you will just need to provide your own LLM either with an API key or by running a local model.
|
||||
|
||||
### How is telemetry related to sign in?
|
||||
|
||||
It is not. We do not link your GitHub username to telemetry data.
|
||||
19
docs/docs/customize/model-providers/more/groq.md
Normal file
19
docs/docs/customize/model-providers/more/groq.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Groq
|
||||
|
||||
Groq provides the fastest available inference for open-source language models, including the entire Llama 3.1 family.
|
||||
|
||||
1. Obtain an API key [here](https://console.groq.com/keys)
|
||||
2. Update your Continue config file like this:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 405b",
|
||||
"provider": "groq",
|
||||
"model": "llama3.1-405b",
|
||||
"apiKey": "<API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Hugging Face Inference Endpoints are an easy way to setup instances of open-source language models on any cloud. Sign up for an account and add billing [here](https://huggingface.co/settings/billing), access the Inference Endpoints [here](https://ui.endpoints.huggingface.co), click on “New endpoint”, and fill out the form (e.g. select a model like [WizardCoder-Python-34B-V1.0](https://huggingface.co/WizardLM/WizardCoder-Python-34B-V1.0)), and then deploy your model by clicking “Create Endpoint”. Change `~/.continue/config.json` to look like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
IPEX-LLM supports accelerated Ollama backend to be hosted on Intel GPU. Refer to [this guide](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/ollama_quickstart.html) from IPEX-LLM official documentation about how to install and run Ollama serve accelerated by IPEX-LLM on Intel GPU. You can then configure Continue to use the IPEX-LLM accelerated `"ollama"` provider as follows:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@ IPEX-LLM supports accelerated Ollama backend to be hosted on Intel GPU. Refer to
|
|||
|
||||
If you would like to reach the Ollama service from another machine, make sure you set or export the environment variable `OLLAMA_HOST=0.0.0.0` before executing the command `ollama serve`. Then, in the Continue configuration, set `'apiBase'` to correspond with the IP address / port of the remote machine. That is, Continue can be configured to be:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -34,6 +34,7 @@ If you would like to reach the Ollama service from another machine, make sure yo
|
|||
```
|
||||
|
||||
:::tip
|
||||
- For more configuration options regarding completion or authentication, you could refer to [here](./ollama.md#completion-options) for Ollama provider.
|
||||
- If you would like to preload the model before your first conversation with that model in Continue, you could refer to [here](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/continue_quickstart.html#pull-and-prepare-the-model) for more information.
|
||||
|
||||
If you would like to preload the model before your first conversation with that model in Continue, you could refer to [here](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/continue_quickstart.html#pull-and-prepare-the-model) for more information.
|
||||
|
||||
:::
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
# Kindo
|
||||
|
||||
Kindo offers centralized control over your organization's AI operations, ensuring data protection and compliance with internal policies while supporting various commercial and open-source models. To get started, sign up [here](https://app.kindo.ai/), create your API key on the [API keys page](https://app.kindo.ai/settings/api), and choose a model from the list of supported models in the [plugins tab](https://app.kindo.ai/plugins).
|
||||
|
||||
## Config Example
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -18,7 +19,7 @@ Kindo offers centralized control over your organization's AI operations, ensurin
|
|||
|
||||
## Tab Autocomplete Config Example
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": [
|
||||
{
|
||||
|
|
@ -39,4 +40,4 @@ Kindo offers centralized control over your organization's AI operations, ensurin
|
|||
|
||||
## Security
|
||||
|
||||
To update your organization's model access, adjust the controls in [security settings](https://app.kindo.ai/security-settings).
|
||||
To update your organization's model access, adjust the controls in [security settings](https://app.kindo.ai/security-settings).
|
||||
|
|
@ -8,7 +8,7 @@ Run the llama.cpp server binary to start the API server. If running on a remote
|
|||
|
||||
After it's up and running, change `~/.continue/config.json` to look like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contained binary that can run an open-source LLM. You can configure this provider in your config.json as follows:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[LM Studio](https://lmstudio.ai) is an application for Mac, Windows, and Linux that makes it easy to locally run open-source models and comes with a great UI. To get started with LM Studio, download from the website, use the UI to download a model, and then start the local inference server. Continue can then be configured to use the `LMStudio` LLM class:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
}
|
||||
```
|
||||
|
||||
### Setting up a remote instance
|
||||
## Setting up a remote instance
|
||||
|
||||
To configure a remote instance of LM Studio, add the `"apiBase"` property to your model in config.json:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"title": "LM Studio",
|
||||
"model": "codestral",
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[Msty](https://msty.app/) is an application for Windows, Mac, and Linux that makes it really easy to run online as well as local open-source models, including Llama-2, DeepSeek Coder, etc. No need to fidget with your terminal, run a command, or anything. Just download the app from the website, click a button, and you are up and running. Continue can then be configured to use the `Msty` LLM class:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -29,7 +29,7 @@ In addition to the model type, you can also configure some of the parameters tha
|
|||
|
||||
If you need to send custom headers for authentication, you may use the `requestOptions.headers` property like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -4,7 +4,7 @@ OpenRouter is a unified interface for commercial and open-source models, giving
|
|||
|
||||
Change `~/.continue/config.json` to look like the following.
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -22,7 +22,7 @@ To utilize features such as provider preferences or model routing configuration,
|
|||
|
||||
For example, to prevent extra long prompts from being compressed, you can explicitly turn off the feature like so:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Replicate is a great option for newly released language models or models that you've deployed through their platform. Sign up for an account [here](https://replicate.ai/), copy your API key, and then select any model from the [Replicate Streaming List](https://replicate.com/collections/streaming-language-models). Change `~/.continue/config.json` to look like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
# AWS SageMaker
|
||||
# AWS SageMaker
|
||||
|
||||
SageMaker provider support SageMaker endpoint deployed with [LMI](https://docs.djl.ai/docs/serving/serving/docs/lmi/index.html)
|
||||
|
||||
To setup SageMaker, add the following to your `config.json` file:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -12,19 +12,19 @@ To setup SageMaker, add the following to your `config.json` file:
|
|||
"provider": "sagemaker",
|
||||
"model": "lmi-model-deepseek-coder-xxxxxxx",
|
||||
"region": "us-west-2"
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The value in model should be the SageMaker endpoint name you deployed.
|
||||
|
||||
Authentication will be through temporary or long-term credentials in
|
||||
Authentication will be through temporary or long-term credentials in
|
||||
~/.aws/credentials under a profile called "sagemaker".
|
||||
|
||||
```title="~/.aws/credentials
|
||||
[sagemaker]
|
||||
aws_access_key_id = abcdefg
|
||||
aws_secret_access_key = hijklmno
|
||||
aws_session_token = pqrstuvwxyz # Optional: means short term creds.
|
||||
aws_session_token = pqrstuvwxyz # Optional: means short term creds.
|
||||
```
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
TextGenWebUI is a comprehensive, open-source language model UI and local server. You can set it up with an OpenAI-compatible server plugin, and then configure it in your `config.json` like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# TogetherLLM
|
||||
# Together
|
||||
|
||||
The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/models-inference). Change `~/.continue/config.json` to look like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -6,9 +6,9 @@ Run the OpenAI-compatible server by vLLM using `vllm serve`. See their [server d
|
|||
vllm serve NousResearch/Meta-Llama-3-8B-Instruct --max-model-len 1024
|
||||
```
|
||||
|
||||
The continue implementation uses [OpenAI](./openai.md) under the hood and automatically selects the available model. You only need to set the `apiBase` like this:
|
||||
The continue implementation uses [OpenAI](../top-level/openai.md) under the hood and automatically selects the available model. You only need to set the `apiBase` like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
84
docs/docs/customize/model-providers/more/watsonx.md
Normal file
84
docs/docs/customize/model-providers/more/watsonx.md
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# IBM watsonx
|
||||
|
||||
watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.
|
||||
|
||||
## Setup
|
||||
|
||||
Accessing watsonx models can be done either through watsonx SaaS on IBM Cloud or using a dedicated watsonx.ai Software instance.
|
||||
|
||||
### watsonx.ai SaaS - IBM Cloud
|
||||
|
||||
To get started with watsonx SaaS, visit the [registration page](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx). If you do not have an existing IBM Cloud account, you can sign up for a free trial.
|
||||
|
||||
To authenticate to watsonx.ai SaaS with Continue, you will need to create a project and [setup an API key](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=cli-creating-your-cloud-api-key). Then, in continue:
|
||||
|
||||
- Set **watsonx URL** to your watsonx SaaS endpoint, e.g. `https://us-south.ml.cloud.ibm.com` for US South region.
|
||||
- Set **watsonx Project ID** to your watsonx project ID.
|
||||
- Set **watsonx API Key** to your watsonx API Key.
|
||||
|
||||
### watsonx.ai Software
|
||||
|
||||
To authenticate to your watsonx.ai Software instance with Continue, you can use either `username/password` or `ZenApiKey` method:
|
||||
|
||||
1. _Option 1_ (Recommended): using `ZenApiKey` authentication:
|
||||
- Set **watsonx URL** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`.
|
||||
- Set **watsonx Project ID** to your watsonx project ID.
|
||||
- Set **watsonx API Key** to your watsonx Zen API Key. To generate it:
|
||||
1. Log in to the CPD web client.
|
||||
2. From the toolbar, click your avatar.
|
||||
3. Click **Profile and settings**.
|
||||
4. Click **API key** > **Generate new key**.
|
||||
5. Click **Generate**.
|
||||
6. Click **Copy** and save your key somewhere safe. You cannot recover this key if you lose it.
|
||||
7. Generate your ZenApiKey by running the following command in your preferred terminal: `echo "<username>:<apikey>" | base64`, replacing `<username>` with your CPD username and `<apikey>` with the API Key you just created.
|
||||
2. _Option 2_: using `username/password` authentication:
|
||||
- Set **watsonx URL** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`.
|
||||
- Set **watsonx Project ID** to your watsonx project ID.
|
||||
- Set **watsonx API Key** to your watsonx Username and Password using `username:password` as format.
|
||||
|
||||
## Configuration
|
||||
|
||||
Add the following configuration to your `config.json` file to use the watsonx provider. Fill in the `watsonxCreds` with the authentication details you obtained in the setup step.
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"model": "model ID",
|
||||
"title": "watsonx - Model Name",
|
||||
"watsonxUrl": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com",
|
||||
"watsonxProjectId": "PROJECT_ID",
|
||||
"watsonxCreds": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD",
|
||||
"watsonxApiVersion": "2023-05-29",
|
||||
"provider": "watsonx"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
`watsonxAPIVersion` is optional and defaults to the latest version.
|
||||
|
||||
### Configuration Options
|
||||
|
||||
Add the full watsonx URL to `watsonxFullUrl` if you are using a custom endpoint. When `watsonxFullUrl` is set, `watsonxUrl` and `watsonxApiVersion` are ignored.
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"model": "model ID",
|
||||
"title": "watsonx - Model Name",
|
||||
"watsonxUrl": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com",
|
||||
"watsonxProjectId": "PROJECT_ID",
|
||||
"watsonxCreds": "API_KEY",
|
||||
"watsonxApiVersion": "2023-05-29",
|
||||
"provider": "watsonx",
|
||||
"watsonxFullUrl": "https://us-south.ml.cloud.ibm.com/m1/v1/text/generation"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||

|
||||
66
docs/docs/customize/model-providers/top-level/anthropic.md
Normal file
66
docs/docs/customize/model-providers/top-level/anthropic.md
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
title: Anthropic
|
||||
slug: ../anthropic
|
||||
---
|
||||
|
||||
:::info
|
||||
|
||||
You can get an API key from the [Anthropic console](https://console.anthropic.com/account/keys).
|
||||
|
||||
:::
|
||||
|
||||
## 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 a list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
Anthropic currently does not offer any embeddings models.
|
||||
|
||||
[Click here](../../model-types/embeddings.md) to see a list of embeddings model providers.
|
||||
|
||||
## Reranking model
|
||||
|
||||
Anthropic currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see a 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]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
91
docs/docs/customize/model-providers/top-level/azure.md
Normal file
91
docs/docs/customize/model-providers/top-level/azure.md
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
---
|
||||
title: Azure OpenAI
|
||||
slug: ../azure
|
||||
---
|
||||
|
||||
## 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": "azure",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
We recommend configuring **Codestral** as your autocomplete model.
|
||||
|
||||
```json title="config.json"
|
||||
"tabAutocompleteModel": [{
|
||||
"title": "Codestral",
|
||||
"provider": "azure",
|
||||
"model": "codestral-latest",
|
||||
"apiBase": "<YOUR_DEPLOYMENT_BASE>",
|
||||
"engine": "<YOUR_ENGINE>",
|
||||
"apiVersion": "<YOUR_API_VERSION>",
|
||||
"apiType": "azure",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **text-embedding-3-large** as your embeddings model.
|
||||
|
||||
```json title="config.json"
|
||||
"embeddingsProvider": [{
|
||||
"provider": "azure",
|
||||
"model": "text-embedding-3-large",
|
||||
"apiBase": "<YOUR_DEPLOYMENT_BASE>",
|
||||
"engine": "<YOUR_ENGINE>",
|
||||
"apiVersion": "<YOUR_API_VERSION>",
|
||||
"apiType": "azure",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
Azure OpenAI currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see a list of reranking models.
|
||||
|
||||
## 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)**
|
||||
:::
|
||||
|
||||
## General model configuration
|
||||
|
||||
Azure OpenAI requires a handful of additional parameters to be configured, such as a model engine and API version.
|
||||
|
||||
To find this information in _Azure AI Studio_, first select the model that you would like to connect. Then visit _Endpoint_ > _Target URI_.
|
||||
|
||||
For example, a Target URI of `<https://just-an-example.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2023-03-15-preview>` would map to the following:
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "GPT-4o Azure",
|
||||
"model": "gpt-4o",
|
||||
"provider": "azure",
|
||||
"apiBase": "https://just-an-example.openai.azure.com",
|
||||
"apiType": "azure",
|
||||
"engine": "gpt-4o",
|
||||
"apiVersion": "2023-03-15-preview",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}
|
||||
```
|
||||
90
docs/docs/customize/model-providers/top-level/bedrock.md
Normal file
90
docs/docs/customize/model-providers/top-level/bedrock.md
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
title: Amazon Bedrock
|
||||
slug: ../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 a list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring [`amazon.titan-embed-text-v2:0`](https://docs.aws.amazon.com/bedrock/latest/devguide/models.html#amazon.titan-embed-text-v2-0) as your embeddings model.
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"title": "Embeddings Model",
|
||||
"provider": "bedrock",
|
||||
"model": "amazon.titan-embed-text-v2:0",
|
||||
"region": "us-west-2"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
Bedrock currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see a 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
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.
|
||||
```
|
||||
53
docs/docs/customize/model-providers/top-level/deepseek.md
Normal file
53
docs/docs/customize/model-providers/top-level/deepseek.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
title: DeepSeek
|
||||
slug: ../deepseek
|
||||
---
|
||||
|
||||
:::info
|
||||
|
||||
You can get an API key from the [DeepSeek console](https://www.deepseek.com/).
|
||||
|
||||
:::
|
||||
|
||||
## 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 a list of embeddings model providers.
|
||||
|
||||
## Reranking model
|
||||
|
||||
DeepSeek currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see a list of reranking model providers.
|
||||
55
docs/docs/customize/model-providers/top-level/gemini.md
Normal file
55
docs/docs/customize/model-providers/top-level/gemini.md
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
title: Gemini
|
||||
slug: ../gemini
|
||||
---
|
||||
|
||||
:::info
|
||||
|
||||
You can get an API key from the [Google AI Studio](https://aistudio.google.com/).
|
||||
|
||||
:::
|
||||
|
||||
## 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 a list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **text-embedding-004** as your embeddings model.
|
||||
|
||||
```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 a list of reranking model providers.
|
||||
64
docs/docs/customize/model-providers/top-level/mistral.md
Normal file
64
docs/docs/customize/model-providers/top-level/mistral.md
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
---
|
||||
title: Mistral
|
||||
slug: ../mistral
|
||||
---
|
||||
|
||||
:::info
|
||||
|
||||
You can get an API key from the [Mistral Dashboard](https://console.mistral.ai). Note that the API key for Codestral (codestral.mistral.ai) is different from for all other models (api.mistral.ai).
|
||||
|
||||
:::
|
||||
|
||||
## 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]",
|
||||
"apiBase": "https://api.mistral.ai/v1"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
Mistral currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see a list of reranking model providers.
|
||||
53
docs/docs/customize/model-providers/top-level/ollama.md
Normal file
53
docs/docs/customize/model-providers/top-level/ollama.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
title: Ollama
|
||||
slug: ../ollama
|
||||
---
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **Llama3.1 8B** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama3.1 8B",
|
||||
"provider": "ollama",
|
||||
"model": "llama3.1:8b"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
We recommend configuring **StarCoder2 3B** as your autocomplete model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "StarCoder2 3B",
|
||||
"provider": "ollama",
|
||||
"model": "starcoder2:3b"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **Nomic Embed Text** as your embeddings model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "ollama",
|
||||
"model": "nomic-embed-text"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
Ollama currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see a list of reranking model providers.
|
||||
|
|
@ -1,6 +1,58 @@
|
|||
# OpenAI
|
||||
---
|
||||
title: OpenAI
|
||||
slug: ../openai
|
||||
---
|
||||
|
||||
The OpenAI class can be used to access OpenAI models like GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo.
|
||||
:::info
|
||||
|
||||
You can get an API key from the [OpenAI console](https://platform.openai.com/account/api-keys)
|
||||
|
||||
:::
|
||||
|
||||
## 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 a 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 a list of reranking model providers.
|
||||
|
||||
## OpenAI compatible servers / APIs
|
||||
|
||||
|
|
@ -12,16 +64,16 @@ 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
|
||||
|
||||
- [Anyscale Endpoints](https://github.com/continuedev/deploy-os-code-llm#others)
|
||||
- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints)
|
||||
|
||||
If you are [using an OpenAI compatible server / API](../../setup/model-providers.md#local), you can change the `apiBase` like this:
|
||||
If you are using an OpenAI compatible server / API, you can change the `apiBase` like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
|
|
@ -40,7 +92,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)
|
||||
16
docs/docs/customize/model-types/autocomplete.md
Normal file
16
docs/docs/customize/model-types/autocomplete.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
title: Autocomplete model
|
||||
description: Autocomplete model
|
||||
keywords: [autocomplete]
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
An "autocomplete model" is an LLM that is trained on a special format called fill-in-the-middle (FIM). This format is designed to be given the prefix and suffix of a code file and predict what goes between. This task is very specific, which on one hand means that the models can be smaller (even a 3B parameter model can perform well). On the other hand, this means that Chat models, though larger, will perform poorly.
|
||||
|
||||
In Continue, these models are used to display inline [Autocomplete](../../docs/chat/how-to-use-it.md) suggestions as you type.
|
||||
|
||||
## Recommended Autocomplete models
|
||||
|
||||
If you have the ability to use any model, we recommend [Codestral](../model-providers/top-level/mistral.md) from Mistral.
|
||||
|
||||
If you want to run a model locally, we recommend [Starcoder2-3B] with [Ollama](../model-providers/top-level/ollama.md).
|
||||
18
docs/docs/customize/model-types/chat.md
Normal file
18
docs/docs/customize/model-types/chat.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
title: Chat model
|
||||
description: Chat model
|
||||
keywords: [chat]
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
A "chat model" is an LLM that is trained to respond in a conversational format. Because they should be able to answer general questions and generate complex code, the best chat models are typically large, often 405B+ parameters. In Continue, these models are used for [Chat](../../docs/chat/how-to-use-it.md), [Edit](../../docs/edit/how-to-use-it.md), and [Actions](../../docs/actions/how-to-use-it.md).
|
||||
|
||||
## Recommended Chat models
|
||||
|
||||
If you have the ability to use any model, we recommend [Claude 3.5 Sonnet](../model-providers/top-level/anthropic.md).
|
||||
|
||||
Otherwise, some of the next best options are:
|
||||
|
||||
- [GPT-4o](../model-providers/top-level/openai.md)
|
||||
- [Gemini 1.5 Pro](../model-providers/top-level/gemini.md)
|
||||
- [Llama3.1 405B](../tutorials/llama3.1.md)
|
||||
71
docs/docs/customize/model-types/embeddings.md
Normal file
71
docs/docs/customize/model-types/embeddings.md
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
title: Embeddings model
|
||||
description: Embeddings model
|
||||
keywords: [embedding]
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
An "embeddings model" is trained to convert a piece of text into a vector, which can later be rapidly compared to other vectors to determine similarity between the pieces of text. Embeddings models are typically much smaller than LLMs, and will be extremely fast and cheap in comparison.
|
||||
|
||||
In Continue, embeddings are generated during indexing and then used by [@codebase](../deep-dives/codebase.md) to perform similarity search over your codebase.
|
||||
|
||||
## Recommended embedding models
|
||||
|
||||
If you have the ability to use any model, we recommend `voyage-code-2`, which is listed below along with the rest of the options for embeddings models.
|
||||
|
||||
If you want to generate embeddings locally, we recommend using `nomic-embed-text` with [Ollama](../model-providers/top-level/ollama.md#embeddings-model).
|
||||
|
||||
### Voyage AI
|
||||
|
||||
After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "voyage",
|
||||
"model": "voyage-code-2",
|
||||
"apiKey": "<VOYAGE_API_KEY>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Ollama
|
||||
|
||||
See [here](../model-providers/top-level/ollama.md#embeddings-model) for instructions on how to use Ollama for embeddings.
|
||||
|
||||
### Transformers.js (currently VS Code only)
|
||||
|
||||
[Transformers.js](https://huggingface.co/docs/transformers.js/index) is a JavaScript port of the popular [Transformers](https://huggingface.co/transformers/) library. It allows embeddings to be calculated entirely locally. The model used is `all-MiniLM-L6-v2`, which is shipped alongside the Continue extension and used as the default when you have not explicitly configured an embeddings provider.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "transformers.js"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Text Embeddings Inference
|
||||
|
||||
[Hugging Face Text Embeddings Inference](https://huggingface.co/docs/text-embeddings-inference/en/index) enables you to host your own embeddings endpoint. You can configure embeddings to use your endpoint as follows:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "huggingface-tei",
|
||||
"apiBase": "http://localhost:8080"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### OpenAI
|
||||
|
||||
See [here](../model-providers/top-level/openai.md#embeddings-model) for instructions on how to use OpenAI for embeddings.
|
||||
|
||||
### Cohere
|
||||
|
||||
See [here](../model-providers/more/cohere.md#embeddings-model) for instructions on how to use Cohere for embeddings.
|
||||
|
||||
### Gemini
|
||||
|
||||
See [here](../model-providers/top-level/gemini.md#embeddings-model) for instructions on how to use Gemini for embeddings.
|
||||
92
docs/docs/customize/model-types/reranking.md
Normal file
92
docs/docs/customize/model-types/reranking.md
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
---
|
||||
title: Reranking model
|
||||
description: Reranking model
|
||||
keywords: [rerank]
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
A "reranking model" is trained to take two pieces of text (often a user question and a document) and return a relevancy score between 0 and 1, estimating how useful the document will be in answering the question. Rerankers are typically much smaller than LLMs, and will be extremely fast and cheap in comparison.
|
||||
|
||||
In Continue, reranking is used by [@codebase](../deep-dives/codebase.md) in order to select the most relevant code snippets after vector search.
|
||||
|
||||
## Recommended reranking models
|
||||
|
||||
If you have the ability to use any model, we recommend `rerank-1` by Voyage AI, which is listed below along with the rest of the options for rerankers.
|
||||
|
||||
### Voyage AI
|
||||
|
||||
Voyage AI offers the best reranking model for code with their `rerank-1` model. After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"reranker": {
|
||||
"name": "voyage",
|
||||
"params": {
|
||||
"model": "rerank-1",
|
||||
"apiKey": "<VOYAGE_API_KEY>"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Cohere
|
||||
|
||||
See Cohere's documentation for rerankers [here](https://docs.cohere.com/docs/rerank-2).
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"reranker": {
|
||||
"name": "cohere",
|
||||
"params": {
|
||||
"model": "rerank-english-v3.0",
|
||||
"apiKey": "<COHERE_API_KEY>"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### LLM
|
||||
|
||||
If you only have access to a single LLM, then you can use it as a reranker. This is discouraged unless truly necessary, because it will be much more expensive and still less accurate than any of the above models trained specifically for the task. Note that this will not work if you are using a local model, for example with Ollama, because too many parallel requests need to be made.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"reranker": {
|
||||
"name": "llm",
|
||||
"params": {
|
||||
"modelTitle": "My Model Title"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The `"modelTitle"` field must match one of the models in your "models" array in config.json.
|
||||
|
||||
### Text Embeddings Inference
|
||||
|
||||
[Hugging Face Text Embeddings Inference](https://huggingface.co/docs/text-embeddings-inference/en/index) enables you to host your own [reranker endpoint](https://huggingface.github.io/text-embeddings-inference/#/Text%20Embeddings%20Inference/rerank). You can configure your reranker as follows:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"reranker": {
|
||||
"name": "huggingface-tei",
|
||||
"params": {
|
||||
"apiBase": "http://localhost:8080",
|
||||
"truncate": true,
|
||||
"truncation_direction": "Right"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Free Trial (Voyage AI)
|
||||
|
||||
Continue offers a free trial of Voyage AI's reranking model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"reranker": {
|
||||
"name": "free-trial"
|
||||
}
|
||||
}
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue