This commit is contained in:
Nate 2024-09-23 16:02:38 -07:00
commit ee02db7746
26 changed files with 146 additions and 124 deletions

View file

@ -647,6 +647,8 @@ declare global {
| "deepseek-7b"
| "deepseek-33b"
| "neural-chat-7b"
| "gemma-7b-it"
| "gemma2-9b-it"
// Anthropic
| "claude-3-5-sonnet-20240620"
| "claude-3-opus-20240229"

View file

@ -140,7 +140,7 @@ export class Core {
// Respect pauseCodebaseIndexOnStart user settings
if (ideSettings.pauseCodebaseIndexOnStart) {
await this.messenger.request("indexProgress", {
progress: 100,
progress: 1,
desc: "Initial Indexing Skipped",
status: "paused",
});

2
core/index.d.ts vendored
View file

@ -691,6 +691,8 @@ export type ModelName =
| "deepseek-7b"
| "deepseek-33b"
| "neural-chat-7b"
| "gemma-7b-it"
| "gemma2-9b-it"
// Anthropic
| "claude-3-5-sonnet-20240620"
| "claude-3-opus-20240229"

View file

@ -249,10 +249,11 @@ export class CodebaseIndexer {
}
}
yield {
progress: 100,
progress: 1,
desc: "Indexing Complete",
status: "done",
};
this.logProgress(beginTime, 0, 1);
}
private handleErrorAndGetProgressUpdate(

View file

@ -78,7 +78,8 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider {
try {
return await
fromIni({
profile: this.profile
profile: this.profile,
ignoreCache: true
})();
} catch (e) {
console.warn(

View file

@ -74,6 +74,7 @@ const MODEL_SUPPORTS_IMAGES: string[] = [
"sonnet",
"opus",
"haiku",
"pixtral",
];
function modelSupportsImages(

View file

@ -262,16 +262,29 @@ export abstract class BaseLLM implements ILLM {
prompt: string,
completionOptions: CompletionOptions,
): string {
const dict = { contextLength: this.contextLength, ...completionOptions };
const settings = Object.entries(dict)
.map(([key, value]) => `${key}: ${value}`)
.join("\n");
return `Settings:
${settings}
const completionOptionsLog = JSON.stringify(
{
contextLength: this.contextLength,
...completionOptions,
},
null,
2,
);
############################################
let requestOptionsLog = "";
if (this.requestOptions) {
requestOptionsLog = JSON.stringify(this.requestOptions, null, 2);
}
${prompt}`;
return (
"##### Completion options #####\n" +
completionOptionsLog +
(requestOptionsLog
? "\n\n##### Request options #####\n" + requestOptionsLog
: "") +
"\n\n##### Prompt #####\n" +
prompt
);
}
private _logTokensGenerated(
@ -703,9 +716,6 @@ ${prompt}`;
this.providerName,
autodetectTemplateType(this.model),
);
if (!templateMessages) {
return rendered;
}
return templateMessages(rendered);
}
return rendered;

View file

@ -153,6 +153,7 @@ class Bedrock extends BaseLLM {
try {
return await fromIni({
profile: this.profile,
ignoreCache: true
})();
} catch (e) {
console.warn(

View file

@ -82,7 +82,8 @@ class BedrockImport extends BaseLLM {
try {
return await
fromIni({
profile: this.profile
profile: this.profile,
ignoreCache: true
})();
} catch (e) {
console.warn(

View file

@ -12,6 +12,7 @@ class Groq extends OpenAI {
"llama2-70b": "llama2-70b-4096",
"mistral-8x7b": "mixtral-8x7b-32768",
gemma: "gemma-7b-it",
gemma2: "gemma2-9b-it",
"llama3-8b": "llama3-8b-8192",
"llama3-70b": "llama3-70b-8192",
"llama3.1-8b": "llama-3.1-8b-instant",

View file

@ -20,8 +20,8 @@ class WatsonX extends BaseLLM {
super(options);
}
async getBearerToken(): Promise<{ token: string; expiration: number }> {
if (
this.watsonxFullUrl?.includes("cloud.ibm.com") ||
this.watsonxUrl?.includes("cloud.ibm.com")
) {
// watsonx SaaS
@ -43,14 +43,12 @@ class WatsonX extends BaseLLM {
};
} else {
// watsonx Software
if (
!this.watsonxCreds?.includes(":")
) {
// Using ZenApiKey auth
return {
token: this.watsonxCreds ?? "",
expiration: -1,
};
if (!this.watsonxCreds?.includes(":")) {
// Using ZenApiKey auth
return {
token: this.watsonxCreds ?? "",
expiration: -1,
};
} else {
// Using username/password auth
const userPass = this.watsonxCreds?.split(":");
@ -85,7 +83,10 @@ class WatsonX extends BaseLLM {
}
getWatsonxEndpoint(): string {
return this.watsonxFullUrl ?? `${this.watsonxUrl}/ml/v1/text/generation_stream?version=${this.watsonxApiVersion}`;
return (
this.watsonxFullUrl ??
`${this.watsonxUrl}/ml/v1/text/generation_stream?version=${this.watsonxApiVersion}`
);
}
static providerName: ModelProvider = "watsonx";
@ -132,9 +133,8 @@ class WatsonX extends BaseLLM {
protected _getHeaders() {
return {
"Content-Type": "application/json",
Authorization: `${
watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"
} ${watsonxConfig.accessToken.token}`,
Authorization: `${watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"
} ${watsonxConfig.accessToken.token}`,
};
}
@ -178,8 +178,7 @@ class WatsonX extends BaseLLM {
watsonxConfig.accessToken = await this.getBearerToken();
} else {
console.log(
`Reusing token (expires in ${
(watsonxConfig.accessToken.expiration - now) / 60
`Reusing token (expires in ${(watsonxConfig.accessToken.expiration - now) / 60
} mins)`,
);
}
@ -191,31 +190,37 @@ class WatsonX extends BaseLLM {
this.watsonxStopToken ??
(options.model?.includes("granite") ? "<|im_end|>" : undefined);
const url = this.getWatsonxEndpoint();
var response = await this.fetch(
url,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `${
watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"
} ${watsonxConfig.accessToken.token}`,
},
body: JSON.stringify({
input: messages[messages.length - 1].content,
parameters: {
decoding_method: "greedy",
max_new_tokens: options.maxTokens ?? 1024,
min_new_tokens: 1,
stop_sequences: stopToken ? [stopToken] : [],
include_stop_sequence: false,
repetition_penalty: 1,
},
model_id: options.model,
project_id: this.watsonxProjectId
}),
},
);
const headers = this._getHeaders();
const parameters: any = {
decoding_method: "greedy",
max_new_tokens: options.maxTokens ?? 1024,
min_new_tokens: 1,
stop_sequences: stopToken ? [stopToken] : [],
include_stop_sequence: false,
repetition_penalty: 1,
};
if (!!options.temperature) {
parameters.decoding_method = "sample";
parameters.temperature = options.temperature;
parameters.top_p = options.topP || 1.0;
parameters.top_k = options.topK;
}
const payload: any = {
input: messages[messages.length - 1].content,
parameters: parameters,
};
if (!this.watsonxFullUrl) {
payload.model_id = options.model;
payload.project_id = this.watsonxProjectId;
}
var response = await this.fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
});
if (!response.ok || response.body === null) {
throw new Error(
@ -223,7 +228,6 @@ class WatsonX extends BaseLLM {
);
} else {
for await (const value of streamResponse(response)) {
const lines = value.split("\n");
let generatedChunk = "";
let generatedTextIndex = undefined;

View file

@ -380,7 +380,13 @@ Reference table schemas from Sqlite, Postgres, and MySQL databases.
}
```
Each connection should include a unique name, the connection_type (e.g., postgres, sqlite), and the necessary connection parameters specific to each database type.
Each connection should include a unique name, the `connection_type`, and the necessary connection parameters specific to each database type.
Available connection types:
- `postgres`
- `mysql`
- `sqlite`
### `@Locals`

View file

@ -119,7 +119,7 @@ To ensure that you receive multi-line completions, you can set `"multilineComple
Yes, in VS Code, if you don't want to be shown suggestions automatically you can:
1. Set `"editor.inlineSuggest.enabled": false` in VS Code settings to disabe automatic suggestions
1. Set `"editor.inlineSuggest.enabled": false` in VS Code settings to disable automatic suggestions
2. Open "Keyboard Shortcuts" (cmd/ctrl+k, cmd/ctrl+s) and search for `editor.action.inlineSuggest.trigger`
3. Click the "+" icon to add a new keybinding
4. Press the key combination you want to use to trigger suggestions (e.g. `ctrl+space`)

View file

@ -7,7 +7,7 @@ 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](../../chat/how-to-use-it.md) suggestions as you type.
In Continue, these models are used to display inline [Autocomplete](../../autocomplete/how-to-use-it.md) suggestions as you type.
## Recommended Autocomplete models

View file

@ -1044,6 +1044,7 @@
"llama2-70b",
"mistral-8x7b",
"gemma",
"gemma2",
"llama3-8b",
"llama3-70b",
"llama3.1-8b",

View file

@ -1044,6 +1044,7 @@
"llama2-70b",
"mistral-8x7b",
"gemma",
"gemma2",
"llama3-8b",
"llama3-70b",
"llama3.1-8b",
@ -2114,6 +2115,13 @@
"minimum": 128,
"exclusiveMaximum": 2147483647
},
"maxBatchSize": {
"title": "Maximum Batch Size",
"description": "The maximum number of chunks that can be sent to the embeddings provider in a single request",
"type": "integer",
"minimum": 1,
"exclusiveMaximum": 2147483647
},
"region": {
"title": "Region",
"description": "The region where the model is hosted",

View file

@ -1149,6 +1149,7 @@
"llama2-70b",
"mistral-8x7b",
"gemma",
"gemma2",
"llama3-8b",
"llama3-70b",
"llama3.1-8b",

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.211",
"version": "0.9.212",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.211",
"version": "0.9.212",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "0.9.211",
"version": "0.9.212",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

View file

@ -5,31 +5,27 @@ import {
import { useState, useContext } from "react";
import { IdeMessengerContext } from "../../../context/IdeMessenger";
import { providers } from "../../../pages/AddNewModel/configs/providers";
import { useCheckOllamaModels } from "../hooks/useCheckOllamaModels";
import { StyledActionButton } from "../..";
import OllamaCompletedStep from "./OllamaCompletedStep";
import { OllamaConnectionStatuses } from "../utils";
interface OllamaStatusProps {
onConnectionVerified: () => void;
isOllamaConnected: boolean;
}
const {
ollama: { downloadUrl },
} = providers;
export function OllamaStatus({ onConnectionVerified }: OllamaStatusProps) {
export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) {
const ideMessenger = useContext(IdeMessengerContext);
const [status, setStatus] = useState<OllamaConnectionStatuses>(
OllamaConnectionStatuses.WaitingToDownload,
isOllamaConnected
? OllamaConnectionStatuses.Connected
: OllamaConnectionStatuses.WaitingToDownload,
);
useCheckOllamaModels((models) => {
setStatus(OllamaConnectionStatuses.Verified);
onConnectionVerified();
});
function onClickDownload() {
ideMessenger.post("openUrl", downloadUrl);
setStatus(OllamaConnectionStatuses.Downloading);
@ -52,7 +48,7 @@ export function OllamaStatus({ onConnectionVerified }: OllamaStatusProps) {
<ArrowPathIcon className="h-4 w-4 animate-spin-slow mr-1" />
</div>
);
case OllamaConnectionStatuses.Verified:
case OllamaConnectionStatuses.Connected:
return (
<OllamaCompletedStep text="Ollama is running at http://localhost:11434" />
);

View file

@ -1,2 +1,2 @@
export * from "./useCheckOllamaModels";
export * from "./useSubmitOnboarding";
export * from "./useOnboardingCard";

View file

@ -1,41 +0,0 @@
import { useContext, useEffect } from "react";
import { IdeMessengerContext } from "../../../context/IdeMessenger";
import { ONBOARDING_LOCAL_MODEL_TITLE } from "core/config/onboarding";
const CHECK_OLLAMA_CONNECTION_INTERVAL = 1000;
export const useCheckOllamaModels = (
onDownloadedModels: (models: string[]) => void,
) => {
const ideMessenger = useContext(IdeMessengerContext);
useEffect(() => {
const fetchDownloadedModels = async () => {
const result = (await ideMessenger.request("llm/listModels", {
title: ONBOARDING_LOCAL_MODEL_TITLE,
})) as any;
if (result.status === "success") {
const models = result.content;
if (Array.isArray(models)) {
onDownloadedModels(models);
clearInterval(interval);
}
}
};
fetchDownloadedModels();
const interval = setInterval(
fetchDownloadedModels,
CHECK_OLLAMA_CONNECTION_INTERVAL,
);
return () => {
if (interval) {
clearInterval(interval);
}
};
}, [ideMessenger, onDownloadedModels]);
};

View file

@ -13,7 +13,9 @@ import { hasPassedFTL } from "../../../util/freeTrial";
import AddModelButtonSubtext from "../../AddModelButtonSubtext";
import OllamaModelDownload from "../components/OllamaModelDownload";
import { OllamaStatus } from "../components/OllamaStatus";
import { useCheckOllamaModels, useSubmitOnboarding } from "../hooks";
import { useSubmitOnboarding } from "../hooks";
const OLLAMA_CHECK_INTERVAL_MS = 3000;
function OnboardingLocalTab() {
const dispatch = useDispatch();
@ -52,19 +54,40 @@ function OnboardingLocalTab() {
}
}, [downloadedOllamaModels, isOllamaConnected]);
useCheckOllamaModels((models) => {
setDownloadedOllamaModels(models);
});
useEffect(() => {
const fetchDownloadedModels = async () => {
try {
const result = (await ideMessenger.request("llm/listModels", {
title: ONBOARDING_LOCAL_MODEL_TITLE,
})) as any;
function onConnectionVerified() {
setIsOllamaConnected(true);
}
if (result.status === "success" && Array.isArray(result.content)) {
setDownloadedOllamaModels(result.content);
setIsOllamaConnected(true);
} else {
throw new Error("Failed to fetch models");
}
} catch (error) {
console.error("Error fetching models:", error);
setIsOllamaConnected(false);
}
};
const intervalId = setInterval(
fetchDownloadedModels,
OLLAMA_CHECK_INTERVAL_MS,
);
fetchDownloadedModels();
return () => clearInterval(intervalId);
}, []);
return (
<div className="flex flex-col gap-2">
<div className="flex flex-col">
<p className="text-lg font-bold leading-tight mb-2">Install Ollama</p>
<OllamaStatus onConnectionVerified={onConnectionVerified} />
<OllamaStatus isOllamaConnected={isOllamaConnected} />
</div>
<OllamaModelDownload

View file

@ -30,5 +30,5 @@ export const defaultOnboardingCardState: OnboardingCardState = {
export enum OllamaConnectionStatuses {
WaitingToDownload = "WaitingToDownload",
Downloading = "Downloading",
Verified = "Verified",
Connected = "Connected",
}

View file

@ -389,6 +389,10 @@ export const StyledActionButton = styled.div`
padding: 2px 12px;
background-color: ${lightGray}33;
background-opacity: 0.1;
&:hover {
background-color: ${lightGray}55;
}
`;
export const CloseButton = styled.button`

View file

@ -128,7 +128,7 @@ export type UiOptions = z.infer<typeof uiOptionsSchema>;
export const tabAutocompleteOptionsSchema = z.object({
disable: z.boolean(),
useCopyBuffer: z.boolean(),
useSuffix: z.boolean(),
useFileSuffix: z.boolean(),
maxPromptTokens: z.number(),
debounceDelay: z.number(),
maxSuffixPercentage: z.number(),