diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 2b7a12092..e063692b4 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -106,7 +106,8 @@ "llama.cpp", "replicate", "text-gen-webui", - "google-palm" + "google-palm", + "lmstudio" ], "type": "string" }, @@ -140,7 +141,8 @@ "zephyr", "phind", "anthropic", - "chatml" + "chatml", + "deepseek" ], "type": "string" }, @@ -218,7 +220,10 @@ "wizardcoder-13b", "wizardcoder-34b", "zephyr-7b", - "codeup-13b" + "codeup-13b", + "deepseek-1b", + "deepseek-7b", + "deepseek-33b" ] } } @@ -379,7 +384,10 @@ "wizardcoder-13b", "wizardcoder-34b", "zephyr-7b", - "codeup-13b" + "codeup-13b", + "deepseek-1b", + "deepseek-7b", + "deepseek-33b" ] } } @@ -448,7 +456,6 @@ "properties": { "provider": { "enum": [ - "ollama", "huggingface-tgi", "huggingface-inference-api", "llama.cpp", @@ -458,6 +465,39 @@ }, "required": ["provider"] }, + "then": { + "properties": { + "model": { + "enum": [ + "mistral-7b", + "llama2-7b", + "llama2-13b", + "codellama-7b", + "codellama-13b", + "codellama-34b", + "phind-codellama-34b", + "wizardcoder-7b", + "wizardcoder-13b", + "wizardcoder-34b", + "zephyr-7b", + "codeup-13b", + "deepseek-1b", + "deepseek-7b", + "deepseek-33b" + ] + } + } + } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["ollama"] + } + }, + "required": ["provider"] + }, "then": { "properties": { "model": { diff --git a/extensions/vscode/schema/ContinueConfig.d.ts b/extensions/vscode/schema/ContinueConfig.d.ts index 07992d3e9..cd3524ca2 100644 --- a/extensions/vscode/schema/ContinueConfig.d.ts +++ b/extensions/vscode/schema/ContinueConfig.d.ts @@ -146,7 +146,8 @@ export type Step1 = | "ClearHistoryStep" | "StackOverflowStep" | "OpenConfigStep" - ); + ) + | string; /** * An array of slash commands that let you map custom Steps to a shortcut. */ @@ -291,7 +292,7 @@ export interface ChatMessage { role: Role; content?: Content; name?: Name1; - summary: Summary; + summary?: Summary; function_call?: FunctionCall; [k: string]: unknown; } diff --git a/extensions/vscode/schema/ModelDescription.d.ts b/extensions/vscode/schema/ModelDescription.d.ts index 5ad82bf80..2602a8cb3 100644 --- a/extensions/vscode/schema/ModelDescription.d.ts +++ b/extensions/vscode/schema/ModelDescription.d.ts @@ -46,7 +46,7 @@ export type ContextLength = number; /** * The chat template used to format messages. This is auto-detected for most models, but can be overridden here. */ -export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml"; +export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml" | "deepseek"; /** * Options for the completion endpoint. Read more about the completion options in the documentation. */ diff --git a/extensions/vscode/schema/ModelName.d.ts b/extensions/vscode/schema/ModelName.d.ts index e0e631dc6..feec3f8e5 100644 --- a/extensions/vscode/schema/ModelName.d.ts +++ b/extensions/vscode/schema/ModelName.d.ts @@ -24,5 +24,8 @@ export type ModelName = | "wizardcoder-34b" | "zephyr-7b" | "codeup-13b" + | "deepseek-1b" + | "deepseek-7b" + | "deepseek-33b" | "claude-2" | "chat-bison-001"; diff --git a/extensions/vscode/schema/SerializedContinueConfig.d.ts b/extensions/vscode/schema/SerializedContinueConfig.d.ts index 2785294be..b5fff520b 100644 --- a/extensions/vscode/schema/SerializedContinueConfig.d.ts +++ b/extensions/vscode/schema/SerializedContinueConfig.d.ts @@ -54,7 +54,7 @@ export type ContextLength = number; /** * The chat template used to format messages. This is auto-detected for most models, but can be overridden here. */ -export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml"; +export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml" | "deepseek"; /** * Options for the completion endpoint. Read more about the completion options in the documentation. */ @@ -153,7 +153,8 @@ export type Step = | "ClearHistoryStep" | "StackOverflowStep" | "OpenConfigStep" - ); + ) + | string; /** * An array of slash commands that let you map custom Steps to a shortcut. */ diff --git a/gui/src/schema/ContinueConfig.d.ts b/gui/src/schema/ContinueConfig.d.ts index 07992d3e9..cd3524ca2 100644 --- a/gui/src/schema/ContinueConfig.d.ts +++ b/gui/src/schema/ContinueConfig.d.ts @@ -146,7 +146,8 @@ export type Step1 = | "ClearHistoryStep" | "StackOverflowStep" | "OpenConfigStep" - ); + ) + | string; /** * An array of slash commands that let you map custom Steps to a shortcut. */ @@ -291,7 +292,7 @@ export interface ChatMessage { role: Role; content?: Content; name?: Name1; - summary: Summary; + summary?: Summary; function_call?: FunctionCall; [k: string]: unknown; } diff --git a/gui/src/schema/ModelDescription.d.ts b/gui/src/schema/ModelDescription.d.ts index 5ad82bf80..2602a8cb3 100644 --- a/gui/src/schema/ModelDescription.d.ts +++ b/gui/src/schema/ModelDescription.d.ts @@ -46,7 +46,7 @@ export type ContextLength = number; /** * The chat template used to format messages. This is auto-detected for most models, but can be overridden here. */ -export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml"; +export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml" | "deepseek"; /** * Options for the completion endpoint. Read more about the completion options in the documentation. */ diff --git a/gui/src/schema/ModelName.d.ts b/gui/src/schema/ModelName.d.ts index e0e631dc6..feec3f8e5 100644 --- a/gui/src/schema/ModelName.d.ts +++ b/gui/src/schema/ModelName.d.ts @@ -24,5 +24,8 @@ export type ModelName = | "wizardcoder-34b" | "zephyr-7b" | "codeup-13b" + | "deepseek-1b" + | "deepseek-7b" + | "deepseek-33b" | "claude-2" | "chat-bison-001"; diff --git a/gui/src/schema/SerializedContinueConfig.d.ts b/gui/src/schema/SerializedContinueConfig.d.ts index 2785294be..b5fff520b 100644 --- a/gui/src/schema/SerializedContinueConfig.d.ts +++ b/gui/src/schema/SerializedContinueConfig.d.ts @@ -54,7 +54,7 @@ export type ContextLength = number; /** * The chat template used to format messages. This is auto-detected for most models, but can be overridden here. */ -export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml"; +export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml" | "deepseek"; /** * Options for the completion endpoint. Read more about the completion options in the documentation. */ @@ -153,7 +153,8 @@ export type Step = | "ClearHistoryStep" | "StackOverflowStep" | "OpenConfigStep" - ); + ) + | string; /** * An array of slash commands that let you map custom Steps to a shortcut. */ diff --git a/gui/src/util/modelData.ts b/gui/src/util/modelData.ts index 930b6f86e..416087c47 100644 --- a/gui/src/util/modelData.ts +++ b/gui/src/util/modelData.ts @@ -299,18 +299,17 @@ const zephyr: ModelPackage = { providerOptions: ["ollama", "lmstudio", "llamacpp", "replicate"], }; -// const deepseek: ModelPackage = { -// title: "DeepSeek-Coder", -// description: -// "A fine-tune of Mistral, trained on publicly available and synthetic datasets.", -// params: { -// title: "DeepSeek", -// model: "deepseek-7b", -// context_length: 2048, -// }, -// icon: "mistral.png", -// providerOptions: ["ollama", "lmstudio", "llamacpp", "replicate"], -// }; +const deepseek: ModelPackage = { + title: "DeepSeek-Coder", + description: + "A model pre-trained on 2 trillion tokens including 80+ programming languages and a repo-level corpus.", + params: { + title: "DeepSeek", + model: "deepseek-7b", + context_length: 2048, + }, + providerOptions: ["lmstudio", "llamacpp"], +}; const codeup: ModelPackage = { title: "CodeUp (13b)", @@ -414,6 +413,7 @@ export const MODEL_INFO: ModelPackage[] = [ codeup, chatBison, zephyr, + deepseek, ]; export const PROVIDER_INFO: { [key: string]: ModelInfo } = { @@ -528,7 +528,7 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = { params: { server_url: "http://localhost:1234", }, - packages: osModels, + packages: [...osModels, deepseek], collectInputFor: [...completionParamsInputs], }, replicate: { @@ -574,7 +574,7 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = { After it's up and running, you can start using Continue.`, icon: "llamacpp.png", tags: [ModelProviderTag.Local, ModelProviderTag["Open-Source"]], - packages: osModels, + packages: [...osModels, deepseek], collectInputFor: [...completionParamsInputs], }, textgenwebui: { @@ -595,7 +595,7 @@ After it's up and running, you can start using Continue.`, 6. Once the model is loaded, you can start using Continue`, icon: undefined, tags: [ModelProviderTag.Local, ModelProviderTag["Open-Source"]], - packages: osModels, + packages: [...osModels, deepseek], collectInputFor: [...completionParamsInputs], }, palm: { diff --git a/schema/json/ContinueConfig.json b/schema/json/ContinueConfig.json index 28f745b22..f1480a714 100644 --- a/schema/json/ContinueConfig.json +++ b/schema/json/ContinueConfig.json @@ -36,6 +36,7 @@ }, "content": { "title": "Content", + "default": "", "type": "string" }, "name": { @@ -51,8 +52,7 @@ } }, "required": [ - "role", - "summary" + "role" ] }, "Step": { @@ -137,7 +137,7 @@ "max_tokens": { "title": "Max Tokens", "description": "The maximum number of tokens to generate.", - "default": 600, + "default": 1023, "type": "integer" } } @@ -217,7 +217,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "allOf": [ { @@ -351,6 +351,9 @@ "OpenConfigStep" ], "type": "string" + }, + { + "type": "string" } ] }, @@ -602,7 +605,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "request_options": { "timeout": 300, @@ -615,7 +618,33 @@ "template_messages": null, "api_key": null, "api_base": null, - "llm": null, + "llm": { + "title": null, + "model": "gpt-4", + "system_message": null, + "context_length": 2048, + "completion_options": { + "temperature": null, + "top_p": null, + "top_k": null, + "presence_penalty": null, + "frequency_penalty": null, + "stop": null, + "max_tokens": 1023 + }, + "request_options": { + "timeout": 300, + "verify_ssl": null, + "ca_bundle_path": null, + "proxy": null, + "headers": null + }, + "prompt_templates": {}, + "template_messages": null, + "api_key": null, + "api_base": null, + "class_name": "ProxyServer" + }, "class_name": "OpenAIFreeTrial" }, "summarize": { @@ -630,7 +659,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "request_options": { "timeout": 300, @@ -643,7 +672,33 @@ "template_messages": null, "api_key": null, "api_base": null, - "llm": null, + "llm": { + "title": null, + "model": "gpt-3.5-turbo", + "system_message": null, + "context_length": 2048, + "completion_options": { + "temperature": null, + "top_p": null, + "top_k": null, + "presence_penalty": null, + "frequency_penalty": null, + "stop": null, + "max_tokens": 1023 + }, + "request_options": { + "timeout": 300, + "verify_ssl": null, + "ca_bundle_path": null, + "proxy": null, + "headers": null + }, + "prompt_templates": {}, + "template_messages": null, + "api_key": null, + "api_base": null, + "class_name": "ProxyServer" + }, "class_name": "OpenAIFreeTrial" }, "edit": { @@ -658,7 +713,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "request_options": { "timeout": 300, @@ -671,7 +726,33 @@ "template_messages": null, "api_key": null, "api_base": null, - "llm": null, + "llm": { + "title": null, + "model": "gpt-4", + "system_message": null, + "context_length": 2048, + "completion_options": { + "temperature": null, + "top_p": null, + "top_k": null, + "presence_penalty": null, + "frequency_penalty": null, + "stop": null, + "max_tokens": 1023 + }, + "request_options": { + "timeout": 300, + "verify_ssl": null, + "ca_bundle_path": null, + "proxy": null, + "headers": null + }, + "prompt_templates": {}, + "template_messages": null, + "api_key": null, + "api_base": null, + "class_name": "ProxyServer" + }, "class_name": "OpenAIFreeTrial" }, "chat": { @@ -686,7 +767,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "request_options": { "timeout": 300, @@ -699,7 +780,33 @@ "template_messages": null, "api_key": null, "api_base": null, - "llm": null, + "llm": { + "title": null, + "model": "gpt-4", + "system_message": null, + "context_length": 2048, + "completion_options": { + "temperature": null, + "top_p": null, + "top_k": null, + "presence_penalty": null, + "frequency_penalty": null, + "stop": null, + "max_tokens": 1023 + }, + "request_options": { + "timeout": 300, + "verify_ssl": null, + "ca_bundle_path": null, + "proxy": null, + "headers": null + }, + "prompt_templates": {}, + "template_messages": null, + "api_key": null, + "api_base": null, + "class_name": "ProxyServer" + }, "class_name": "OpenAIFreeTrial" }, "saved": [], @@ -727,7 +834,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "allOf": [ { diff --git a/schema/json/LLM.json b/schema/json/LLM.json index 34bcaaf04..6dcf550f9 100644 --- a/schema/json/LLM.json +++ b/schema/json/LLM.json @@ -42,7 +42,7 @@ "max_tokens": { "title": "Max Tokens", "description": "The maximum number of tokens to generate.", - "default": 600, + "default": 1023, "type": "integer" } } @@ -122,7 +122,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "allOf": [ { diff --git a/schema/json/ModelDescription.json b/schema/json/ModelDescription.json index 4675e7031..a1670a5dc 100644 --- a/schema/json/ModelDescription.json +++ b/schema/json/ModelDescription.json @@ -42,7 +42,7 @@ "max_tokens": { "title": "Max Tokens", "description": "The maximum number of tokens to generate.", - "default": 600, + "default": 1023, "type": "integer" } } @@ -141,7 +141,8 @@ "zephyr", "phind", "anthropic", - "chatml" + "chatml", + "deepseek" ], "type": "string" }, @@ -155,7 +156,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "allOf": [ { diff --git a/schema/json/ModelName.json b/schema/json/ModelName.json index 22065396d..5dbf93280 100644 --- a/schema/json/ModelName.json +++ b/schema/json/ModelName.json @@ -19,6 +19,9 @@ "wizardcoder-34b", "zephyr-7b", "codeup-13b", + "deepseek-1b", + "deepseek-7b", + "deepseek-33b", "claude-2", "chat-bison-001" ], diff --git a/schema/json/Models.json b/schema/json/Models.json index 0485bdefc..3a2687e38 100644 --- a/schema/json/Models.json +++ b/schema/json/Models.json @@ -42,7 +42,7 @@ "max_tokens": { "title": "Max Tokens", "description": "The maximum number of tokens to generate.", - "default": 600, + "default": 1023, "type": "integer" } } @@ -122,7 +122,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "allOf": [ { diff --git a/schema/json/SerializedContinueConfig.json b/schema/json/SerializedContinueConfig.json index d401a9c07..d016de052 100644 --- a/schema/json/SerializedContinueConfig.json +++ b/schema/json/SerializedContinueConfig.json @@ -42,7 +42,7 @@ "max_tokens": { "title": "Max Tokens", "description": "The maximum number of tokens to generate.", - "default": 600, + "default": 1023, "type": "integer" } } @@ -141,7 +141,8 @@ "zephyr", "phind", "anthropic", - "chatml" + "chatml", + "deepseek" ], "type": "string" }, @@ -155,7 +156,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "allOf": [ { @@ -248,6 +249,9 @@ "OpenConfigStep" ], "type": "string" + }, + { + "type": "string" } ] }, @@ -404,7 +408,27 @@ "title": "GPT-4 (trial)", "provider": "openai-free-trial", "model": "gpt-4", - "api_key": "" + "api_key": "", + "api_base": null, + "context_length": 2048, + "template": null, + "completion_options": { + "temperature": null, + "top_p": null, + "top_k": null, + "presence_penalty": null, + "frequency_penalty": null, + "stop": null, + "max_tokens": 1023 + }, + "system_message": null, + "request_options": { + "timeout": 300, + "verify_ssl": null, + "ca_bundle_path": null, + "proxy": null, + "headers": null + } } ], "type": "array", @@ -442,7 +466,7 @@ "presence_penalty": null, "frequency_penalty": null, "stop": null, - "max_tokens": 600 + "max_tokens": 1023 }, "allOf": [ { diff --git a/server/continuedev/core/autopilot.py b/server/continuedev/core/autopilot.py index 0242e7532..1acaea62d 100644 --- a/server/continuedev/core/autopilot.py +++ b/server/continuedev/core/autopilot.py @@ -329,9 +329,7 @@ class Autopilot: if self.sdk.config.disable_summaries: return "New Session" else: - chat_history = list( - map(lambda x: x.dict(), await self.sdk.get_chat_context()) - ) + chat_history = await self.sdk.get_chat_context() chat_history_str = template_alpaca_messages(chat_history) if self.sdk.models.summarize is None: return "New Session" diff --git a/server/continuedev/core/config_utils/shared.py b/server/continuedev/core/config_utils/shared.py index 8fa905808..f5931e4d6 100644 --- a/server/continuedev/core/config_utils/shared.py +++ b/server/continuedev/core/config_utils/shared.py @@ -3,6 +3,7 @@ from typing import Any, Dict, Literal, Optional from ...libs.llm.prompts.chat import ( anthropic_template_messages, chatml_template_messages, + deepseek_template_messages, llama2_template_messages, phind_template_messages, template_alpaca_messages, @@ -11,6 +12,7 @@ from ...libs.llm.prompts.chat import ( from ...libs.llm.prompts.edit import ( alpaca_edit_prompt, codellama_edit_prompt, + deepseek_edit_prompt, phind_edit_prompt, simplest_edit_prompt, zephyr_edit_prompt, @@ -28,7 +30,9 @@ StepName = Literal[ "GenerateShellCommandStep", ] -TemplateType = Literal["llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml"] +TemplateType = Literal[ + "llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml", "deepseek" +] def autodetect_template_type(model: str) -> Optional[TemplateType]: @@ -54,6 +58,9 @@ def autodetect_template_type(model: str) -> Optional[TemplateType]: if "mistral" in lower: return "llama2" + if "deepseek" in lower: + return "deepseek" + return "chatml" @@ -66,6 +73,7 @@ def autodetect_template_function(model: str): "zephyr": zephyr_template_messages, "anthropic": anthropic_template_messages, "chatml": chatml_template_messages, + "deepseek": deepseek_template_messages, } return mapping[template_type] return None @@ -85,6 +93,8 @@ def autodetect_prompt_templates(model: str): edit_template = codellama_edit_prompt elif template_type == "alpaca": edit_template = alpaca_edit_prompt + elif template_type == "deepseek": + edit_template = deepseek_edit_prompt elif template_type is not None: edit_template = simplest_edit_prompt @@ -162,6 +172,9 @@ MODELS = [ "wizardcoder-34b", "zephyr-7b", "codeup-13b", + "deepseek-1b", + "deepseek-7b", + "deepseek-33b", # Anthropic "claude-2", # Google PaLM @@ -189,6 +202,9 @@ ModelName = Literal[ "wizardcoder-34b", "zephyr-7b", "codeup-13b", + "deepseek-1b", + "deepseek-7b", + "deepseek-33b", # Anthropic "claude-2", # Google PaLM diff --git a/server/continuedev/libs/llm/prompts/edit.py b/server/continuedev/libs/llm/prompts/edit.py index 8198979c2..228684193 100644 --- a/server/continuedev/libs/llm/prompts/edit.py +++ b/server/continuedev/libs/llm/prompts/edit.py @@ -79,6 +79,23 @@ _phind_edit_prompt = dedent( """ ) +_deepseek_edit_prompt = dedent( + """\ + ### System Prompt + You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer. + ### Instruction: + Rewrite the code to satisfy this request: "{{{user_input}}}" + + ``` + {{{code_to_edit}}} + ```<|EOT|> + ### Response: + Sure! Here's the code you requested: + + ``` + """ +) + _zephyr_edit_prompt = dedent( """\ <|system|> @@ -103,3 +120,6 @@ codellama_edit_prompt = PromptTemplate( alpaca_edit_prompt = PromptTemplate(prompt=_alpaca_edit_prompt, raw=True, stop=["```"]) phind_edit_prompt = PromptTemplate(prompt=_phind_edit_prompt, raw=True, stop=["```"]) zephyr_edit_prompt = PromptTemplate(prompt=_zephyr_edit_prompt, raw=True, stop=["```"]) +deepseek_edit_prompt = PromptTemplate( + prompt=_deepseek_edit_prompt, raw=True, stop=["```"] +) diff --git a/server/continuedev/plugins/context_providers/url.py b/server/continuedev/plugins/context_providers/url.py index 3d419a2e8..ce6974e3a 100644 --- a/server/continuedev/plugins/context_providers/url.py +++ b/server/continuedev/plugins/context_providers/url.py @@ -60,6 +60,9 @@ class URLContextProvider(ContextProvider): ) def _get_url_text_contents_and_title(self, url: str) -> Tuple[str, str]: + if not url.startswith("http"): + url = "https://" + url + response = requests.get(url) soup = BeautifulSoup(response.text, "html.parser") title = url.replace("https://", "").replace("http://", "").replace("www.", "")