feat(gui): Add Azure as a provider

This commit is contained in:
Patrick Erichsen 2024-06-19 22:20:20 -05:00
parent f1b97f1039
commit b7c0623ac6
20 changed files with 938 additions and 896 deletions

4
core/index.d.ts vendored
View file

@ -557,7 +557,9 @@ type ModelProvider =
| "fireworks"
| "custom"
| "cloudflare"
| "deepseek";
| "deepseek"
| "azure"
| "openai-aiohttp";
export type ModelName =
| "AUTODETECT"

View file

@ -0,0 +1,21 @@
# Azure OpenAI
If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant.
:::info[Getting access]
You need to apply for access to the Azure OpenAI service. Response times are typically within a few days.
**[Click here to apply for access to the Azure OpenAI service](https://azure.microsoft.com/en-us/products/ai-services/openai-service)**
:::
## Configuration
```json title="~/.continue/config.json"
"models": [{
"title": "Azure OpenAI",
"provider": "azure",
"model": "gpt-4",
"apiBase": "https://my-azure-openai-instance.openai.azure.com/",
"apiKey": "<MY_API_KEY>"
}]
```

View file

@ -2,26 +2,7 @@
The OpenAI class can be used to access OpenAI models like GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo.
### Azure OpenAI Service
If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant. After applying for access [here](https://azure.microsoft.com/en-us/products/ai-services/openai-service), you will typically hear back within only a few days. Once you have access, set up a model in `config.json` like so:
```json
"models": [{
"title": "Azure OpenAI",
"provider": "openai",
"model": "gpt-4",
"apiBase": "https://my-azure-openai-instance.openai.azure.com/",
"engine": "my-azure-openai-deployment",
"apiVersion": "2023-07-01-preview",
"apiType": "azure",
"apiKey": "<MY_API_KEY>"
}]
```
The easiest way to find this information is from the chat playground in the Azure OpenAI portal. Under the "Chat Session" section, click "View Code" to see each of these parameters.
### OpenAI compatible servers / APIs
## OpenAI compatible servers / APIs
OpenAI compatible servers

View file

@ -27,25 +27,6 @@ In `config.json`, you'll find the `models` property, a list of the models that y
Just by specifying the `model` and `provider` properties, we will automatically detect prompt templates and other important information, but if you're looking to do something beyond this basic setup, we'll explain a few other options below.
## Azure OpenAI Service
If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant. After applying for access [here](https://azure.microsoft.com/en-us/products/ai-services/openai-service), you will typically hear back within only a few days. Once you have access, set up a model in `config.json` like so:
```json
"models": [{
"title": "Azure OpenAI",
"provider": "openai",
"model": "gpt-4",
"apiBase": "https://my-azure-openai-instance.openai.azure.com/",
"engine": "my-azure-openai-deployment",
"apiVersion": "2023-07-01-preview",
"apiType": "azure",
"apiKey": "<MY_API_KEY>"
}]
```
The easiest way to find this information is from the chat playground in the Azure OpenAI portal. Under the "Chat Session" section, click "View Code" to see each of these parameters.
## Self-hosting an open-source model
For many cases, either Continue will have a built-in provider or the API you use will be OpenAI-compatible, in which case you can use the "openai" provider and change the "baseUrl" to point to the server.

View file

@ -160,7 +160,8 @@
"fireworks",
"continue-proxy",
"cloudflare",
"deepseek"
"deepseek",
"azure"
],
"markdownEnumDescriptions": [
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",

BIN
gui/public/logos/azure.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View file

@ -6,8 +6,7 @@ import ErrorPage from "./pages/error";
import { default as Help, default as HelpPage } from "./pages/help";
import History from "./pages/history";
import MigrationPage from "./pages/migration";
import ModelConfig from "./pages/modelConfig";
import Models from "./pages/models";
import { ConfigureProvider, AddNewModel } from "./pages/AddNewModel";
import MonacoPage from "./pages/monaco";
import SettingsPage from "./pages/settings";
import { SubmenuContextProvidersContext } from "./context/SubmenuContextProviders";
@ -53,17 +52,17 @@ const router = createMemoryRouter([
element: <SettingsPage />,
},
{
path: "/models",
element: <Models />,
path: "/addModel",
element: <AddNewModel />,
},
{
path: "/addModel/provider/:providerName",
element: <ConfigureProvider />,
},
{
path: "/help",
element: <HelpPage />,
},
{
path: "/modelconfig/:modelName",
element: <ModelConfig />,
},
{
path: "/monaco",
element: <MonacoPage />,

View file

@ -7,11 +7,11 @@ import {
lightGray,
vscFocusBorder,
} from "..";
import { PROVIDER_INFO } from "../../pages/modelConfig/modelProviders";
import HeaderButtonWithText from "../HeaderButtonWithText";
import InfoHover from "../InfoHover";
import { PackageDimension } from "../../pages/modelconfig/modelPackages";
import ModelProviderTag, { ModelProviderTagVals } from "./ModelProviderTag";
import { PackageDimension } from "../../pages/AddNewModel/configs/models";
import { providers } from "../../pages/AddNewModel/configs/providers";
interface ModelCardProps {
title: string;
@ -201,7 +201,7 @@ function ModelCard(props: ModelCardProps) {
</div>
<div className="flex items-center flex-wrap justify-end rtl">
{props.providerOptions?.map((option, i) => {
const info = PROVIDER_INFO[option];
const info = providers[option];
if (!info) {
return null;
}

View file

@ -294,7 +294,7 @@ function ModelSelect(props: {}) {
width="1.3em"
height="1.3em"
onClick={() => {
navigate("/models");
navigate("/addModel");
}}
/>
</GridDiv>

View file

@ -6,7 +6,7 @@ import { Button, Input, SecondaryButton } from "../..";
import { IdeMessengerContext } from "../../../context/IdeMessenger";
import { setDefaultModel } from "../../../redux/slices/stateSlice";
import { getLocalStorage } from "../../../util/localStorage";
import { PROVIDER_INFO } from "../../../pages/modelConfig/modelProviders";
import { providers } from "../../../pages/AddNewModel/configs/providers";
import { ftl } from "../../dialogs/FTCDialog";
import QuickSetupListBox from "./QuickSetupListBox";
@ -16,9 +16,7 @@ interface QuickModelSetupProps {
}
function QuickModelSetup(props: QuickModelSetupProps) {
const [selectedProvider, setSelectedProvider] = useState(
PROVIDER_INFO["openai"],
);
const [selectedProvider, setSelectedProvider] = useState(providers["openai"]);
const [selectedModel, setSelectedModel] = useState(
selectedProvider.packages[0],
);
@ -67,7 +65,7 @@ function QuickModelSetup(props: QuickModelSetupProps) {
<QuickSetupListBox
selectedProvider={selectedProvider}
setSelectedProvider={setSelectedProvider}
options={Object.entries(PROVIDER_INFO)
options={Object.entries(providers)
.filter(([key]) => !["freetrial", "openai-aiohttp"].includes(key))
.map(([, provider]) => provider)}
></QuickSetupListBox>
@ -77,7 +75,7 @@ function QuickModelSetup(props: QuickModelSetupProps) {
selectedProvider={selectedModel}
setSelectedProvider={setSelectedModel}
options={
Object.entries(PROVIDER_INFO).find(
Object.entries(providers).find(
([, provider]) => provider.title === selectedProvider.title,
)?.[1].packages
}

View file

@ -1,7 +1,7 @@
import { Transition } from "@headlessui/react";
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline";
import { Dispatch, Fragment, SetStateAction } from "react";
import { DisplayInfo } from "../../../pages/modelConfig/modelProviders";
import { DisplayInfo } from "../../../pages/ConfigureNewModel/modelProviders";
import {
StyledListbox,
StyledListboxButton,

View file

@ -0,0 +1,202 @@
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import _ from "lodash";
import React, { useContext } from "react";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import {
defaultBorderRadius,
lightGray,
vscBackground,
} from "../../components";
import ModelCard from "../../components/modelSelection/ModelCard";
import Toggle from "../../components/modelSelection/Toggle";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useNavigationListener } from "../../hooks/useNavigationListener";
import { setDefaultModel } from "../../redux/slices/stateSlice";
import { providers } from "./configs/providers";
import { CustomModelButton } from "./ConfigureProvider";
import { ModelPackage, models } from "./configs/models";
const IntroDiv = styled.div`
padding: 8px 12px;
border-radius: ${defaultBorderRadius};
border: 1px solid ${lightGray};
margin: 1rem;
`;
const GridDiv = styled.div`
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
grid-gap: 2rem;
padding: 1rem;
justify-items: center;
align-items: center;
`;
/**
* Used to display groupings in the Models tab
*/
const modelsByProvider: Record<string, ModelPackage[]> = {
"Open AI": [models.gpt4turbo, models.gpt4o, models.gpt35turbo],
Anthropic: [models.claude3Opus, models.claude3Sonnet, models.claude3Haiku],
Mistral: [
models.codestral,
models.mistral7b,
models.mistral8x7b,
models.mistral8x22b,
models.mistralSmall,
models.mistralLarge,
],
Cohere: [models.commandR, models.commandRPlus],
Gemini: [models.geminiPro, models.gemini15Pro, models.gemini15Flash],
"Open Source": [models.llama3Chat, models.mistralOs, models.deepseek],
};
function AddNewModel() {
const navigate = useNavigate();
const dispatch = useDispatch();
useNavigationListener();
const ideMessenger = useContext(IdeMessengerContext);
const [providersSelected, setProvidersSelected] = React.useState(true);
return (
<div className="overflow-y-scroll">
<div
className="items-center flex m-0 p-0 sticky top-0"
style={{
borderBottom: `0.5px solid ${lightGray}`,
backgroundColor: vscBackground,
zIndex: 2,
}}
>
<ArrowLeftIcon
width="1.2em"
height="1.2em"
onClick={() => navigate("/")}
className="inline-block ml-4 cursor-pointer"
/>
<h3 className="text-lg font-bold m-2 inline-block">Add a new model</h3>
</div>
<br />
<Toggle
selected={providersSelected}
optionOne={"Start with a provider"}
optionTwo={"Select a specific model"}
onClick={() => {
setProvidersSelected((prev) => !prev);
}}
></Toggle>
<IntroDiv>
To add a new model you can either:
<ul>
<li>
Start by selecting and configuring a provider, then choosing your
model
</li>
<li>Select a specific model directly</li>
</ul>
<a href="https://docs.continue.dev/model-setup/overview">
Visit our setup overview docs
</a>{" "}
to learn more.
</IntroDiv>
{providersSelected ? (
<GridDiv>
<h2>Providers</h2>
{Object.entries(providers).map(([providerName, modelInfo]) => (
<ModelCard
title={modelInfo.title}
description={modelInfo.description}
tags={modelInfo.tags}
icon={modelInfo.icon}
refUrl={`https://docs.continue.dev/reference/Model%20Providers/${
modelInfo.refPage || modelInfo.provider.toLowerCase()
}`}
onClick={(e) => {
console.log(`/addModel/provider/${providerName}`);
navigate(`/addModel/provider/${providerName}`);
}}
/>
))}
</GridDiv>
) : (
<GridDiv>
<h2>Models</h2>
{Object.entries(modelsByProvider).map(
([providerTitle, modelConfigsByProviderTitle]) => (
<div>
<div className="-my-8 grid grid-cols-[auto_1fr] w-full items-center mb-2">
<h3 className="">{providerTitle}</h3>
<hr
className="ml-2"
style={{
height: "0px",
width: "calc(100% - 16px)",
color: lightGray,
border: `1px solid ${lightGray}`,
borderRadius: "2px",
}}
></hr>
</div>
{modelConfigsByProviderTitle.map((config) => (
<div className="mb-8">
<ModelCard
title={config.title}
description={config.description}
tags={config.tags}
icon={config.icon}
dimensions={config.dimensions}
providerOptions={config.providerOptions}
onClick={(e, dimensionChoices, selectedProvider) => {
const model = {
...config.params,
..._.merge(
{},
...(config.dimensions?.map((dimension, i) => {
if (!dimensionChoices?.[i]) return {};
return {
...dimension.options[dimensionChoices[i]],
};
}) || []),
),
provider: providers[selectedProvider].provider,
};
ideMessenger.post("config/addModel", { model });
dispatch(
setDefaultModel({ title: model.title, force: true }),
);
navigate("/");
}}
/>
</div>
))}
</div>
),
)}
</GridDiv>
)}
<div style={{ padding: "8px" }}>
<hr style={{ color: lightGray, border: `1px solid ${lightGray}` }} />
<p style={{ color: lightGray }}>
OR choose from other providers / models by editing config.json.
</p>
<CustomModelButton
disabled={false}
onClick={(e) => {
ideMessenger.post("openConfigJson", undefined);
}}
>
<h3 className="text-center my-2">Open config.json</h3>
</CustomModelButton>
</div>
</div>
);
}
export default AddNewModel;

View file

@ -18,7 +18,8 @@ import { useNavigationListener } from "../../hooks/useNavigationListener";
import { setDefaultModel } from "../../redux/slices/stateSlice";
import { updatedObj } from "../../util";
import ModelProviderTag from "../../components/modelSelection/ModelProviderTag";
import { ModelInfo, PROVIDER_INFO } from "./modelProviders";
import { providers } from "./configs/providers";
import type { ProviderInfo } from "./configs/providers";
const GridDiv = styled.div`
display: grid;
@ -52,20 +53,22 @@ export const CustomModelButton = styled.div<{ disabled: boolean }>`
`}
`;
function ModelConfig() {
function ConfigureProvider() {
useNavigationListener();
const formMethods = useForm();
const { modelName } = useParams();
const { providerName } = useParams();
const ideMessenger = useContext(IdeMessengerContext);
const dispatch = useDispatch();
const navigate = useNavigate();
const [modelInfo, setModelInfo] = useState<ModelInfo | undefined>(undefined);
const [modelInfo, setModelInfo] = useState<ProviderInfo | undefined>(
undefined,
);
useEffect(() => {
if (modelName) {
setModelInfo(PROVIDER_INFO[modelName]);
if (providerName) {
setModelInfo(providers[providerName]);
}
}, [modelName]);
}, [providerName]);
const disableModelCards = useCallback(() => {
return (
@ -93,11 +96,11 @@ function ModelConfig() {
<ArrowLeftIcon
width="1.2em"
height="1.2em"
onClick={() => navigate("/models")}
onClick={() => navigate("/addModel")}
className="inline-block ml-4 cursor-pointer"
/>
<h3 className="text-lg font-bold m-2 inline-block">
Configure Model
Configure provider
</h3>
</div>
@ -130,26 +133,24 @@ function ModelConfig() {
{modelInfo?.collectInputFor
?.filter((d) => d.required)
.map((d, idx) => {
return (
<div key={idx}>
<label htmlFor={d.key}>{d.label}</label>
<Input
type={d.inputType}
id={d.key}
className="border-2 border-gray-200 rounded-md p-2 m-2"
placeholder={d.label}
defaultValue={d.defaultValue}
min={d.min}
max={d.max}
step={d.step}
{...formMethods.register(d.key, {
required: true,
})}
/>
</div>
);
})}
.map((d, idx) => (
<div key={idx} className="mb-2">
<label htmlFor={d.key}>{d.label}</label>
<Input
type={d.inputType}
id={d.key}
className="border-2 border-gray-200 rounded-md p-2 m-2"
placeholder={d.label}
defaultValue={d.defaultValue}
min={d.min}
max={d.max}
step={d.step}
{...formMethods.register(d.key, {
required: true,
})}
/>
</div>
))}
</>
)}
@ -261,4 +262,4 @@ function ModelConfig() {
);
}
export default ModelConfig;
export default ConfigureProvider;

View file

@ -1,4 +1,4 @@
import { InputDescriptor } from "./modelPackages";
import { InputDescriptor } from "./providers";
export const contextLength: InputDescriptor = {
inputType: "number",

View file

@ -0,0 +1,540 @@
import { ILLM, ModelName, ModelProvider } from "core";
import { ModelProviderTagVals } from "../../../components/modelSelection/ModelProviderTag";
import { InputDescriptor } from "./providers";
// A dimension is like parameter count - 7b, 13b, 34b, etc.
// You would set options to the field that should be changed for that option in the params field of ModelPackage
export interface PackageDimension {
name: string;
description: string;
options: { [key: string]: { [key: string]: any } };
}
export interface ModelPackage {
title: string;
icon?: string;
collectInputFor?: InputDescriptor[];
description: string;
refUrl?: string;
tags?: ModelProviderTagVals[];
params: {
model: ILLM["model"];
templateMessages?: ILLM["templateMessages"];
contextLength: ILLM["contextLength"];
stopTokens?: string[];
promptTemplates?: ILLM["promptTemplates"];
replace?: [string, string][];
[key: string]: any;
};
dimensions?: PackageDimension[];
providerOptions?: ModelProvider[];
isOpenSource: boolean;
}
export const models: { [key: string]: ModelPackage } = {
codeLlamaInstruct: {
title: "CodeLlama Instruct",
description:
"A model from Meta, fine-tuned for code generation and conversation",
refUrl: "",
params: {
title: "CodeLlama-7b",
model: "codellama-7b",
contextLength: 4096,
},
icon: "meta.png",
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"7b": {
model: "codellama-7b",
title: "CodeLlama-7b",
},
"13b": {
model: "codellama-13b",
title: "CodeLlama-13b",
},
"34b": {
model: "codellama-34b",
title: "CodeLlama-34b",
},
"70b": {
model: "codellama-70b",
title: "Codellama-70b",
},
},
},
],
providerOptions: [
"ollama",
"lmstudio",
"together",
"llama.cpp",
"replicate",
],
isOpenSource: true,
},
codellama70bTrial: {
title: "Codellama 70b (Free Trial)",
description:
"The best code model from Meta, fine-tuned for code generation and conversation",
refUrl: "",
params: {
title: "CodeLlama-70b",
model: "codellama-70b",
contextLength: 4096,
},
icon: "meta.png",
providerOptions: ["free-trial"],
isOpenSource: false,
},
mixtralTrial: {
title: "Mixtral (Free Trial)",
description:
"Mixtral 8x7b is a mixture of experts model created by Mistral AI",
refUrl: "",
params: {
title: "Mixtral",
model: "mistral-8x7b",
contextLength: 4096,
},
icon: "mistral.png",
providerOptions: ["free-trial", "groq"],
isOpenSource: false,
},
llama38bChat: {
title: "Llama3 8b",
description: "The latest Llama model from Meta, fine-tuned for chat",
refUrl: "",
params: {
title: "Llama3-8b",
model: "llama3-8b",
contextLength: 8192,
},
icon: "meta.png",
providerOptions: ["groq"],
isOpenSource: false,
},
llama370bChat: {
title: "Llama3 70b Chat",
description: "The latest Llama model from Meta, fine-tuned for chat",
refUrl: "",
params: {
title: "Llama3-70b",
model: "llama3-70b",
contextLength: 8192,
},
icon: "meta.png",
providerOptions: ["groq"],
isOpenSource: false,
},
llama270bChat: {
title: "Llama2 70b Chat",
description: "The latest Llama model from Meta, fine-tuned for chat",
refUrl: "",
params: {
title: "Llama2-70b",
model: "llama2-70b",
contextLength: 4096,
},
icon: "meta.png",
providerOptions: ["groq"],
isOpenSource: false,
},
llama3Chat: {
title: "Llama3 Chat",
description: "The latest model from Meta, fine-tuned for chat",
refUrl: "",
params: {
title: "Llama3-8b",
model: "llama3-8b",
contextLength: 8192,
},
icon: "meta.png",
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"8b": {
model: "llama3-8b",
title: "Llama3-8b",
},
"70b": {
model: "llama3-70b",
title: "Llama3-70b",
},
},
},
],
providerOptions: [
"ollama",
"lmstudio",
"together",
"llama.cpp",
"replicate",
],
isOpenSource: true,
},
wizardCoder: {
title: "WizardCoder",
description:
"A CodeLlama-based code generation model from WizardLM, focused on Python",
refUrl: "",
params: {
title: "WizardCoder-7b",
model: "wizardcoder-7b",
contextLength: 4096,
},
icon: "wizardlm.png",
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"7b": {
model: "wizardcoder-7b",
title: "WizardCoder-7b",
},
"13b": {
model: "wizardcoder-13b",
title: "WizardCoder-13b",
},
"34b": {
model: "wizardcoder-34b",
title: "WizardCoder-34b",
},
},
},
],
providerOptions: ["ollama", "lmstudio", "llama.cpp", "replicate"],
isOpenSource: true,
},
phindCodeLlama: {
title: "Phind CodeLlama (34b)",
description: "A finetune of CodeLlama by Phind",
icon: "meta.png",
params: {
title: "Phind CodeLlama",
model: "phind-codellama-34b",
contextLength: 4096,
},
providerOptions: [
"ollama",
"lmstudio",
"llama.cpp",
"replicate",
"free-trial",
],
isOpenSource: true,
},
mistralOs: {
title: "Mistral",
description:
"A series of open-weight models created by Mistral AI, highly competent for code generation and other tasks",
params: {
title: "Mistral",
model: "mistral-7b",
contextLength: 4096,
},
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"7b": {
model: "mistral-7b",
title: "Mistral-7b",
},
"8x7b (MoE)": {
model: "mistral-8x7b",
title: "Mixtral",
},
},
},
],
icon: "mistral.png",
providerOptions: [
"ollama",
"lmstudio",
"together",
"llama.cpp",
"replicate",
],
isOpenSource: true,
},
codestral: {
title: "Codestral",
description:
"Codestral is an advanced generative model created by Mistral AI, tailored for coding tasks like fill-in-the-middle and code completion. Trained on more than 80 programming languages, Codestral demonstrates proficiency in both widely-used and less-common languages.",
params: {
title: "Codestral",
model: "codestral-latest",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
},
mistral7b: {
title: "Mistral 7B",
description:
"The first dense model released by Mistral AI, perfect for experimentation, customization, and quick iteration. At the time of the release, it matched the capabilities of models up to 30B parameters.",
params: {
title: "Mistral 7B",
model: "open-mistral-7b",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
},
mistral8x7b: {
title: "Mixtral 8x7B",
description:
"A sparse mixture of experts model. As such, it leverages up to 45B parameters but only uses about 12B during inference, leading to better inference throughput at the cost of more vRAM.",
params: {
title: "Mixtral 8x7B",
model: "open-mixtral-8x7b",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
},
mistral8x22b: {
title: "Mistral 8x22B",
description:
"A bigger sparse mixture of experts model. As such, it leverages up to 141B parameters but only uses about 39B during inference, leading to better inference throughput at the cost of more vRAM.",
params: {
title: "Mistral 8x22B",
model: "open-mixtral-8x22b",
contextLength: 64000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
},
mistralSmall: {
title: "Mistral Small",
description:
"Suitable for simple tasks that one can do in bulk (Classification, Customer Support, or Text Generation)",
params: {
title: "Mistral Small",
model: "mistral-small-latest",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
},
mistralLarge: {
title: "Mistral Large",
description:
"Mistral's flagship model that's ideal for complex tasks that require large reasoning capabilities or are highly specialized (Synthetic Text Generation, Code Generation, RAG, or Agents).",
params: {
title: "Mistral Large",
model: "mistral-large-latest",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
},
geminiPro: {
title: "Gemini Pro",
description: "A highly capable model created by Google DeepMind",
params: {
title: "Gemini Pro",
model: "gemini-pro",
contextLength: 32_000,
apiKey: "<API_KEY>",
},
icon: "gemini.png",
providerOptions: ["gemini"],
isOpenSource: false,
},
gemini15Pro: {
title: "Gemini 1.5 Pro",
description: "A newer Gemini model with 1M token context length",
params: {
title: "Gemini 1.5 Pro",
model: "gemini-1.5-pro-latest",
contextLength: 1_000_000,
apiKey: "<API_KEY>",
},
icon: "gemini.png",
providerOptions: ["gemini", "free-trial"],
isOpenSource: false,
},
gemini15Flash: {
title: "Gemini 1.5 Flash",
description:
"Fast and versatile multimodal model for scaling across diverse tasks",
params: {
title: "Gemini 1.5 Flash",
model: "gemini-1.5-flash-latest",
contextLength: 1_000_000,
apiKey: "<API_KEY>",
},
icon: "gemini.png",
providerOptions: ["gemini"],
isOpenSource: false,
},
deepseek: {
title: "DeepSeek-Coder",
description:
"A model pre-trained on 2 trillion tokens including 80+ programming languages and a repo-level corpus.",
params: {
title: "DeepSeek-7b",
model: "deepseek-7b",
contextLength: 4096,
},
icon: "deepseek.png",
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"1b": {
model: "deepseek-1b",
title: "DeepSeek-1b",
},
"7b": {
model: "deepseek-7b",
title: "DeepSeek-7b",
},
"33b": {
model: "deepseek-33b",
title: "DeepSeek-33b",
},
},
},
],
providerOptions: ["ollama", "lmstudio", "llama.cpp"],
isOpenSource: true,
},
commandR: {
title: "Command R",
description:
"Command R is a scalable generative model targeting RAG and Tool Use to enable production-scale AI for enterprise.",
params: {
model: "command-r",
contextLength: 128_000,
title: "Command R",
apiKey: "",
},
providerOptions: ["cohere"],
icon: "cohere.png",
isOpenSource: false,
},
commandRPlus: {
title: "Command R+",
description:
"Command R+ is a state-of-the-art RAG-optimized model designed to tackle enterprise-grade workloads",
params: {
model: "command-r-plus",
contextLength: 128_000,
title: "Command R+",
apiKey: "",
},
providerOptions: ["cohere"],
icon: "cohere.png",
isOpenSource: false,
},
gpt4turbo: {
title: "GPT-4 Turbo",
description:
"A faster and more capable version of GPT-4 with longer context length and image support",
params: {
model: "gpt-4-turbo",
contextLength: 128_000,
title: "GPT-4 Turbo",
},
providerOptions: ["openai"],
icon: "openai.png",
isOpenSource: false,
},
gpt4o: {
title: "GPT-4o",
description:
"An even faster version of GPT-4 with stronger multi-modal capabilities.",
params: {
model: "gpt-4o",
contextLength: 128_000,
title: "GPT-4o",
systemMessage:
"You are an expert software developer. You give helpful and concise responses.",
},
providerOptions: ["openai", "free-trial"],
icon: "openai.png",
isOpenSource: false,
},
gpt35turbo: {
title: "GPT-3.5-Turbo",
description:
"A faster, cheaper OpenAI model with slightly lower capabilities",
params: {
model: "gpt-3.5-turbo",
contextLength: 8096,
title: "GPT-3.5-Turbo",
},
providerOptions: ["openai", "free-trial"],
icon: "openai.png",
isOpenSource: false,
},
claude3Opus: {
title: "Claude 3 Opus",
description:
"Anthropic's most capable model, beating GPT-4 on many benchmarks",
params: {
model: "claude-3-opus-20240229",
contextLength: 200_000,
title: "Claude 3 Opus",
apiKey: "",
},
providerOptions: ["anthropic"],
icon: "anthropic.png",
isOpenSource: false,
},
claude3Sonnet: {
title: "Claude 3 Sonnet",
description:
"The second most capable model in the Claude 3 series: ideal balance of intelligence and speed",
params: {
model: "claude-3-sonnet-20240229",
contextLength: 200_000,
title: "Claude 3 Sonnet",
apiKey: "",
},
providerOptions: ["anthropic", "free-trial"],
icon: "anthropic.png",
isOpenSource: false,
},
claude3Haiku: {
title: "Claude 3 Haiku",
description:
"The third most capable model in the Claude 3 series: fastest and most compact model for near-instant responsiveness",
params: {
model: "claude-3-haiku-20240307",
contextLength: 200_000,
title: "Claude 3 Haiku",
apiKey: "",
},
providerOptions: ["anthropic", "free-trial"],
icon: "anthropic.png",
isOpenSource: false,
},
AUTODETECT: {
title: "Autodetect",
description:
"Automatically populate the model list by calling the /models endpoint of the server",
params: {
model: "AUTODETECT",
} as any,
providerOptions: [],
isOpenSource: false,
},
};

View file

@ -1,11 +1,27 @@
import { ModelProvider } from "core";
import { ftl } from "../../components/dialogs/FTCDialog";
import type { ModelPackage, InputDescriptor } from "./modelPackages";
import { ModelProviderTagVals } from "../../components/modelSelection/ModelProviderTag";
import * as modelPackagesObj from "./modelPackages";
import { ftl } from "../../../components/dialogs/FTCDialog";
import type { ModelPackage } from "./models";
import { HTMLInputTypeAttribute } from "react";
import { ModelProviderTagVals } from "../../../components/modelSelection/ModelProviderTag";
import { models } from "./models";
import * as completionParamsInputsObj from "./completionParamsInputs";
export interface ModelInfo {
export interface InputDescriptor {
inputType: HTMLInputTypeAttribute;
key: string;
label: string;
placeholder?: string;
defaultValue?: string | number;
min?: number;
max?: number;
step?: number;
options?: string[];
required?: boolean;
description?: string;
[key: string]: any;
}
export interface ProviderInfo {
title: string;
icon?: string;
provider: ModelProvider;
@ -21,13 +37,12 @@ export interface ModelInfo {
}
const completionParamsInputs = Object.values(completionParamsInputsObj);
const modelPackages = Object.values(modelPackagesObj);
const openSourcePackages = modelPackages.filter(
const openSourceModels = Object.values(models).filter(
({ isOpenSource }) => isOpenSource,
);
const apiBaseInput: InputDescriptor = {
export const apiBaseInput: InputDescriptor = {
inputType: "text",
key: "apiBase",
label: "API Base",
@ -35,17 +50,7 @@ const apiBaseInput: InputDescriptor = {
required: false,
};
export const MODEL_INFO: Array<ModelPackage | string> = [
"OpenAI",
"Anthropic",
"Mistral",
"Cohere",
"Gemini",
"Open Source",
...modelPackages,
];
export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
export const providers: Partial<Record<ModelProvider, ProviderInfo>> = {
openai: {
title: "OpenAI",
provider: "openai",
@ -55,13 +60,13 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
icon: "openai.png",
tags: [ModelProviderTagVals.RequiresApiKey],
packages: [
modelPackagesObj.gpt4o,
modelPackagesObj.gpt4turbo,
modelPackagesObj.gpt35turbo,
models.gpt4o,
models.gpt4turbo,
models.gpt35turbo,
{
...modelPackagesObj.AUTODETECT,
...models.AUTODETECT,
params: {
...modelPackagesObj.AUTODETECT.params,
...models.AUTODETECT.params,
title: "OpenAI",
},
},
@ -99,16 +104,57 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
...completionParamsInputs,
{
...completionParamsInputsObj.contextLength,
defaultValue: 100_000,
defaultValue: 100000,
},
],
packages: [
modelPackagesObj.claude3Opus,
modelPackagesObj.claude3Sonnet,
modelPackagesObj.claude3Haiku,
],
packages: [models.claude3Opus, models.claude3Sonnet, models.claude3Haiku],
apiKeyUrl: "https://console.anthropic.com/account/keys",
},
azure: {
title: "Azure OpenAI",
provider: "azure",
description:
"Azure OpenAI Service offers industry-leading coding and language AI models that you can fine-tune to your specific needs for a variety of use cases.",
longDescription:
"[Visit our documentation](https://docs.continue.dev/reference/Model%20Providers/azure) for information on obtaining an API key.",
icon: "azure.png",
tags: [ModelProviderTagVals.RequiresApiKey],
refPage: "azure",
apiKeyUrl: "", // TODO: Find out from Nate
packages: [models.gpt4turbo, models.gpt4o, models.gpt35turbo],
params: {
apiKey: "",
engine: "",
apiBase: "",
apiVersion: "",
apiType: "azure",
},
collectInputFor: [
{
inputType: "text",
key: "apiKey",
label: "API Key",
placeholder: "Enter your Azure OpenAI API key",
required: true,
},
{
inputType: "text",
key: "engine",
label: "Engine",
placeholder: "Enter the engine name",
required: true,
},
{
inputType: "text",
key: "apiVersion",
label: "Api Version",
placeholder: "Enter the API version",
required: true,
},
{ ...apiBaseInput, required: true },
// ...completionParamsInputs, // TODO: Is this valid?
],
},
mistral: {
title: "Mistral API",
provider: "mistral",
@ -134,12 +180,12 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
...completionParamsInputs,
],
packages: [
modelPackagesObj.codestral,
modelPackagesObj.mistralLarge,
modelPackagesObj.mistralSmall,
modelPackagesObj.mistral8x22b,
modelPackagesObj.mistral8x7b,
modelPackagesObj.mistral7b,
models.codestral,
models.mistralLarge,
models.mistralSmall,
models.mistral8x22b,
models.mistral8x7b,
models.mistral7b,
],
apiKeyUrl: "https://console.mistral.ai/codestral",
},
@ -154,13 +200,13 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
tags: [ModelProviderTagVals.Local, ModelProviderTagVals.OpenSource],
packages: [
{
...modelPackagesObj.AUTODETECT,
...models.AUTODETECT,
params: {
...modelPackagesObj.AUTODETECT.params,
...models.AUTODETECT.params,
title: "Ollama",
},
},
...openSourcePackages,
...openSourceModels,
],
collectInputFor: [
...completionParamsInputs,
@ -188,7 +234,7 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
},
...completionParamsInputs,
],
packages: [modelPackagesObj.commandR, modelPackagesObj.commandRPlus],
packages: [models.commandR, models.commandRPlus],
},
groq: {
title: "Groq",
@ -212,14 +258,14 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
},
],
packages: [
modelPackagesObj.llama370bChat,
modelPackagesObj.llama38bChat,
{ ...modelPackagesObj.mixtralTrial, title: "Mixtral" },
modelPackagesObj.llama270bChat,
models.llama370bChat,
models.llama38bChat,
{ ...models.mixtralTrial, title: "Mixtral" },
models.llama270bChat,
{
...modelPackagesObj.AUTODETECT,
...models.AUTODETECT,
params: {
...modelPackagesObj.AUTODETECT.params,
...models.AUTODETECT.params,
title: "Groq",
},
},
@ -253,9 +299,9 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
...completionParamsInputs,
],
packages: [
modelPackagesObj.llama3Chat,
modelPackagesObj.codeLlamaInstruct,
modelPackagesObj.mistralOs,
models.llama3Chat,
models.codeLlamaInstruct,
models.mistralOs,
].map((p) => {
p.params.contextLength = 4096;
return p;
@ -279,11 +325,7 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
required: true,
},
],
packages: [
modelPackagesObj.gemini15Pro,
modelPackagesObj.geminiPro,
modelPackagesObj.gemini15Flash,
],
packages: [models.gemini15Pro, models.geminiPro, models.gemini15Flash],
apiKeyUrl: "https://aistudio.google.com/app/apikey",
},
lmstudio: {
@ -300,13 +342,13 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
},
packages: [
{
...modelPackagesObj.AUTODETECT,
...models.AUTODETECT,
params: {
...modelPackagesObj.AUTODETECT.params,
...models.AUTODETECT.params,
title: "LM Studio",
},
},
...openSourcePackages,
...openSourceModels,
],
collectInputFor: [...completionParamsInputs],
downloadUrl: "https://lmstudio.ai/",
@ -319,7 +361,7 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
"llamafiles are a self-contained binary to run an open-source LLM",
longDescription: `To get started with llamafiles, find and download a binary on their [GitHub repo](https://github.com/Mozilla-Ocho/llamafile?tab=readme-ov-file#quickstart). Then run it with the following command:\n\n\`\`\`shell\nchmod +x ./llamafile\n./llamafile\n\`\`\``,
tags: [ModelProviderTagVals.Local, ModelProviderTagVals.OpenSource],
packages: openSourcePackages,
packages: openSourceModels,
collectInputFor: [...completionParamsInputs],
downloadUrl:
"https://github.com/Mozilla-Ocho/llamafile?tab=readme-ov-file#quickstart",
@ -349,14 +391,14 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
ModelProviderTagVals.OpenSource,
],
packages: [
modelPackagesObj.llama3Chat,
modelPackagesObj.codeLlamaInstruct,
modelPackagesObj.wizardCoder,
modelPackagesObj.mistralOs,
models.llama3Chat,
models.codeLlamaInstruct,
models.wizardCoder,
models.mistralOs,
],
apiKeyUrl: "https://replicate.com/account/api-tokens",
},
llamacpp: {
"llama.cpp": {
title: "llama.cpp",
provider: "llama.cpp",
refPage: "llamacpp",
@ -376,7 +418,7 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
After it's up and running, you can start using Continue.`,
icon: "llamacpp.png",
tags: [ModelProviderTagVals.Local, ModelProviderTagVals.OpenSource],
packages: openSourcePackages,
packages: openSourceModels,
collectInputFor: [...completionParamsInputs],
downloadUrl: "https://github.com/ggerganov/llama.cpp",
},
@ -405,16 +447,16 @@ After it's up and running, you can start using Continue.`,
tags: [ModelProviderTagVals.Local, ModelProviderTagVals.OpenSource],
packages: [
{
...modelPackagesObj.AUTODETECT,
...models.AUTODETECT,
params: {
...modelPackagesObj.AUTODETECT.params,
...models.AUTODETECT.params,
title: "OpenAI",
},
},
...openSourcePackages,
...openSourceModels,
],
},
freetrial: {
"free-trial": {
title: "Continue limited free trial",
provider: "free-trial",
refPage: "freetrial",
@ -424,17 +466,17 @@ After it's up and running, you can start using Continue.`,
icon: "openai.png",
tags: [ModelProviderTagVals.Free],
packages: [
modelPackagesObj.codellama70bTrial,
{ ...modelPackagesObj.gpt4o, title: "GPT-4o (trial)" },
{ ...modelPackagesObj.gpt35turbo, title: "GPT-3.5-Turbo (trial)" },
{ ...modelPackagesObj.claude3Sonnet, title: "Claude 3 Sonnet (trial)" },
{ ...modelPackagesObj.claude3Haiku, title: "Claude 3 Haiku (trial)" },
modelPackagesObj.mixtralTrial,
{ ...modelPackagesObj.gemini15Pro, title: "Gemini 1.5 Pro (trial)" },
models.codellama70bTrial,
{ ...models.gpt4o, title: "GPT-4o (trial)" },
{ ...models.gpt35turbo, title: "GPT-3.5-Turbo (trial)" },
{ ...models.claude3Sonnet, title: "Claude 3 Sonnet (trial)" },
{ ...models.claude3Haiku, title: "Claude 3 Haiku (trial)" },
models.mixtralTrial,
{ ...models.gemini15Pro, title: "Gemini 1.5 Pro (trial)" },
{
...modelPackagesObj.AUTODETECT,
...models.AUTODETECT,
params: {
...modelPackagesObj.AUTODETECT.params,
...models.AUTODETECT.params,
title: "Free Trial",
},
},

View file

@ -0,0 +1,2 @@
export { default as AddNewModel } from "./AddNewModel";
export { default as ConfigureProvider } from "./ConfigureProvider";

View file

@ -1 +0,0 @@
export { default } from "./ModelConfig";

View file

@ -1,557 +0,0 @@
import { ModelName } from "core";
import { ModelProviderTag } from "./modelProviders";
import { HTMLInputTypeAttribute } from "react";
export interface InputDescriptor {
inputType: HTMLInputTypeAttribute;
key: string;
label: string;
placeholder?: string;
defaultValue?: string | number;
min?: number;
max?: number;
step?: number;
options?: string[];
required?: boolean;
description?: string;
[key: string]: any;
}
// A dimension is like parameter count - 7b, 13b, 34b, etc.
// You would set options to the field that should be changed for that option in the params field of ModelPackage
export interface PackageDimension {
name: string;
description: string;
options: { [key: string]: { [key: string]: any } };
}
export interface ModelPackage {
title: string;
icon?: string;
collectInputFor?: InputDescriptor[];
description: string;
refUrl?: string;
tags?: ModelProviderTag[];
params: {
model: ModelName;
templateMessages?: string;
contextLength: number;
stopTokens?: string[];
promptTemplates?: any;
replace?: [string, string][];
[key: string]: any;
};
dimensions?: PackageDimension[];
providerOptions?: string[];
isOpenSource: boolean;
}
export const codeLlamaInstruct: ModelPackage = {
title: "CodeLlama Instruct",
description:
"A model from Meta, fine-tuned for code generation and conversation",
refUrl: "",
params: {
title: "CodeLlama-7b",
model: "codellama-7b",
contextLength: 4096,
},
icon: "meta.png",
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"7b": {
model: "codellama-7b",
title: "CodeLlama-7b",
},
"13b": {
model: "codellama-13b",
title: "CodeLlama-13b",
},
"34b": {
model: "codellama-34b",
title: "CodeLlama-34b",
},
"70b": {
model: "codellama-70b",
title: "Codellama-70b",
},
},
},
],
providerOptions: ["ollama", "lmstudio", "together", "llamacpp", "replicate"],
isOpenSource: true,
};
export const codellama70bTrial: ModelPackage = {
title: "Codellama 70b (Free Trial)",
description:
"The best code model from Meta, fine-tuned for code generation and conversation",
refUrl: "",
params: {
title: "CodeLlama-70b",
model: "codellama-70b",
contextLength: 4096,
},
icon: "meta.png",
providerOptions: ["freetrial"],
isOpenSource: false,
};
export const mixtralTrial: ModelPackage = {
title: "Mixtral (Free Trial)",
description:
"Mixtral 8x7b is a mixture of experts model created by Mistral AI",
refUrl: "",
params: {
title: "Mixtral",
model: "mistral-8x7b",
contextLength: 4096,
},
icon: "mistral.png",
providerOptions: ["freetrial", "groq"],
isOpenSource: false,
};
export const llama38bChat: ModelPackage = {
title: "Llama3 8b",
description: "The latest Llama model from Meta, fine-tuned for chat",
refUrl: "",
params: {
title: "Llama3-8b",
model: "llama3-8b",
contextLength: 8192,
},
icon: "meta.png",
providerOptions: ["groq"],
isOpenSource: false,
};
export const llama370bChat: ModelPackage = {
title: "Llama3 70b Chat",
description: "The latest Llama model from Meta, fine-tuned for chat",
refUrl: "",
params: {
title: "Llama3-70b",
model: "llama3-70b",
contextLength: 8192,
},
icon: "meta.png",
providerOptions: ["groq"],
isOpenSource: false,
};
export const llama270bChat: ModelPackage = {
title: "Llama2 70b Chat",
description: "The latest Llama model from Meta, fine-tuned for chat",
refUrl: "",
params: {
title: "Llama2-70b",
model: "llama2-70b",
contextLength: 4096,
},
icon: "meta.png",
providerOptions: ["groq"],
isOpenSource: false,
};
export const llama3Chat: ModelPackage = {
title: "Llama3 Chat",
description: "The latest model from Meta, fine-tuned for chat",
refUrl: "",
params: {
title: "Llama3-8b",
model: "llama3-8b",
contextLength: 8192,
},
icon: "meta.png",
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"8b": {
model: "llama3-8b",
title: "Llama3-8b",
},
"70b": {
model: "llama3-70b",
title: "Llama3-70b",
},
},
},
],
providerOptions: ["ollama", "lmstudio", "together", "llamacpp", "replicate"],
isOpenSource: true,
};
export const wizardCoder: ModelPackage = {
title: "WizardCoder",
description:
"A CodeLlama-based code generation model from WizardLM, focused on Python",
refUrl: "",
params: {
title: "WizardCoder-7b",
model: "wizardcoder-7b",
contextLength: 4096,
},
icon: "wizardlm.png",
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"7b": {
model: "wizardcoder-7b",
title: "WizardCoder-7b",
},
"13b": {
model: "wizardcoder-13b",
title: "WizardCoder-13b",
},
"34b": {
model: "wizardcoder-34b",
title: "WizardCoder-34b",
},
},
},
],
providerOptions: ["ollama", "lmstudio", "llamacpp", "replicate"],
isOpenSource: true,
};
export const phindCodeLlama: ModelPackage = {
title: "Phind CodeLlama (34b)",
description: "A finetune of CodeLlama by Phind",
icon: "meta.png",
params: {
title: "Phind CodeLlama",
model: "phind-codellama-34b",
contextLength: 4096,
},
providerOptions: ["ollama", "lmstudio", "llamacpp", "replicate", "freetrial"],
isOpenSource: true,
};
export const mistralOs: ModelPackage = {
title: "Mistral",
description:
"A series of open-weight models created by Mistral AI, highly competent for code generation and other tasks",
params: {
title: "Mistral",
model: "mistral-7b",
contextLength: 4096,
},
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"7b": {
model: "mistral-7b",
title: "Mistral-7b",
},
"8x7b (MoE)": {
model: "mistral-8x7b",
title: "Mixtral",
},
},
},
],
icon: "mistral.png",
providerOptions: ["ollama", "lmstudio", "together", "llamacpp", "replicate"],
isOpenSource: true,
};
export const codestral: ModelPackage = {
title: "Codestral",
description:
"Codestral is an advanced generative model created by Mistral AI, tailored for coding tasks like fill-in-the-middle and code completion. Trained on more than 80 programming languages, Codestral demonstrates proficiency in both widely-used and less-common languages.",
params: {
title: "Codestral",
model: "codestral-latest",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
};
export const mistral7b: ModelPackage = {
title: "Mistral 7B",
description:
"The first dense model released by Mistral AI, perfect for experimentation, customization, and quick iteration. At the time of the release, it matched the capabilities of models up to 30B parameters.",
params: {
title: "Mistral 7B",
model: "open-mistral-7b",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
};
export const mistral8x7b: ModelPackage = {
title: "Mixtral 8x7B",
description:
"A sparse mixture of experts model. As such, it leverages up to 45B parameters but only uses about 12B during inference, leading to better inference throughput at the cost of more vRAM.",
params: {
title: "Mixtral 8x7B",
model: "open-mixtral-8x7b",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
};
export const mistral8x22b: ModelPackage = {
title: "Mistral 8x22B",
description:
"A bigger sparse mixture of experts model. As such, it leverages up to 141B parameters but only uses about 39B during inference, leading to better inference throughput at the cost of more vRAM.",
params: {
title: "Mistral 8x22B",
model: "open-mixtral-8x22b",
contextLength: 64000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
};
export const mistralSmall: ModelPackage = {
title: "Mistral Small",
description:
"Suitable for simple tasks that one can do in bulk (Classification, Customer Support, or Text Generation)",
params: {
title: "Mistral Small",
model: "mistral-small-latest",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
};
export const mistralLarge: ModelPackage = {
title: "Mistral Large",
description:
"Mistral's flagship model that's ideal for complex tasks that require large reasoning capabilities or are highly specialized (Synthetic Text Generation, Code Generation, RAG, or Agents).",
params: {
title: "Mistral Large",
model: "mistral-large-latest",
contextLength: 32000,
},
icon: "mistral.png",
providerOptions: ["mistral"],
isOpenSource: false,
};
export const geminiPro: ModelPackage = {
title: "Gemini Pro",
description: "A highly capable model created by Google DeepMind",
params: {
title: "Gemini Pro",
model: "gemini-pro",
contextLength: 32_000,
apiKey: "<API_KEY>",
},
icon: "gemini.png",
providerOptions: ["gemini"],
isOpenSource: false,
};
export const gemini15Pro: ModelPackage = {
title: "Gemini 1.5 Pro",
description: "A newer Gemini model with 1M token context length",
params: {
title: "Gemini 1.5 Pro",
model: "gemini-1.5-pro-latest",
contextLength: 1_000_000,
apiKey: "<API_KEY>",
},
icon: "gemini.png",
providerOptions: ["gemini", "freetrial"],
isOpenSource: false,
};
export const gemini15Flash: ModelPackage = {
title: "Gemini 1.5 Flash",
description:
"Fast and versatile multimodal model for scaling across diverse tasks",
params: {
title: "Gemini 1.5 Flash",
model: "gemini-1.5-flash-latest",
contextLength: 1_000_000,
apiKey: "<API_KEY>",
},
icon: "gemini.png",
providerOptions: ["gemini"],
isOpenSource: false,
};
export 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-7b",
model: "deepseek-7b",
contextLength: 4096,
},
icon: "deepseek.png",
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"1b": {
model: "deepseek-1b",
title: "DeepSeek-1b",
},
"7b": {
model: "deepseek-7b",
title: "DeepSeek-7b",
},
"33b": {
model: "deepseek-33b",
title: "DeepSeek-33b",
},
},
},
],
providerOptions: ["ollama", "lmstudio", "llamacpp"],
isOpenSource: true,
};
export const commandR: ModelPackage = {
title: "Command R",
description:
"Command R is a scalable generative model targeting RAG and Tool Use to enable production-scale AI for enterprise.",
params: {
model: "command-r",
contextLength: 128_000,
title: "Command R",
apiKey: "",
},
providerOptions: ["cohere"],
icon: "cohere.png",
isOpenSource: false,
};
export const commandRPlus: ModelPackage = {
title: "Command R+",
description:
"Command R+ is a state-of-the-art RAG-optimized model designed to tackle enterprise-grade workloads",
params: {
model: "command-r-plus",
contextLength: 128_000,
title: "Command R+",
apiKey: "",
},
providerOptions: ["cohere"],
icon: "cohere.png",
isOpenSource: false,
};
export const gpt4turbo: ModelPackage = {
title: "GPT-4 Turbo",
description:
"A faster and more capable version of GPT-4 with longer context length and image support",
params: {
model: "gpt-4-turbo",
contextLength: 128_000,
title: "GPT-4 Turbo",
},
providerOptions: ["openai"],
icon: "openai.png",
isOpenSource: false,
};
export const gpt4o: ModelPackage = {
title: "GPT-4o",
description:
"An even faster version of GPT-4 with stronger multi-modal capabilities.",
params: {
model: "gpt-4o",
contextLength: 128_000,
title: "GPT-4o",
systemMessage:
"You are an expert software developer. You give helpful and concise responses.",
},
providerOptions: ["openai", "freetrial"],
icon: "openai.png",
isOpenSource: false,
};
export const gpt35turbo: ModelPackage = {
title: "GPT-3.5-Turbo",
description:
"A faster, cheaper OpenAI model with slightly lower capabilities",
params: {
model: "gpt-3.5-turbo",
contextLength: 8096,
title: "GPT-3.5-Turbo",
},
providerOptions: ["openai", "freetrial"],
icon: "openai.png",
isOpenSource: false,
};
export const claude3Opus: ModelPackage = {
title: "Claude 3 Opus",
description:
"Anthropic's most capable model, beating GPT-4 on many benchmarks",
params: {
model: "claude-3-opus-20240229",
contextLength: 200_000,
title: "Claude 3 Opus",
apiKey: "",
},
providerOptions: ["anthropic"],
icon: "anthropic.png",
isOpenSource: false,
};
export const claude3Sonnet: ModelPackage = {
title: "Claude 3 Sonnet",
description:
"The second most capable model in the Claude 3 series: ideal balance of intelligence and speed",
params: {
model: "claude-3-sonnet-20240229",
contextLength: 200_000,
title: "Claude 3 Sonnet",
apiKey: "",
},
providerOptions: ["anthropic", "freetrial"],
icon: "anthropic.png",
isOpenSource: false,
};
export const claude3Haiku: ModelPackage = {
title: "Claude 3 Haiku",
description:
"The third most capable model in the Claude 3 series: fastest and most compact model for near-instant responsiveness",
params: {
model: "claude-3-haiku-20240307",
contextLength: 200_000,
title: "Claude 3 Haiku",
apiKey: "",
},
providerOptions: ["anthropic", "freetrial"],
icon: "anthropic.png",
isOpenSource: false,
};
export const AUTODETECT: ModelPackage = {
title: "Autodetect",
description:
"Automatically populate the model list by calling the /models endpoint of the server",
params: {
model: "AUTODETECT",
} as any,
providerOptions: [],
isOpenSource: false,
};

