Merge branch 'preview' of https://github.com/continuedev/continue into preview

This commit is contained in:
Nate Sesti 2024-02-15 18:53:37 -08:00
commit fea01b2555
2 changed files with 44 additions and 10 deletions

View file

@ -1,6 +1,16 @@
import { ChatMessage } from "../..";
import { stripImages } from "../countTokens";
/**
* @description Template for LLAMA2 messages:
*
* <s>[INST] <<SYS>>
* {{ system_prompt }}
* <</SYS>>
*
* {{ user_msg_1 }} [/INST] {{ model_answer_1 }} </s><s>[INST] {{ user_msg_2 }} [/INST] {{ model_answer_2 }} </s><s>[INST] {{ user_msg_3 }} [/INST]
*/
function llama2TemplateMessages(msgs: ChatMessage[]): string {
if (msgs.length === 0) {
return "";
@ -21,14 +31,9 @@ function llama2TemplateMessages(msgs: ChatMessage[]): string {
}
if (hasSystem) {
const systemMessage = `
<<SYS>>
${msgs[0].content}
<</SYS>>
`;
const systemMessage = `<<SYS>>\n ${msgs[0].content}\n<</SYS>>\n\n`;
if (msgs.length > 1) {
prompt += `[INST] ${systemMessage}${msgs[1].content} [/INST]`;
prompt += `<s>[INST] ${systemMessage} ${msgs[1].content} [/INST]`;
} else {
prompt += `[INST] ${systemMessage} [/INST]`;
return prompt;
@ -39,7 +44,7 @@ function llama2TemplateMessages(msgs: ChatMessage[]): string {
if (msgs[i].role === "user") {
prompt += `[INST] ${msgs[i].content} [/INST]`;
} else {
prompt += msgs[i].content + " ";
prompt += msgs[i].content + "</s>\n<s>";
}
}

View file

@ -96,13 +96,42 @@ We also support other methods of generating embeddings, which can be configured
### OpenAI
OpenAI's [ada-002 embeddings](https://platform.openai.com/docs/guides/embeddings) are high dimensional embeddings that give great performance on both text and code.
OpenAI's [embeddings](https://platform.openai.com/docs/guides/embeddings) are high dimensional embeddings that give great performance on both text and code.
Configuration for text-embedding-3-small Model
The text-embedding-3-small model offers an outstanding balance between performance and efficiency, suitable for a versatile range of applications.
```json title="~/.continue/config.json"
{
"embeddingsProvider": {
"provider": "openai",
"model": "text-embedding-ada-002", // optional, defaults to "text-embedding-ada-002"
"model": "text-embedding-3-small",
"apiBase": "<your custom OpenAI-compatible endpoint>" // optional, defaults to OpenAI's API
}
}
```
Configuration for text-embedding-3-large Model
For those requiring the highest level of embedding detail and precision, the text-embedding-3-large model is the better choice.
```json title="~/.continue/config.json"
{
"embeddingsProvider": {
"provider": "openai",
"model": "text-embedding-3-large",
"apiBase": "<your custom OpenAI-compatible endpoint>" // optional, defaults to OpenAI's API
}
}
```
Legacy Model Configuration
For certain scenarios, you may still find the text-embedding-ada-002 model relevant. Below is the configuration example:
```json title="~/.continue/config.json"
{
"embeddingsProvider": {
"provider": "openai",
"model": "text-embedding-ada-002",
"apiBase": "<your custom OpenAI-compatible endpoint>" // optional, defaults to OpenAI's API
}
}