From 06013a955f91b8077ecc8d0b38a5248669a797ab Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 16 Oct 2024 11:32:15 -0700 Subject: [PATCH 1/5] Update troubleshooting.md --- docs/docs/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.md index 67a0f1070..d10d2c104 100644 --- a/docs/docs/troubleshooting.md +++ b/docs/docs/troubleshooting.md @@ -126,7 +126,7 @@ This can be accomplished using the following command: `Continue: Rebuild codebas ### Android Studio - "Nothing to show" in Chat -This can be fixed by selecting `Actions > Choose Boot runtime for the IDE` then selecting the latest version, and then restarting Android Studio. [See this thread](https://github.com/continuedev/continue/issues/2280#issuecomment-2365231567) for details. +This can be fixed by selecting `Actions > Choose Boot runtime for the IDE` then selecting the latest version, and then restarting Android Studio. [See this thread](https://github.com/continuedev/continue/issues/596#issuecomment-1789327178) for details. ## Still having trouble? From dba31495fdcdc2d1f3331c00616b590ae64e10a3 Mon Sep 17 00:00:00 2001 From: classbinu Date: Fri, 18 Oct 2024 22:30:43 +0900 Subject: [PATCH 2/5] docs: Update Recommended reranking models --- docs/docs/customize/model-types/reranking.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/customize/model-types/reranking.md b/docs/docs/customize/model-types/reranking.md index 5f3fd77a3..2032aaf13 100644 --- a/docs/docs/customize/model-types/reranking.md +++ b/docs/docs/customize/model-types/reranking.md @@ -11,11 +11,11 @@ In Continue, reranking is used by [@Codebase](../deep-dives/codebase.md) in orde ## Recommended reranking models -If you have the ability to use any model, we recommend `rerank-1` by Voyage AI, which is listed below along with the rest of the options for rerankers. +If you have the ability to use any model, we recommend `rerank-2` by Voyage AI, which is listed below along with the rest of the options for rerankers. ### Voyage AI -Voyage AI offers the best reranking model for code with their `rerank-1` model. After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this: +Voyage AI offers the best reranking model for code with their `rerank-2` model. After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this: ```json title="config.json" { From dac28f939ba2f6988458809831fbfef3d1a491e5 Mon Sep 17 00:00:00 2001 From: Anantha Kandrapu Date: Fri, 18 Oct 2024 23:44:46 -0700 Subject: [PATCH 3/5] Added Cohere embeddings with bedrock provider --- .../embeddings/BedrockEmbeddingsProvider.ts | 68 +++++++++++++------ 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/core/indexing/embeddings/BedrockEmbeddingsProvider.ts b/core/indexing/embeddings/BedrockEmbeddingsProvider.ts index bf3bcac88..a5cfce6c4 100644 --- a/core/indexing/embeddings/BedrockEmbeddingsProvider.ts +++ b/core/indexing/embeddings/BedrockEmbeddingsProvider.ts @@ -6,11 +6,14 @@ import { fromIni } from "@aws-sdk/credential-providers"; import { EmbeddingsProviderName, EmbedOptions, FetchFunction } from "../../index.js"; import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js"; +interface ModelConfig { + formatPayload: (text: string) => any; + extractEmbeddings: (responseBody: any) => number[][]; +} + class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { - static providerName: EmbeddingsProviderName = "bedrock"; - - static defaultOptions: Partial | undefined = { + static defaultOptions: Partial = { model: "amazon.titan-embed-text-v2:0", region: "us-east-1" }; @@ -18,6 +21,7 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { constructor(options: EmbedOptions, fetch: FetchFunction) { super(options, fetch); + this.options.model = this.options.model || BedrockEmbeddingsProvider.defaultOptions.model!; if (!options.apiBase) { options.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; } @@ -29,7 +33,7 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { } } - async embed(chunks: string[]) { + async embed(chunks: string[]): Promise { const credentials = await this._getCredentials(); const client = new BedrockRuntimeClient({ region: this.options.region, @@ -43,41 +47,64 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { return ( await Promise.all( chunks.map(async (chunk) => { - const input = this._generateInvokeModelCommandInput(chunk, this.options); + const input = this._generateInvokeModelCommandInput(chunk); const command = new InvokeModelCommand(input); const response = await client.send(command); - if (response.body) { const responseBody = JSON.parse(new TextDecoder().decode(response.body)); - return [responseBody.embedding]; + return this._extractEmbeddings(responseBody); } + return []; }), ) ).flat(); } - private _generateInvokeModelCommandInput( - prompt: string, - options: EmbedOptions, - ): any { - const payload = { - "inputText": prompt, - "dimensions": 512, - "normalize": true - }; + private _generateInvokeModelCommandInput(text: string): any { + const modelConfig = this._getModelConfig(); + const payload = modelConfig.formatPayload(text); return { body: JSON.stringify(payload), modelId: this.options.model, - accept: "application/json", - contentType: "application/json" + accept: "*/*", + contentType: "application/json", }; } + private _extractEmbeddings(responseBody: any): number[][] { + const modelConfig = this._getModelConfig(); + return modelConfig.extractEmbeddings(responseBody); + } + + private _getModelConfig() { + const modelConfigs: { [key: string]: ModelConfig } = { + 'cohere': { + formatPayload: (text: string) => ({ + texts: [text], + input_type: "search_document", + truncate: "END", + }), + extractEmbeddings: (responseBody: any) => responseBody.embeddings || [], + }, + 'amazon.titan-embed': { + formatPayload: (text: string) => ({ + inputText: text, + }), + extractEmbeddings: (responseBody: any) => responseBody.embedding ? [responseBody.embedding] : [], + }, + }; + + const modelPrefix = Object.keys(modelConfigs).find(prefix => this.options.model!.startsWith(prefix)); + if (!modelPrefix) { + throw new Error(`Unsupported model: ${this.options.model}`); + } + return modelConfigs[modelPrefix]; + } + private async _getCredentials() { try { - return await - fromIni({ + return await fromIni({ profile: this.profile, ignoreCache: true })(); @@ -88,7 +115,6 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider { return await fromIni()(); } } - } export default BedrockEmbeddingsProvider; From bfd9ed388cf05ba28b3844dd290c9214cd1e335e Mon Sep 17 00:00:00 2001 From: Anantha Kandrapu <90415186+Anantha-Kandrapu@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:23:36 -0700 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 597256325..9751d618d 100644 --- a/README.md +++ b/README.md @@ -62,4 +62,4 @@ Check out the [contribution ideas board](https://github.com/orgs/continuedev/pro ## License -[Apache 2.0 © 2023 Continue Dev, Inc.](./LICENSE) +[Apache 2.0 © 2023-2024 Continue Dev, Inc.](./LICENSE) From 0d6e941fd44fec760154a2396589b8a651276590 Mon Sep 17 00:00:00 2001 From: Anantha Kandrapu <90415186+Anantha-Kandrapu@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:24:56 -0700 Subject: [PATCH 5/5] Update CHANGELOG.md --- extensions/vscode/CHANGELOG.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/extensions/vscode/CHANGELOG.md b/extensions/vscode/CHANGELOG.md index 55bd200ac..cabf54bf2 100644 --- a/extensions/vscode/CHANGELOG.md +++ b/extensions/vscode/CHANGELOG.md @@ -5,11 +5,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). -## 0.8.54 - 2024-10-15 -### Fixed -* Hotfix: throttle transformers.js embeddings provider - -## 0.8.53 - 2024-10-11 +Pre-release Changes ### Added * Web context provider * Cerebras inference provider