View file

@ -1,170 +0,0 @@
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import _ from "lodash";
import React, { useContext } from "react";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import { defaultBorderRadius, lightGray, vscBackground } from "../components";
import ModelCard from "../components/modelSelection/ModelCard";
import Toggle from "../components/modelSelection/Toggle";
import { IdeMessengerContext } from "../context/IdeMessenger";
import { useNavigationListener } from "../hooks/useNavigationListener";
import { setDefaultModel } from "../redux/slices/stateSlice";
import { MODEL_INFO, PROVIDER_INFO } from "./modelConfig/modelProviders";
import { CustomModelButton } from "./modelConfig/ModelConfig";
const IntroDiv = styled.div`
padding: 8px 12px;
border-radius: ${defaultBorderRadius};
border: 1px solid ${lightGray};
margin: 1rem;
`;
const GridDiv = styled.div`
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
grid-gap: 2rem;
padding: 1rem;
justify-items: center;
align-items: center;
`;
function Models() {
const navigate = useNavigate();
const dispatch = useDispatch();
useNavigationListener();
const ideMessenger = useContext(IdeMessengerContext);
const [providersSelected, setProvidersSelected] = React.useState(true);
return (
<div className="overflow-y-scroll">
<div
className="items-center flex m-0 p-0 sticky top-0"
style={{
borderBottom: `0.5px solid ${lightGray}`,
backgroundColor: vscBackground,
zIndex: 2,
}}
>
<ArrowLeftIcon
width="1.2em"
height="1.2em"
onClick={() => navigate("/")}
className="inline-block ml-4 cursor-pointer"
/>
<h3 className="text-lg font-bold m-2 inline-block">Add new model</h3>
</div>
<br />
<Toggle
selected={providersSelected}
optionOne={"Providers"}
optionTwo={"Models"}
onClick={() => {
setProvidersSelected((prev) => !prev);
}}
></Toggle>
<IntroDiv>
To set up an LLM you will choose
<ul>
<li>
a provider (the service used to run the LLM, e.g. Ollama,
TogetherAI) and
</li>
<li>a model (the LLM being run, e.g. GPT-4, CodeLlama).</li>
</ul>
To read more about the options, check out our{" "}
<a href="https://docs.continue.dev/model-setup/overview">overview</a> in
the docs.
</IntroDiv>
{providersSelected ? (
<GridDiv>
{Object.entries(PROVIDER_INFO).map(([name, modelInfo]) => (
<ModelCard
title={modelInfo.title}
description={modelInfo.description}
tags={modelInfo.tags}
icon={modelInfo.icon}
refUrl={`https://docs.continue.dev/reference/Model%20Providers/${
modelInfo.refPage || modelInfo.provider.toLowerCase()
}`}
onClick={(e) => {
navigate(`/modelconfig/${name}`);
}}
/>
))}
</GridDiv>
) : (
<GridDiv>
{MODEL_INFO.map((pkg) => {
if (typeof pkg === "string") {
return (
<div className="-my-8 grid grid-cols-[auto_1fr] w-full items-center">
<h3 className="">{pkg}</h3>
<hr
className="ml-2"
style={{
height: "0px",
width: "calc(100% - 16px)",
color: lightGray,
border: `1px solid ${lightGray}`,
borderRadius: "2px",
}}
></hr>
</div>
);
} else {
return (
<ModelCard
title={pkg.title}
description={pkg.description}
tags={pkg.tags}
icon={pkg.icon}
dimensions={pkg.dimensions}
providerOptions={pkg.providerOptions}
onClick={(e, dimensionChoices, selectedProvider) => {
const model = {
...pkg.params,
..._.merge(
{},
...(pkg.dimensions?.map((dimension, i) => {
if (!dimensionChoices?.[i]) return {};
return {
...dimension.options[dimensionChoices[i]],
};
}) || []),
),
provider: PROVIDER_INFO[selectedProvider].provider,
};
ideMessenger.post("config/addModel", { model });
dispatch(
setDefaultModel({ title: model.title, force: true }),
);
navigate("/");
}}
/>
);
}
})}
</GridDiv>
)}
<div style={{ padding: "8px" }}>
<hr style={{ color: lightGray, border: `1px solid ${lightGray}` }} />
<p style={{ color: lightGray }}>
OR choose from other providers / models by editing config.json.
</p>
<CustomModelButton
disabled={false}
onClick={(e) => {
ideMessenger.post("openConfigJson", undefined);
}}
>
<h3 className="text-center my-2">Open config.json</h3>
</CustomModelButton>
</div>
</div>
);
}
export default Models;