diff --git a/core/config/load.ts b/core/config/load.ts index c9ab18925..18c61ce93 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -203,6 +203,24 @@ async function serializedToIntermediateConfig( return config; } +// Merge request options set for entire config with model specific options +function applyRequestOptionsToModels( + models: BaseLLM[], + config: Config, + roles: ModelRole[] | undefined = undefined, +) { + // Prepare models + for (const model of models) { + model.requestOptions = { + ...model.requestOptions, + ...config.requestOptions, + }; + if (roles !== undefined) { + model.roles = model.roles ?? roles; + } + } +} + export function isContextProviderWithParams( contextProvider: CustomContextProvider | ContextProviderWithParams, ): contextProvider is ContextProviderWithParams { @@ -311,14 +329,12 @@ async function intermediateToFinalConfig({ }), ); - // Prepare models - for (const model of models) { - model.requestOptions = { - ...model.requestOptions, - ...config.requestOptions, - }; - model.roles = model.roles ?? ["chat", "apply", "edit", "summarize"]; // Default to chat role if not specified - } + applyRequestOptionsToModels(models, config, [ + "chat", + "apply", + "edit", + "summarize", + ]); // Default to chat role if not specified if (allowFreeTrial) { // Obtain auth token (iff free trial being used) @@ -372,6 +388,8 @@ async function intermediateToFinalConfig({ ).filter((x) => x !== undefined) as BaseLLM[]; } + applyRequestOptionsToModels(tabAutocompleteModels, config); + // These context providers are always included, regardless of what, if anything, // the user has configured in config.json diff --git a/core/config/types.ts b/core/config/types.ts index 690f17165..ee3e308f8 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -931,6 +931,7 @@ declare global { numThreads?: number; useMmap?: boolean; keepAlive?: number; + numGpu?: number; raw?: boolean; stream?: boolean; prediction?: Prediction; diff --git a/core/context/mcp/MCPConnection.ts b/core/context/mcp/MCPConnection.ts index c05edcec7..dca630cc6 100644 --- a/core/context/mcp/MCPConnection.ts +++ b/core/context/mcp/MCPConnection.ts @@ -14,7 +14,7 @@ import { MCPTool, } from "../.."; -const DEFAULT_MCP_TIMEOUT = 20_000; // 10 seconds +export const DEFAULT_MCP_TIMEOUT = 20_000; // 10 seconds class MCPConnection { public client: Client; @@ -30,7 +30,7 @@ class MCPConnection { public tools: MCPTool[] = []; public resources: MCPResource[] = []; - constructor(private readonly options: MCPOptions) { + constructor(public options: MCPOptions) { this.transport = this.constructTransport(options); this.client = new Client( diff --git a/core/context/mcp/MCPManagerSingleton.ts b/core/context/mcp/MCPManagerSingleton.ts index 2f5031c8c..d0d7c0991 100644 --- a/core/context/mcp/MCPManagerSingleton.ts +++ b/core/context/mcp/MCPManagerSingleton.ts @@ -1,6 +1,11 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js"; -import { MCPOptions, MCPServerStatus } from "../.."; +import { + MCPOptions, + MCPServerStatus, + StdioOptions, + TransportOptions, +} from "../.."; import MCPConnection from "./MCPConnection"; export class MCPManagerSingleton { @@ -48,7 +53,17 @@ export class MCPManagerSingleton { // Remove any connections that are no longer in config Array.from(this.connections.entries()).forEach(([id, connection]) => { - if (!servers.find((s) => s.id === id)) { + if ( + !servers.find( + // Refresh the connection if TransportOptions changed + (s) => + s.id === id && + this.compareTransportOptions( + connection.options.transport, + s.transport, + ), + ) + ) { refresh = true; connection.abortController.abort(); void connection.client.close(); @@ -61,6 +76,12 @@ export class MCPManagerSingleton { if (!this.connections.has(server.id)) { refresh = true; this.connections.set(server.id, new MCPConnection(server)); + } else { + const conn = this.connections.get(server.id); + if (conn) { + // We need to update it. Some attributes may have changed, such as name, faviconUrl, etc. + conn.options = server; + } } }); @@ -70,6 +91,37 @@ export class MCPManagerSingleton { } } + private compareTransportOptions( + a: TransportOptions, + b: TransportOptions, + ): boolean { + if (a.type !== b.type) { + return false; + } + if (a.type === "stdio" && b.type === "stdio") { + return ( + a.command === b.command && + JSON.stringify(a.args) === JSON.stringify(b.args) && + this.compareEnv(a, b) + ); + } else if (a.type !== "stdio" && b.type !== "stdio") { + return a.url === b.url; + } + return false; + } + + private compareEnv(a: StdioOptions, b: StdioOptions): boolean { + const aEnv = a.env ?? {}; + const bEnv = b.env ?? {}; + const aKeys = Object.keys(aEnv); + const bKeys = Object.keys(bEnv); + + return ( + aKeys.length === bKeys.length && + aKeys.every((key) => aEnv[key] === bEnv[key]) + ); + } + async refreshConnection(serverId: string) { const connection = this.connections.get(serverId); if (!connection) { diff --git a/core/context/providers/HttpContextProvider.ts b/core/context/providers/HttpContextProvider.ts index bcca31177..284c539d4 100644 --- a/core/context/providers/HttpContextProvider.ts +++ b/core/context/providers/HttpContextProvider.ts @@ -1,7 +1,9 @@ +import isLocalhost from "is-localhost-ip"; import { ContextItem, ContextProviderDescription, ContextProviderExtras, + IDE, } from "../../index.js"; import { BaseContextProvider } from "../index.js"; @@ -14,6 +16,19 @@ class HttpContextProvider extends BaseContextProvider { renderInlineAs: "", }; + private async getWorkspacePath(ide: IDE, url: URL) { + try { + const currentFile = await ide.getCurrentFile(); + // `isLocalhost` actually also returns true for other local addresses, not just localhost + return await isLocalhost(url.hostname) ? + (await ide.getWorkspaceDirs()).find(workspaceDirectory => { + return currentFile?.path.startsWith(workspaceDirectory) + }) : undefined + } catch (e) { + return undefined; + } + } + override get description(): ContextProviderDescription { return { title: this.options.title || HttpContextProvider.description.title, @@ -34,7 +49,8 @@ class HttpContextProvider extends BaseContextProvider { query: string, extras: ContextProviderExtras, ): Promise { - const response = await extras.fetch(new URL(this.options.url), { + const parsedUrl = new URL(this.options.url) + const response = await extras.fetch(parsedUrl, { method: "POST", headers: { "Content-Type": "application/json", @@ -44,6 +60,7 @@ class HttpContextProvider extends BaseContextProvider { query: query || "", fullInput: extras.fullInput, options: this.options.options, + workspacePath: await this.getWorkspacePath(extras.ide, parsedUrl), }), }); diff --git a/core/control-plane/schema.ts b/core/control-plane/schema.ts index d29316d5e..be53a9864 100644 --- a/core/control-plane/schema.ts +++ b/core/control-plane/schema.ts @@ -16,6 +16,7 @@ const modelDescriptionSchema = z.object({ "sagemaker", "cloudflare", "azure", + "ovhcloud", "nebius", "siliconflow", "scaleway", @@ -59,6 +60,7 @@ const modelDescriptionSchema = z.object({ numThreads: z.number().optional(), useMmap: z.boolean().optional(), keepAlive: z.number().optional(), + numGpu: z.number().optional(), raw: z.boolean().optional(), stream: z.boolean().optional(), }) @@ -86,6 +88,7 @@ const embeddingsProviderSchema = z.object({ "cohere", "free-trial", "gemini", + "ovhcloud", "nebius", "siliconflow", "scaleway", diff --git a/core/index.d.ts b/core/index.d.ts index e80bb8f32..7aa8d00ec 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1021,6 +1021,7 @@ export interface BaseCompletionOptions { numThreads?: number; useMmap?: boolean; keepAlive?: number; + numGpu?: number; raw?: boolean; stream?: boolean; prediction?: Prediction; diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index a4763b202..145cb1ac6 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -77,6 +77,7 @@ const PROVIDER_SUPPORTS_IMAGES: string[] = [ "azure", "scaleway", "nebius", + "ovhcloud" ]; const MODEL_SUPPORTS_IMAGES: string[] = [ @@ -95,6 +96,7 @@ const MODEL_SUPPORTS_IMAGES: string[] = [ "pixtral", "llama3.2", "llama-3.2", + "llama4" ]; function modelSupportsTools(modelDescription: ModelDescription) { @@ -147,6 +149,7 @@ const PARALLEL_PROVIDERS: string[] = [ "together", "novita", "sambanova", + "ovhcloud", "nebius", "vertexai", "function-network", @@ -381,5 +384,6 @@ export { autodetectTemplateType, llmCanGenerateInParallel, modelSupportsImages, - modelSupportsTools, + modelSupportsTools }; + diff --git a/core/llm/llms/Inception.ts b/core/llm/llms/Inception.ts index 21e43130e..2d75ca86b 100644 --- a/core/llm/llms/Inception.ts +++ b/core/llm/llms/Inception.ts @@ -23,7 +23,7 @@ class Inception extends OpenAI { completionOptions: { temperature: 0.0, presencePenalty: 1.5, - stop: ["\n\n", "\n \n", "<|endoftext|>"], + stop: ["<|endoftext|>"], model: "mercury-editor-small-experimental", // Added model to fix TypeScript error }, }; @@ -50,7 +50,7 @@ class Inception extends OpenAI { top_p: options.topP, frequency_penalty: options.frequencyPenalty, presence_penalty: options.presencePenalty, - stop: options.stop, + stop: [...(options.stop ?? []), "\n\n", "\n \n"], stream: true, }), headers: { diff --git a/core/llm/llms/OVHcloud.ts b/core/llm/llms/OVHcloud.ts new file mode 100644 index 000000000..d79b06b20 --- /dev/null +++ b/core/llm/llms/OVHcloud.ts @@ -0,0 +1,39 @@ +import { ChatCompletionCreateParams } from "openai/resources/index"; +import { ChatMessage, CompletionOptions, LLMOptions } from "../../index.js"; +import OpenAI from "./OpenAI.js"; + +export class OVHcloud extends OpenAI { + static providerName = "ovhcloud"; + + static defaultOptions: Partial = { + apiBase: "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/", + model: "Qwen2.5-Coder-32B-Instruct", + useLegacyCompletionsEndpoint: false, + }; + + private static MODEL_IDS: { [name: string]: string } = { + "llama3.1-8b": "Llama-3.1-8B-Instruct", + "llama3.1-70b": "Meta-Llama-3_1-70B-Instruct", + "llama3.3-70b": "Meta-Llama-3_3-70B-Instruct", + "qwen2.5-coder-32b": "Qwen2.5-Coder-32B-Instruct", + "codestral-mamba-latest": "mamba-codestral-7B-v0.1", + "mistral-7b": "Mistral-7B-Instruct-v0.3", + "mistral-8x7b": "Mixtral-8x7B-Instruct-v0.1", + "mistral-nemo": "Mistral-Nemo-Instruct-2407", + "DeepSeek-R1-Distill-Llama-70B": "DeepSeek-R1-Distill-Llama-70B" + }; + + protected _convertModelName(model: string) { + return OVHcloud.MODEL_IDS[model] || this.model; + } + + protected _convertArgs(options: CompletionOptions, messages: ChatMessage[]): ChatCompletionCreateParams { + const modifiedOptions = { + ...options, + model: this._convertModelName(options.model) + }; + return super._convertArgs(modifiedOptions, messages); + } +} + +export default OVHcloud; \ No newline at end of file diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index 9db223b79..427d2492e 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -41,12 +41,12 @@ interface OllamaModelFileParams { top_k?: number; top_p?: number; min_p?: number; + num_gpu?: number; // deprecated or not directly supported here: num_thread?: number; use_mmap?: boolean; num_gqa?: number; - num_gpu?: number; num_keep?: number; typical_p?: number; presence_penalty?: number; @@ -280,6 +280,7 @@ class Ollama extends BaseLLM implements ModelInstaller { num_thread: options.numThreads, use_mmap: options.useMmap, min_p: options.minP, + num_gpu: options.numGpu, }; } diff --git a/core/llm/llms/SambaNova.ts b/core/llm/llms/SambaNova.ts index 4c2599529..db37c9276 100644 --- a/core/llm/llms/SambaNova.ts +++ b/core/llm/llms/SambaNova.ts @@ -9,20 +9,17 @@ class SambaNova extends OpenAI { }; private static MODEL_IDS: { [name: string]: string } = { - "qwen2.5-coder-32b": "Qwen2.5-Coder-32B-Instruct", + "llama4-scout": "Llama-4-Scout-17B-16E-Instruct", + "llama4-maverick": "Llama-4-Maverick-17B-128E-Instruct", "llama3.3-70b": "Meta-Llama-3.3-70B-Instruct", "llama3.1-8b": "Meta-Llama-3.1-8B-Instruct", - "llama3.1-70b": "Meta-Llama-3.1-70B-Instruct", "llama3.1-405b": "Meta-Llama-3.1-405B-Instruct", - "llama3.1-tulu-405b": "Llama-3.1-Tulu-3-405B", "llama3.2-1b": "Meta-Llama-3.2-1B-Instruct", "llama3.2-3b": "Meta-Llama-3.2-3B-Instruct", - "llama3.2-11b": "Llama-3.2-11B-Vision-Instruct", - "llama3.2-90b": "Llama-3.2-90B-Vision-Instruct", - "qwen2.5-72b": "Qwen2.5-72B-Instruct", - "qwq-32b": "QwQ-32B-Preview", + "qwq-32b": "QwQ-32B", "deepseek-r1-distill-llama-70b": "DeepSeek-R1-Distill-Llama-70B", "deepseek-r1": "DeepSeek-R1", + "deepseek-v3": "DeepSeek-V3-0324", }; protected _convertModelName(model: string) { diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index c932b5db4..d04f02dfe 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -46,6 +46,7 @@ import Nvidia from "./Nvidia"; import Ollama from "./Ollama"; import OpenAI from "./OpenAI"; import OpenRouter from "./OpenRouter"; +import OVHcloud from "./OVHcloud"; import { Relace } from "./Relace"; import Replicate from "./Replicate"; import SageMaker from "./SageMaker"; @@ -81,6 +82,7 @@ export const LLMClasses = [ Kindo, LlamaCpp, OpenAI, + OVHcloud, LMStudio, Mistral, Bedrock, diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index 552e34283..cea36da6b 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -137,9 +137,16 @@ export const PROVIDER_TOOL_SUPPORT: Record< sambanova: (model) => { // https://docs.sambanova.ai/cloud/docs/capabilities/function-calling if ( - model.toLowerCase().startsWith("meta-llama-3") + model.toLowerCase().startsWith("meta-llama-3") || + model.toLowerCase().includes("llama-4") || + model.toLowerCase().includes("deepseek") ) { return true; } }, + deepseek: (model) => { + if(model !== "deepseek-reasoner") { + return true; + } + } }; diff --git a/core/package-lock.json b/core/package-lock.json index 17ab1a02d..71133e753 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -39,6 +39,7 @@ "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "ignore": "^5.3.1", + "is-localhost-ip": "^2.0.0", "jinja-js": "0.1.8", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", @@ -9533,6 +9534,15 @@ "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", "optional": true }, + "node_modules/is-localhost-ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-localhost-ip/-/is-localhost-ip-2.0.0.tgz", + "integrity": "sha512-vlgs2cSgMOfnKU8c1ewgKPyum9rVrjjLLW2HBdL5i0iAJjOs8NY55ZBd/hqUTaYR0EO9CKZd3hVSC2HlIbygTQ==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/is-map": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", diff --git a/core/package.json b/core/package.json index acac28f17..9332baa21 100644 --- a/core/package.json +++ b/core/package.json @@ -73,6 +73,7 @@ "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "ignore": "^5.3.1", + "is-localhost-ip": "^2.0.0", "jinja-js": "0.1.8", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", diff --git a/docs/docs/customize/model-providers/more/SambaNova.mdx b/docs/docs/customize/model-providers/more/SambaNova.mdx index 3d554006e..58197ae30 100644 --- a/docs/docs/customize/model-providers/more/SambaNova.mdx +++ b/docs/docs/customize/model-providers/more/SambaNova.mdx @@ -9,9 +9,9 @@ The SambaNova Cloud is a cloud platform for running large AI models with the wor ```yaml title="config.yaml" models: - - name: SambaNova Qwen2.5 coder + - name: SambaNova Llama 4 Scout provider: sambanova - model: qwen2.5-coder-32b + model: Llama-4-Scout-17B-16E-Instruct apiKey: ``` @@ -20,9 +20,9 @@ The SambaNova Cloud is a cloud platform for running large AI models with the wor { "models": [ { - "title": "SambaNova Qwen2.5 coder", + "title": "SambaNova Llama 4 Scout", "provider": "sambanova", - "model": "qwen2.5-coder-32b", + "model": "Llama-4-Scout-17B-16E-Instruct", "apiKey": "" } ] diff --git a/docs/docs/customize/model-providers/more/morph.mdx b/docs/docs/customize/model-providers/more/morph.mdx index 2175e8fd0..710fcccd5 100644 --- a/docs/docs/customize/model-providers/more/morph.mdx +++ b/docs/docs/customize/model-providers/more/morph.mdx @@ -9,16 +9,9 @@ Morph provides a fast apply model that helps you quickly and accurately apply co ```yaml title="config.yaml" models: - - name: Morph Fast Apply - provider: openai - model: morph-v0 - apiKey: - apiBase: https://api.morphllm.com/v1/ - roles: - - apply - - chat - promptTemplates: - apply: "{{{ original_code }}}\n{{{ new_code }}}" + - uses: morphllm/morph-v0 + with: + MORPH_API_KEY: ${{ secrets.MORPH_API_KEY }} ``` @@ -41,4 +34,3 @@ Morph provides a fast apply model that helps you quickly and accurately apply co ``` - diff --git a/docs/docs/customize/model-providers/more/openvino_model_server.mdx b/docs/docs/customize/model-providers/more/openvino_model_server.mdx new file mode 100644 index 000000000..8f792f3b3 --- /dev/null +++ b/docs/docs/customize/model-providers/more/openvino_model_server.mdx @@ -0,0 +1,30 @@ +# OpenVINO™ Model Server + +:::info +[**OpenVINO™ Mode Server**](https://github.com/openvinotoolkit/model_server) is scalable inference server for models optimized with OpenVINO™ for Intel CPU, iGPU, GPU and NPU. +::: + +OpenVINO™ Mode Server supports text generation via OpenAI Chat Completions API. Simply select OpenAI provider to point `apiBase` to running OVMS instance. Refer [to this demo](https://docs.openvino.ai/2025/model-server/ovms_demos_code_completion_vsc.html) on official OVMS documentation to easily set up your own local server. + +Example configuration once OVMS is launched: + +```yaml title="config.yaml" +models: + - name: OVMS CodeLlama-7b-Instruct-hf + provider: openai + model: codellama/CodeLlama-7b-Instruct-hf + apiKey: unused + apiBase: http://localhost:5555/v3 + roles: + - chat + - edit + - apply + - name: OVMS Qwen2.5-Coder-1.5B + provider: openai + model: Qwen/Qwen2.5-Coder-1.5B + apiKey: unused + apiBase: http://localhost:5555/v3 + roles: + - autocomplete +``` + diff --git a/docs/docs/customize/model-providers/more/ovhcloud.mdx b/docs/docs/customize/model-providers/more/ovhcloud.mdx new file mode 100644 index 000000000..6dd4613b9 --- /dev/null +++ b/docs/docs/customize/model-providers/more/ovhcloud.mdx @@ -0,0 +1,72 @@ +--- +title: OVHcloud AI Endpoints +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +OVHcloud AI Endpoints is a serverless inference API that provides access to a curated selection of models (e.g., Llama, Mistral, Qwen, Deepseek). It is designed with security and data privacy in mind and is compliant with GDPR. + +:::info +To get started, create an API key on the OVHcloud [AI Endpoints website](https://endpoints.ai.cloud.ovh.net/). For more information, including pricing, visit the OVHcloud [AI Endpoints product page](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/). +::: + +## Chat model + +We recommend configuring **Qwen2.5-Coder-32B-Instruct** as your chat model. +Check our [catalog](https://endpoints.ai.cloud.ovh.net/catalog) to see all of our models hsoted on AI Endpoints. + + + + ```yaml title="config.yaml" + models: + - name: Qwen2.5-Coder-32B-Instruct + provider: ovhcloud + model: qwen2.5-coder-32b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Qwen2.5-Coder-32B-Instruct", + "provider": "ovhcloud", + "model": "qwen2.5-coder-32b", + "apiKey": "" + } + ] + } + ``` + + + +## Embeddings model + +We recommend configuring **bge-multilingual-gemma2** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: BGE Multilingual Gemma2 + provider: ovhcloud + model: bge-multilingual-gemma2 + apiKey: + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "ovhcloud", + "model": "bge-multilingual-gemma2", + "apiKey": "" + } + } + ``` + + diff --git a/docs/docs/customize/model-providers/top-level/azure.mdx b/docs/docs/customize/model-providers/top-level/azure.mdx index 2c201d938..8202d5608 100644 --- a/docs/docs/customize/model-providers/top-level/azure.mdx +++ b/docs/docs/customize/model-providers/top-level/azure.mdx @@ -143,7 +143,7 @@ For example, a Target URI of `https://just-an-example.openai.azure.com/openai/de models: - name: GPT-4o Azure model: gpt-4o - provider: openai + provider: azure apiBase: https://just-an-example.openai.azure.com apiKey: env: @@ -157,7 +157,7 @@ For example, a Target URI of `https://just-an-example.openai.azure.com/openai/de { "title": "GPT-4o Azure", "model": "gpt-4o", - "provider": "openai", + "provider": "azure", "apiBase": "https://just-an-example.openai.azure.com", "deployment": "gpt-4o-july", "apiVersion": "2023-03-15-preview", diff --git a/docs/docs/customize/model-roles/apply.mdx b/docs/docs/customize/model-roles/apply.mdx index 883353a01..6cce4acbc 100644 --- a/docs/docs/customize/model-roles/apply.mdx +++ b/docs/docs/customize/model-roles/apply.mdx @@ -2,7 +2,7 @@ When editing code, Chat and Edit model output often doesn't clearly align with e ## Recommended Apply models -We recommend [Morph Fast Apply](https://morphllm.com) or [Relace's Instant Apply model](https://hub.continue.dev/relace/instant-apply) for the fastest Apply experience. You can sign up for Morph's generous free tier [here](https://morphllm.com/dashboard) or get a Relace API key [here](https://app.relace.ai/settings/api-keys). +We recommend [Morph Fast Apply](https://morphllm.com) or [Relace's Instant Apply model](https://hub.continue.dev/relace/instant-apply) for the fastest Apply experience. You can sign up for Morph's free tier [here](https://morphllm.com/dashboard) or get a Relace API key [here](https://app.relace.ai/settings/api-keys). However, most Chat models can also be used for applying code changes. We recommend smaller/cheaper models for the task, such as Claude 3.5 Haiku. @@ -33,19 +33,3 @@ models: Please generate the final code without any markers or explanations. ``` - -### Morph Fast Apply Configuration - -```yaml -models: - - name: Morph Fast Apply - provider: openai - model: morph-v0 - apiKey: sk-test-123 - apiBase: https://api.morphllm.com/v1/ - roles: - - apply - - chat - promptTemplates: - apply: "{{{ original_code }}}\n{{{ new_code }}}" -``` diff --git a/docs/docs/customize/tutorials/build-your-own-context-provider.mdx b/docs/docs/customize/tutorials/build-your-own-context-provider.mdx index 1494680c0..d8bdc39be 100644 --- a/docs/docs/customize/tutorials/build-your-own-context-provider.mdx +++ b/docs/docs/customize/tutorials/build-your-own-context-provider.mdx @@ -47,7 +47,17 @@ Continue can retrieve context from a custom HTTP server that you create and serv Then, create a server that responds to requests as are made from [HttpContextProvider.ts](https://github.com/continuedev/continue/blob/main/core/context/providers/HttpContextProvider.ts). See the `hello` endpoint in [context_provider_server.py](https://github.com/continuedev/continue/blob/main/core/context/providers/context_provider_server.py) for an example that uses FastAPI. -The `"options"` property can be used to send additional parameters to your endpoint, which will be included in the request body. +The `"options"` property can be used to send additional parameters to your endpoint. The full request body has the following shape: + +```typescript +{ + query: string; + fullInput: string; + options: Record; + + workspacePath?: string; // Only provided if the server is local. +} +``` :::info The following methods for creating custom context providers are deprecated. We recommend using HTTP context providers, [MCP Servers](../context-providers.mdx#model-context-protocol), and [Prompts](../deep-dives/prompts.md) where possible. diff --git a/docs/docs/customize/tutorials/llama3.1.mdx b/docs/docs/customize/tutorials/llama3.1.mdx index bb65be947..23d7d38a9 100644 --- a/docs/docs/customize/tutorials/llama3.1.mdx +++ b/docs/docs/customize/tutorials/llama3.1.mdx @@ -153,7 +153,7 @@ Replicate makes it easy to host and run open-source AI with an API. SambaNova Cloud provides world record Llama3.1 70B/405B serving. -1. Create an account [here](https://cloud.sambanova.ai/) +1. Create an account [here](http://cloud.sambanova.ai?utm_source=continue&utm_medium=external&utm_campaign=cloud_signup ) 2. Copy your API key 3. Update your Continue config file like this: diff --git a/docs/docs/json-reference.md b/docs/docs/json-reference.md index 0fa8e2d25..c139a6ca2 100644 --- a/docs/docs/json-reference.md +++ b/docs/docs/json-reference.md @@ -158,7 +158,10 @@ Parameters that control the behavior of text generation and completion settings. - `maxTokens`: The maximum number of tokens to generate in a completion (default: `2048`). - `numThreads`: The number of threads used during the generation process. Available only for Ollama as `num_thread`. - `keepAlive`: For Ollama, this parameter sets the number of seconds to keep the model loaded after the last request, unloading it from memory if inactive (default: `1800` seconds, or 30 minutes). +- `numGpu`: For Ollama, this parameter overrides the number of gpu layers that will be used to load the model into VRAM. - `useMmap`: For Ollama, this parameter allows the model to be mapped into memory. If disabled can enhance response time on low end devices but will slow down the stream. +- `reasoning`: Enables thinking/reasoning for Anthropic Claude 3.7+ models. +- `reasoningBudgetTokens`: Sets budget tokens for thinking/reasoning in Anthropic Claude 3.7+ models. Example diff --git a/docs/docs/reference.md b/docs/docs/reference.md index 211cc3df3..9ead04366 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -1,7 +1,7 @@ --- title: Config YAML Reference description: Reference for the Continue configuration YAML file -keywords: [ config, yaml, configuration, customize, customization ] +keywords: [config, yaml, configuration, customize, customization] --- # config.yaml Reference @@ -14,13 +14,12 @@ from [the Hub](https://hub.continue.dev/explore/assistants) or locally - [Continue Hub](https://hub.continue.dev/explore/assistants) - YAML is stored on the hub and automatically synced to the extension - Locally - - in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`) within `.continue/assistants`. - The name of the file will be used as the display name of the assistant, e.g. `My Assistant.yaml` - - in your workspace in a `/.continue/assistants` folder, with the same naming convention + - in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`) within `.continue/assistants`. + The name of the file will be used as the display name of the assistant, e.g. `My Assistant.yaml` + - in your workspace in a `/.continue/assistants` folder, with the same naming convention :::info -Config YAML replaces [`config.json`](./json-reference.md), which is deprecated. View the * -*[Migration Guide](./yaml-migration.md)**. +Config YAML replaces [`config.json`](./json-reference.md), which is deprecated. View the \* \*[Migration Guide](./yaml-migration.md)\*\*. ::: An assistant is made up of: @@ -193,31 +192,32 @@ chat, editing, and summarizing. `autocomplete`](./customize/model-roles/autocomplete.md#prompt-templating). The `chatTemplate` property must be a valid template name, such as `llama3` or `anthropic`. - `chatOptions`: If the model includes role `chat`, these settings apply for Chat and Agent mode: - - `baseSystemMessage`: Can be used to override the default system prompt. + - `baseSystemMessage`: Can be used to override the default system prompt. - `embedOptions`: If the model includes role `embed`, these settings apply for embeddings: - - `maxChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens. - - `maxBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk. + - `maxChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens. + - `maxBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk. - `defaultCompletionOptions`: Default completion options for model settings. - - `contextLength`: Maximum context length of the model, typically in tokens. - - `maxTokens`: Maximum number of tokens to generate in a completion. - - `temperature`: Controls the randomness of the completion. Values range from `0.0` (deterministic) to `1.0` ( - random). - - `topP`: The cumulative probability for nucleus sampling. - - `topK`: Maximum number of tokens considered at each step. - - `stop`: An array of stop tokens that will terminate the completion. - - `n`: Number of completions to generate. + - `contextLength`: Maximum context length of the model, typically in tokens. + - `maxTokens`: Maximum number of tokens to generate in a completion. + - `temperature`: Controls the randomness of the completion. Values range from `0.0` (deterministic) to `1.0` (random). + - `topP`: The cumulative probability for nucleus sampling. + - `topK`: Maximum number of tokens considered at each step. + - `stop`: An array of stop tokens that will terminate the completion. + - `n`: Number of completions to generate. + - `reasoning`: Boolean to enable thinking/reasoning for Anthropic Claude 3.7+ models. + - `reasoningBudgetTokens`: Budget tokens for thinking/reasoning in Anthropic Claude 3.7+ models. - `requestOptions`: HTTP request options specific to the model. - - `timeout`: Timeout for each request to the language model. - - `verifySsl`: Whether to verify SSL certificates for requests. - - `caBundlePath`: Path to a custom CA bundle for HTTP requests. - - `proxy`: Proxy URL for HTTP requests. - - `headers`: Custom headers for HTTP requests. - - `extraBodyProperties`: Additional properties to merge with the HTTP request body. - - `noProxy`: List of hostnames that should bypass the specified proxy. - - `clientCertificate`: Client certificate for HTTP requests. - - `cert`: Path to the client certificate file. - - `key`: Path to the client certificate key file. - - `passphrase`: Optional passphrase for the client certificate key file. + - `timeout`: Timeout for each request to the language model. + - `verifySsl`: Whether to verify SSL certificates for requests. + - `caBundlePath`: Path to a custom CA bundle for HTTP requests. + - `proxy`: Proxy URL for HTTP requests. + - `headers`: Custom headers for HTTP requests. + - `extraBodyProperties`: Additional properties to merge with the HTTP request body. + - `noProxy`: List of hostnames that should bypass the specified proxy. + - `clientCertificate`: Client certificate for HTTP requests. + - `cert`: Path to the client certificate file. + - `key`: Path to the client certificate key file. + - `passphrase`: Optional passphrase for the client certificate key file. #### Example @@ -401,8 +401,8 @@ Destinations to which [development data](./customize/deep-dives/development-data - `name` (**required**): The display name of the data destination - `destination` (**required**): The destination/endpoint that will receive the data. Can be: - - an HTTP endpoint that will receive a POST request with a JSON blob - - a file URL to a directory in which events will be dumpted to `.jsonl` files + - an HTTP endpoint that will receive a POST request with a JSON blob + - a file URL to a directory in which events will be dumpted to `.jsonl` files - `schema` (**required**): the schema version of the JSON blobs to be sent - `events`: an array of event names to include. Defaults to all events if not specified. - `level`: a pre-defined filter for event fields. Options include `all` and `noCode`; the latter excludes data like file diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 06e717ad7..c12f063da 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -5,7 +5,7 @@ const { themes } = require("prism-react-renderer"); const lightCodeTheme = themes.github; const darkCodeTheme = themes.dracula; -/** @type {import('@docusaurus/types').Config} */ +/** @type {import("@docusaurus/types").Config} */ const config = { // Docusaurus V3.6 experimental faster compile features // https://docusaurus.io/blog/releases/3.6#adoption-strategy @@ -48,7 +48,7 @@ const config = { presets: [ [ "classic", - /** @type {import('@docusaurus/preset-classic').Options} */ + /** @type {import("@docusaurus/preset-classic").Options} */ ({ docs: { routeBasePath: "/", @@ -66,7 +66,7 @@ const config = { ], themeConfig: - /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ + /** @type {import("@docusaurus/preset-classic").ThemeConfig} */ ({ metadata: [ { diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/SambaNova.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/SambaNova.md index 79e142ca9..d53afe6e7 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/SambaNova.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/SambaNova.md @@ -1,7 +1,6 @@ # SambaNova Cloud -SambaNova 云是一个运行大型 AI 模型的云平台,有 Llama 3.1 70B/405B 性能的世界记录。你可以在 [这里](https://cloud.sambanova.ai/) 登录,在最初的欢迎屏幕复制你的 API key ,然后在 [模型列表](https://community.sambanova.ai/t/quick-start-guide/104) 任何模型上点击 play 按钮。 - +SambaNova 云是一个运行大型 AI 模型的云平台,有 Llama 3.1 70B/405B 性能的世界记录。你可以在 [这里](http://cloud.sambanova.ai?utm_source=continue&utm_medium=external&utm_campaign=cloud_signup ) 登录,在最初的欢迎屏幕复制你的 API key ,然后在 [模型列表](https://community.sambanova.ai/t/quick-start-guide/104) 任何模型上点击 play 按钮。 ```json title="config.json" { "models": [ diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/llama3.1.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/llama3.1.md index 877864a15..674b3dcbe 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/llama3.1.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/llama3.1.md @@ -95,7 +95,7 @@ Replicate 让使用 API 托管和运行开源 AI 变得简单。 SambaNova Cloud 提供 Llama3.1 70B/405B 服务的世界记录。 -1. 创建账号 [在这里](https://cloud.sambanova.ai/) +1. 创建账号 [在这里](http://cloud.sambanova.ai?utm_source=continue&utm_medium=external&utm_campaign=cloud_signup) 2. 复制你的 API key 3. 更新你的 Continue 配置文件像这样: diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md index 00e72eb42..c8bb5c305 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md @@ -155,6 +155,7 @@ Parameters that control the behavior of text generation and completion settings. - `maxTokens`: The maximum number of tokens to generate in a completion (default: `2048`). - `numThreads`: The number of threads used during the generation process. Available only for Ollama as `num_thread`. - `keepAlive`: For Ollama, this parameter sets the number of seconds to keep the model loaded after the last request, unloading it from memory if inactive (default: `1800` seconds, or 30 minutes). +- `numGpu`: For Ollama, this parameter overrides the number of gpu layers that will be used to load the model into VRAM. - `useMmap`: For Ollama, this parameter allows the model to be mapped into memory. If disabled can enhance response time on low end devices but will slow down the stream. Example diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 3670778d8..64b65c525 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -71,6 +71,20 @@ "title": "Ollama keep_alive", "description": "The number of seconds after no requests are made to unload the model from memory. Defaults to 60*30 = 30min", "type": "integer" + }, + "numGpu": { + "title": "Ollama num_gpu", + "description": "Override the number of gpu layers used when loading the model" + }, + "reasoning": { + "title": "Reasoning", + "description": "Enable thinking/reasoning for Anthropic Claude 3.7+ models", + "type": "boolean" + }, + "reasoningBudgetTokens": { + "title": "Reasoning Budget Tokens", + "description": "Set budget tokens for thinking/reasoning in Anthropic Claude 3.7+ models", + "type": "integer" } } }, @@ -217,6 +231,7 @@ "function-network", "scaleway", "relace", + "ovhcloud", "morph" ], "markdownEnumDescriptions": [ @@ -251,7 +266,7 @@ "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)", "### IBM watsonx\nwatsonx, 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.", "### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys).", - "### SambaNova\n SambaNova provides fast inference of open-source language models with zero data retention. To get started, obtain an API key in [SambaNova Cloud](https://cloud.sambanova.ai/apis).", + "### SambaNova\n SambaNova provides fast inference of open-source language models with zero data retention. To get started, obtain an API key in [SambaNova Cloud](https://cloud.sambanova.ai/apis?utm_source=continue&utm_medium=external&utm_campaign=cloud_signup ).", "### NVIDIA NIMs\nNVIDIA offers a single API to access almost any language model. To find out more, visit the [LLM APIs Documentation](https://docs.api.nvidia.com/nim/reference/llm-apis).\nFor information specific to getting a key, please check out the [docs here](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog)", "### vLLM\nvLLM is a highly performant way of hosting LLMs for a team. To get started, follow their [quickstart](https://docs.vllm.ai/en/latest/getting_started/quickstart.html) to set up your server.", "### Cerebras\nCerebras Inference uses specialized silicon to provides superfast inference. To get started, get your API keys from [their console](https://cloud.cerebras.ai/).", @@ -265,6 +280,7 @@ "### Function Network offers private, affordable user-owned AI\nTo get started with Function Network, obtain your API key from [Function Network](https://www.function.network/join-waitlist). Function Network provides a variety of models for chat, completion, and embeddings.", "### Scaleway\n Generative APIs are serverless endpoints for the most popular AI models.\nHosted in European data centers and priced competitively per million tokens used, models served by Scaleway are ideal for users requiring low latency, full data privacy, and 100% compliance with EU AI Act. To get access to the Scaleway Generative APIs, read the [Quickstart guide](https://www.scaleway.com/en/docs/ai-data/generative-apis/quickstart/) and get a [valid API key](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/).", "### Relace\n Relace provides a fast apply model. To get started, obtain an API key from [here](https://app.relace.ai/settings/api-keys).", + "### OVHcloud AI Endpoints is a serverless inference API that provides access to a curated selection of models (e.g., Llama, Mistral, Qwen, Deepseek). It is designed with security and data privacy in mind and is compliant with GDPR. To get started, create an API key on the OVHcloud [AI Endpoints website](https://endpoints.ai.cloud.ovh.net/). For more information, including pricing, visit the OVHcloud [AI Endpoints product page](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/).", "### Morph\nMorph provides a fast apply model. To get started, obtain an API key from [here](https://morphllm.com/dashboard)." ], "type": "string" @@ -500,7 +516,8 @@ "nebius", "xAI", "kindo", - "scaleway" + "scaleway", + "ovhcloud" ] } }, @@ -1383,6 +1400,42 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["ovhcloud"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.3-70b", + "qwen2.5-coder-32b", + "codestral-mamba-latest", + "mistral-7b", + "mistral-8x7b", + "mistral-nemo", + "DeepSeek-R1-Distill-Llama-70B" + ] + }, + { + "type": "string" + } + ], + "markdownDescription": "Select a pre-defined option, or find the exact model string from OVHcloud [AI Endpoints catalog](https://endpoints.ai.cloud.ovh.net/catalog).", + "x-intellij-html-description": "Select a pre-defined option, or find the exact model string from OVHcloud AI Endpoints catalog." + } + } + } + }, { "if": { "properties": { @@ -1655,20 +1708,17 @@ "anyOf": [ { "enum": [ - "Qwen2.5-Coder-32B-Instruct", + "Llama-4-Scout-17B-16E-Instruct", + "Llama-4-Maverick-17B-128E-Instruct", "Meta-Llama-3.3-70B-Instruct", "Meta-Llama-3.1-8B-Instruct", - "Meta-Llama-3.1-70B-Instruct", "Meta-Llama-3.1-405B-Instruct", - "Llama-3.1-Tulu-3-405B", "Meta-Llama-3.2-1B-Instruct", "Meta-Llama-3.2-3B-Instruct", - "Llama-3.2-11B-Vision-Instruct", - "Llama-3.2-90B-Vision-Instruct", - "Qwen2.5-72B-Instruct", - "QwQ-32B-Preview", + "QwQ-32B", "DeepSeek-R1-Distill-Llama-70B", - "DeepSeek-R1" + "DeepSeek-R1", + "DeepSeek-V3-0324" ] }, { @@ -2772,7 +2822,8 @@ "lmstudio", "siliconflow", "function-network", - "scaleway" + "scaleway", + "ovhcloud" ] }, "model": { diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index e4d639766..69beb8be7 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.26", + "version": "1.1.28", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.26", + "version": "1.1.28", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", @@ -132,6 +132,7 @@ "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "ignore": "^5.3.1", + "is-localhost-ip": "^2.0.0", "jinja-js": "0.1.8", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 7aad46202..1e39374c1 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -15,6 +15,7 @@ import { Core } from "core/core"; import { LOCAL_DEV_DATA_VERSION } from "core/data/log"; import { walkDirAsync } from "core/indexing/walkDir"; import { isModelInstaller } from "core/llm"; +import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTraceInfo"; import { startLocalOllama } from "core/util/ollamaHelper"; import { getDevDataFilePath } from "core/util/paths"; import { Telemetry } from "core/util/posthog"; @@ -381,6 +382,7 @@ const getCommandsMap: ( rules: config.rules, }); } + return { "continue.acceptDiff": async (newFileUri?: string, streamId?: string) => processDiff( @@ -795,7 +797,7 @@ const getCommandsMap: ( vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar"); }, "continue.openConfigPage": () => { - vscode.commands.executeCommand("continue.navigateTo", "/config", true); + vscode.commands.executeCommand("continue.navigateTo", "/config", false); }, "continue.selectFilesAsContext": async ( firstUri: vscode.Uri, @@ -949,7 +951,7 @@ const getCommandsMap: ( if (core.configHandler.currentProfile?.profileDescription.id) { core.invoke("config/updateSelectedModel", { profileId: - core.configHandler.currentProfile?.profileDescription.id, + core.configHandler.currentProfile?.profileDescription.id, role: "autocomplete", title: selectedOption, }); @@ -1014,7 +1016,7 @@ const getCommandsMap: ( }; }; -const registerCopyBufferSpy = ( +const registerCopyBufferService = ( context: vscode.ExtensionContext, core: Core, ) => { @@ -1105,8 +1107,6 @@ export function registerAllCommands( core: Core, editDecorationManager: EditDecorationManager, ) { - registerCopyBufferSpy(context, core); - for (const [command, callback] of Object.entries( getCommandsMap( ide, @@ -1126,4 +1126,20 @@ export function registerAllCommands( vscode.commands.registerCommand(command, callback), ); } + + try { + registerCopyBufferService(context, core); + } catch (e: any) { + //Non-critical error, it needs to be intercepted and not prevent the extension from starting + console.log("Error registering CopyBufferService: ", e); + Telemetry.capture( + "vscode_extension_copy_buffer_failure", + { + stack: extractMinimalStackTraceInfo(e.stack), + message: e.message, + }, + false, + true, + ); + } } diff --git a/gui/package-lock.json b/gui/package-lock.json index bb64c07ff..e4a7c0b67 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -30,6 +30,7 @@ "dompurify": "^3.0.6", "downshift": "^7.6.0", "lodash": "^4.17.21", + "lowlight": "^3.3.0", "minisearch": "^7.0.2", "mustache": "^4.2.0", "posthog-js": "^1.130.1", @@ -135,6 +136,7 @@ "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "ignore": "^5.3.1", + "is-localhost-ip": "^2.0.0", "jinja-js": "0.1.8", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", @@ -7882,18 +7884,28 @@ } }, "node_modules/lowlight": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-1.20.0.tgz", - "integrity": "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-3.3.0.tgz", + "integrity": "sha512-0JNhgFoPvP6U6lE/UdVsSq99tn6DhjjpAj5MxG49ewd2mOBVtwWYIT8ClyABhq198aXXODMU6Ox8DrGy/CpTZQ==", + "license": "MIT", "dependencies": { - "fault": "^1.0.0", - "highlight.js": "~10.7.0" + "@types/hast": "^3.0.0", + "devlop": "^1.0.0", + "highlight.js": "~11.11.0" }, "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/lowlight/node_modules/highlight.js": { + "version": "11.11.1", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.11.1.tgz", + "integrity": "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/lru-cache": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", @@ -10281,6 +10293,19 @@ "react": ">= 0.14.0" } }, + "node_modules/react-syntax-highlighter/node_modules/lowlight": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-1.20.0.tgz", + "integrity": "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==", + "dependencies": { + "fault": "^1.0.0", + "highlight.js": "~10.7.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/react-tooltip": { "version": "5.28.0", "resolved": "https://registry.npmjs.org/react-tooltip/-/react-tooltip-5.28.0.tgz", @@ -10565,28 +10590,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/rehype-highlight/node_modules/highlight.js": { - "version": "11.9.0", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz", - "integrity": "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/rehype-highlight/node_modules/lowlight": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-3.1.0.tgz", - "integrity": "sha512-CEbNVoSikAxwDMDPjXlqlFYiZLkDJHwyGu/MfOsJnF3d7f3tds5J3z8s/l9TMXhzfsJCCJEAsD78842mwmg0PQ==", - "dependencies": { - "@types/hast": "^3.0.0", - "devlop": "^1.0.0", - "highlight.js": "~11.9.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/rehype-katex": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/rehype-katex/-/rehype-katex-7.0.1.tgz", diff --git a/gui/package.json b/gui/package.json index dad5f5d16..8b927add3 100644 --- a/gui/package.json +++ b/gui/package.json @@ -38,6 +38,7 @@ "dompurify": "^3.0.6", "downshift": "^7.6.0", "lodash": "^4.17.21", + "lowlight": "^3.3.0", "minisearch": "^7.0.2", "mustache": "^4.2.0", "posthog-js": "^1.130.1", diff --git a/gui/public/logos/ovhcloud.png b/gui/public/logos/ovhcloud.png new file mode 100644 index 000000000..8ba409324 Binary files /dev/null and b/gui/public/logos/ovhcloud.png differ diff --git a/gui/src/components/StyledMarkdownPreview/index.tsx b/gui/src/components/StyledMarkdownPreview/index.tsx index 1d96f7e5d..082fea740 100644 --- a/gui/src/components/StyledMarkdownPreview/index.tsx +++ b/gui/src/components/StyledMarkdownPreview/index.tsx @@ -1,7 +1,6 @@ import { ctxItemToRifWithContents } from "core/commands/util"; import { memo, useEffect, useMemo, useRef } from "react"; import { useRemark } from "react-remark"; -import rehypeHighlight, { Options } from "rehype-highlight"; import rehypeKatex from "rehype-katex"; import remarkMath from "remark-math"; import styled from "styled-components"; @@ -22,6 +21,7 @@ import { ToolTip } from "../gui/Tooltip"; import FilenameLink from "./FilenameLink"; import "./katex.css"; import "./markdown.css"; +import { rehypeHighlightPlugin } from "./rehypeHighlightPlugin"; import { StepContainerPreToolbar } from "./StepContainerPreToolbar"; import SymbolLink from "./SymbolLink"; import { SyntaxHighlightedPre } from "./SyntaxHighlightedPre"; @@ -243,14 +243,11 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( rehypePlugins: [ rehypeKatex as any, {}, - rehypeHighlight as any, + rehypeHighlightPlugin(), // Note: An empty obj is the default behavior, but leaving this here for scaffolding to // add unsupported languages in the future. We will need to install the `lowlight` package // to use the `common` language set in addition to unsupported languages. // https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md - { - // languages: {}, - } as Options, () => { let codeBlockIndex = 0; return (tree) => { diff --git a/gui/src/components/StyledMarkdownPreview/rehypeHighlightPlugin.ts b/gui/src/components/StyledMarkdownPreview/rehypeHighlightPlugin.ts new file mode 100644 index 000000000..227b77d1f --- /dev/null +++ b/gui/src/components/StyledMarkdownPreview/rehypeHighlightPlugin.ts @@ -0,0 +1,33 @@ +// Feel free to add more! +// See gui/node_modules/highlight.js/lib/languages for the full available list +import clojure from "highlight.js/lib/languages/clojure"; +import elixir from "highlight.js/lib/languages/elixir"; +import julia from "highlight.js/lib/languages/julia"; +import lisp from "highlight.js/lib/languages/lisp"; +import matlab from "highlight.js/lib/languages/matlab"; +import ocaml from "highlight.js/lib/languages/ocaml"; +import powershell from "highlight.js/lib/languages/powershell"; +import protobuf from "highlight.js/lib/languages/protobuf"; +import verilog from "highlight.js/lib/languages/verilog"; +import { common } from "lowlight"; +import rehypeHighlight, { Options } from "rehype-highlight"; + +export function rehypeHighlightPlugin() { + return [ + rehypeHighlight, + { + languages: { + ...common, + clojure, + elixir, + julia, + protobuf, + verilog, + powershell, + ocaml, + matlab, + lisp, + }, + } as Options, + ]; +} diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index abde8ce18..4690f683d 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -91,8 +91,18 @@ function InputToolbar(props: InputToolbarProps) { }} >
- - + + + + Select Mode + + + + + + Select Model + +
{props.toolbarOptions?.hideImageUpload || (supportsImages && ( @@ -120,8 +130,9 @@ function InputToolbar(props: InputToolbarProps) { fileInputRef.current?.click(); }} /> + - Attach an image + Attach Image @@ -134,7 +145,7 @@ function InputToolbar(props: InputToolbarProps) { /> - Add context (files, docs, urls, etc.) + Attach Context )} @@ -170,7 +181,7 @@ function InputToolbar(props: InputToolbarProps) { {getMetaKeyLabel()}⏎ @codebase - Submit with the codebase as context ({getMetaKeyLabel()}⏎) + Send With Codebase as Context ({getMetaKeyLabel()}⏎) )} @@ -196,6 +207,7 @@ function InputToolbar(props: InputToolbarProps) { )} { @@ -212,6 +224,9 @@ function InputToolbar(props: InputToolbarProps) { ⏎ {props.toolbarOptions?.enterText ?? "Enter"} ⏎ + + Send (⏎) +
diff --git a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx index 00d00a8c7..b9b27aa92 100644 --- a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx @@ -75,6 +75,7 @@ function BlockSettingsToolbarIcon( const id = `block-settings-toolbar-icon-${props.sectionId}`; return ( + <> + {props.tooltip} @@ -160,9 +162,7 @@ export function BlockSettingsTopToolbar() { -
- +
+ + + + Select Assistant + +
); diff --git a/gui/src/components/modelSelection/ModeSelect.tsx b/gui/src/components/modelSelection/ModeSelect.tsx index 92395f545..b4cb94545 100644 --- a/gui/src/components/modelSelection/ModeSelect.tsx +++ b/gui/src/components/modelSelection/ModeSelect.tsx @@ -8,9 +8,10 @@ import { } from "@heroicons/react/24/outline"; import { MessageModes } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; -import { useEffect, useMemo } from "react"; +import { useEffect, useMemo, useState } from "react"; import styled from "styled-components"; import { lightGray } from ".."; +import { useWebviewListener } from "../../hooks/useWebviewListener"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { selectSelectedChatModel } from "../../redux/slices/configSlice"; import { @@ -41,6 +42,8 @@ function ModeSelect() { const dispatch = useAppDispatch(); const mode = useAppSelector(selectCurrentMode); const selectedModel = useAppSelector(selectSelectedChatModel); + const currentSession = useAppSelector((state) => state.session); + const [newSessionInitialized, setNewSessionInitialized] = useState(false); const agentModeSupported = selectedModel && modelSupportsTools(selectedModel); const jetbrains = useMemo(() => { @@ -83,6 +86,16 @@ function ModeSelect() { return () => document.removeEventListener("keydown", handleKeyDown); }, [dispatch, mode, jetbrains]); + useWebviewListener("newSession", async () => { + setNewSessionInitialized(true); + }); + + useEffect(() => { + if (currentSession.history.length > 0) { + setNewSessionInitialized(false); + } + }, [currentSession.history]); + return ( > = { packages: [models.llama31Chat, models.deepseek], apiKeyUrl: "https://function.network/join-waitlist", }, + ovhcloud: { + title: "OVHcloud", + provider: "ovhcloud", + refPage: "ovhcloud", + description: + "OVHcloud AI Endpoints is a serverless inference API that provides access to a curated selection of models (e.g., Llama, Mistral, Qwen, Deepseek). It is designed with security and data privacy in mind and is compliant with GDPR.", + longDescription: `To get started, create an API key on the OVHcloud [AI Endpoints website](https://endpoints.ai.cloud.ovh.net/). For more information, including pricing, visit the OVHcloud [AI Endpoints product page](https://www.ovhcloud.com/en/public-cloud/ai-endpoints/).`, + params: { + apiKey: "", + }, + collectInputFor: [ + { + inputType: "text", + key: "apiKey", + label: "API key", + placeholder: "Enter your AI Endpoints API key", + required: true, + }, + ...completionParamsInputsConfigs, + ], + icon: "ovhcloud.png", + tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], + packages: [ + models.llama318bChat, + models.llama3170bChat, + models.llama3370bChat, + models.codestralMamba, + models.mistralOs, + models.mistralNemo, + models.Qwen25Coder32b, + models.deepseekR1DistillLlama70B, + ], + apiKeyUrl: "https://endpoints.ai.cloud.ovh.net/", + }, scaleway: { title: "Scaleway", provider: "scaleway", @@ -748,7 +782,7 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo refPage: "sambanova", description: "Use SambaNova Cloud for fast inference performance", icon: "sambanova.png", - longDescription: `The SambaNova Cloud is a cloud platform for running large open source AI models with the world record performance and zero data retention. You can sign up [here](https://cloud.sambanova.ai/)`, + longDescription: `The SambaNova Cloud is a cloud platform for running large open source AI models with the world record performance and zero data retention. You can sign up [here](http://cloud.sambanova.ai?utm_source=continue&utm_medium=external&utm_campaign=cloud_signup)`, tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], params: { apiKey: "", @@ -764,20 +798,17 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo ...completionParamsInputsConfigs, ], packages:[ - models.qwen25Coder32BInstruct, + models.llama4Scout, + models.llama4Maverick, models.llama3370BInstruct, models.llama318BInstruct, - models.llama3170BInstruct, models.llama31405BInstruct, - models.llama31Tulu3405B, models.llama321BInstruct, models.llama323BInstruct, - models.llama3211BInstruct, - models.llama3290BInstruct, - models.qwen2572BInstruct, - models.qwq32BPreview, + models.qwq32B, models.deepseekR1DistillLlama70B, models.deepseekR1, + models.deepseekV3 ], apiKeyUrl: "https://cloud.sambanova.ai/apis", }, diff --git a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx index f88b6fdac..d041943b5 100644 --- a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +++ b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx @@ -32,7 +32,7 @@ export function SimpleToolCallUI({ }, [toolCallState.parsedArgs]); return ( -
+
{ + const endpoint = new URL("completions", this.apiBase); + const resp = await customFetch(this.config.requestOptions)(endpoint, { + method: "POST", + body: JSON.stringify({ + model: body.model, + prompt: body.prompt, + suffix: body.suffix.trim() === "" ? "<|endoftext|>" : body.suffix, + max_tokens: body.max_tokens ?? 150, // Only want this for /fim, not chat + temperature: body.temperature, + top_p: body.top_p, + frequency_penalty: body.frequency_penalty, + presence_penalty: body.presence_penalty, + stop: [...(body.stop ?? []), "\n\n", "\n \n"], + stream: true, + }), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + Authorization: `Bearer ${this.config.apiKey}`, + }, + signal, + }); + for await (const chunk of streamSse(resp as any)) { + if (!chunk.choices[0]) { + continue; + } + yield chatChunk({ + content: chunk.choices[0].text, + finish_reason: null, + model: body.model, + }); + } + } + + list(): Promise { + throw new Error("Method not implemented."); + } +} diff --git a/packages/openai-adapters/src/index.ts b/packages/openai-adapters/src/index.ts index 05e43fc20..e9ac7501b 100644 --- a/packages/openai-adapters/src/index.ts +++ b/packages/openai-adapters/src/index.ts @@ -2,15 +2,16 @@ import dotenv from "dotenv"; import { z } from "zod"; import { AnthropicApi } from "./apis/Anthropic.js"; import { AzureOpenAIApi } from "./apis/AzureOpenAI.js"; -import { BaseLlmApi } from "./apis/base.js"; import { CohereApi } from "./apis/Cohere.js"; import { DeepSeekApi } from "./apis/DeepSeek.js"; import { GeminiApi } from "./apis/Gemini.js"; +import { InceptionApi } from "./apis/Inception.js"; import { JinaApi } from "./apis/Jina.js"; import { MockApi } from "./apis/Mock.js"; import { MoonshotApi } from "./apis/Moonshot.js"; import { OpenAIApi } from "./apis/OpenAI.js"; import { RelaceApi } from "./apis/Relace.js"; +import { BaseLlmApi } from "./apis/base.js"; import { LLMConfig, OpenAIConfigSchema } from "./types.js"; dotenv.config(); @@ -45,6 +46,8 @@ export function constructLlmApi(config: LLMConfig): BaseLlmApi | undefined { return new MoonshotApi(config); case "relace": return new RelaceApi(config); + case "inception": + return new InceptionApi(config); case "x-ai": return openAICompatible("https://api.x.ai/v1/", config); case "voyage": @@ -71,6 +74,8 @@ export function constructLlmApi(config: LLMConfig): BaseLlmApi | undefined { return openAICompatible("http://localhost:10000", config); case "nvidia": return openAICompatible("https://integrate.api.nvidia.com/v1/", config); + case "ovhcloud": + return openAICompatible("https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/", config); case "scaleway": return openAICompatible("https://api.scaleway.ai/v1/", config); case "fireworks": @@ -106,9 +111,10 @@ export { type Completion, type CompletionCreateParams, type CompletionCreateParamsNonStreaming, - type CompletionCreateParamsStreaming, + type CompletionCreateParamsStreaming } from "openai/resources/index"; // export export type { BaseLlmApi } from "./apis/base.js"; export type { LLMConfig } from "./types.js"; + diff --git a/packages/openai-adapters/src/types.ts b/packages/openai-adapters/src/types.ts index 04f0b0c12..a5e8c4955 100644 --- a/packages/openai-adapters/src/types.ts +++ b/packages/openai-adapters/src/types.ts @@ -37,6 +37,7 @@ export const OpenAIConfigSchema = BasePlusConfig.extend({ z.literal("deepinfra"), z.literal("groq"), z.literal("nvidia"), + z.literal("ovhcloud"), z.literal("fireworks"), z.literal("together"), z.literal("novita"), @@ -103,6 +104,11 @@ export const JinaConfigSchema = OpenAIConfigSchema.extend({ }); export type JinaConfig = z.infer; +export const InceptionConfigSchema = OpenAIConfigSchema.extend({ + provider: z.literal("inception"), +}); +export type InceptionConfig = z.infer; + // Discriminated union export const LLMConfigSchema = z.discriminatedUnion("provider", [ OpenAIConfigSchema, @@ -114,5 +120,6 @@ export const LLMConfigSchema = z.discriminatedUnion("provider", [ AnthropicConfigSchema, JinaConfigSchema, MockConfigSchema, + InceptionConfigSchema, ]); export type LLMConfig = z.infer;