diff --git a/core/config/types.ts b/core/config/types.ts index e69c312ab..c571b44df 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -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" diff --git a/core/core.ts b/core/core.ts index f33ab17d4..3e5129a62 100644 --- a/core/core.ts +++ b/core/core.ts @@ -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", }); diff --git a/core/index.d.ts b/core/index.d.ts index 0c7c9b521..16c48a3ad 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -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" diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index bc53539f4..bf16b2a5d 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -249,10 +249,11 @@ export class CodebaseIndexer { } } yield { - progress: 100, + progress: 1, desc: "Indexing Complete", status: "done", }; + this.logProgress(beginTime, 0, 1); } private handleErrorAndGetProgressUpdate( diff --git a/core/indexing/embeddings/BedrockEmbeddingsProvider.ts b/core/indexing/embeddings/BedrockEmbeddingsProvider.ts index aa9e8bd41..bf3bcac88 100644 --- a/core/indexing/embeddings/BedrockEmbeddingsProvider.ts +++ b/core/indexing/embeddings/BedrockEmbeddingsProvider.ts @@ -78,7 +78,8 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { try { return await fromIni({ - profile: this.profile + profile: this.profile, + ignoreCache: true })(); } catch (e) { console.warn( diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index e87e7417e..31eccfc8f 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -74,6 +74,7 @@ const MODEL_SUPPORTS_IMAGES: string[] = [ "sonnet", "opus", "haiku", + "pixtral", ]; function modelSupportsImages( diff --git a/core/llm/index.ts b/core/llm/index.ts index ff950929e..fd36222c9 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -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; diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index db2603c03..485b87015 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -153,6 +153,7 @@ class Bedrock extends BaseLLM { try { return await fromIni({ profile: this.profile, + ignoreCache: true })(); } catch (e) { console.warn( diff --git a/core/llm/llms/BedrockImport.ts b/core/llm/llms/BedrockImport.ts index f53d4b15e..a265c7679 100644 --- a/core/llm/llms/BedrockImport.ts +++ b/core/llm/llms/BedrockImport.ts @@ -82,7 +82,8 @@ class BedrockImport extends BaseLLM { try { return await fromIni({ - profile: this.profile + profile: this.profile, + ignoreCache: true })(); } catch (e) { console.warn( diff --git a/core/llm/llms/Groq.ts b/core/llm/llms/Groq.ts index 7115bcc32..bc05263c9 100644 --- a/core/llm/llms/Groq.ts +++ b/core/llm/llms/Groq.ts @@ -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", diff --git a/core/llm/llms/WatsonX.ts b/core/llm/llms/WatsonX.ts index f7ea473e0..d9b61a3f1 100644 --- a/core/llm/llms/WatsonX.ts +++ b/core/llm/llms/WatsonX.ts @@ -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; diff --git a/docs/docs/customize/context-providers.md b/docs/docs/customize/context-providers.md index daed6d63b..c186171f9 100644 --- a/docs/docs/customize/context-providers.md +++ b/docs/docs/customize/context-providers.md @@ -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` diff --git a/docs/docs/customize/deep-dives/autocomplete.md b/docs/docs/customize/deep-dives/autocomplete.md index c84523f54..49c2de949 100644 --- a/docs/docs/customize/deep-dives/autocomplete.md +++ b/docs/docs/customize/deep-dives/autocomplete.md @@ -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`) diff --git a/docs/docs/customize/model-types/autocomplete.md b/docs/docs/customize/model-types/autocomplete.md index a21f6be87..8ecac28e6 100644 --- a/docs/docs/customize/model-types/autocomplete.md +++ b/docs/docs/customize/model-types/autocomplete.md @@ -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 diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 911278ebb..5a20c6daf 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -1044,6 +1044,7 @@ "llama2-70b", "mistral-8x7b", "gemma", + "gemma2", "llama3-8b", "llama3-70b", "llama3.1-8b", diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 911278ebb..176bbd295 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -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", diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 101296fe6..7a7e54764 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -1149,6 +1149,7 @@ "llama2-70b", "mistral-8x7b", "gemma", + "gemma2", "llama3-8b", "llama3-70b", "llama3.1-8b", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 1efe40dfa..0eb4461d9 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -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", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 1f206771a..653922315 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -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" diff --git a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx index 546ddff5d..9cc323ec6 100644 --- a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx +++ b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx @@ -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.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) { ); - case OllamaConnectionStatuses.Verified: + case OllamaConnectionStatuses.Connected: return ( ); diff --git a/gui/src/components/OnboardingCard/hooks/index.ts b/gui/src/components/OnboardingCard/hooks/index.ts index 88f66d231..f2340f5f6 100644 --- a/gui/src/components/OnboardingCard/hooks/index.ts +++ b/gui/src/components/OnboardingCard/hooks/index.ts @@ -1,2 +1,2 @@ -export * from "./useCheckOllamaModels"; export * from "./useSubmitOnboarding"; +export * from "./useOnboardingCard"; diff --git a/gui/src/components/OnboardingCard/hooks/useCheckOllamaModels.ts b/gui/src/components/OnboardingCard/hooks/useCheckOllamaModels.ts deleted file mode 100644 index e763c0d9a..000000000 --- a/gui/src/components/OnboardingCard/hooks/useCheckOllamaModels.ts +++ /dev/null @@ -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]); -}; diff --git a/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx b/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx index 03d940163..5dab35f7b 100644 --- a/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx +++ b/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx @@ -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 (

Install Ollama

- +
; 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(),