Merge branch 'pe/azure-gui-selection' of https://github.com/Patrick-Erichsen/continue into Patrick-Erichsen-pe/azure-gui-selection
This commit is contained in:
commit
d3f99fbcd9
26 changed files with 1489 additions and 1465 deletions
4
core/index.d.ts
vendored
4
core/index.d.ts
vendored
|
|
@ -557,7 +557,9 @@ type ModelProvider =
|
|||
| "fireworks"
|
||||
| "custom"
|
||||
| "cloudflare"
|
||||
| "deepseek";
|
||||
| "deepseek"
|
||||
| "azure"
|
||||
| "openai-aiohttp";
|
||||
|
||||
export type ModelName =
|
||||
| "AUTODETECT"
|
||||
|
|
|
|||
26
docs/docs/reference/Model Providers/azure.md
Normal file
26
docs/docs/reference/Model Providers/azure.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# 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
|
||||
|
||||
You can configure Azure OpenAI service through the UI, or you can configure it manually in `config.json`.
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
"models": [{
|
||||
"title": "Azure OpenAI",
|
||||
"provider": "azure",
|
||||
"model": "<YOUR_MODEL>",
|
||||
"apiBase": "<YOUR_DEPLOYMENT_BASE>",
|
||||
"engine": "<YOUR_ENGINE>",
|
||||
"apiVersion": "<YOUR_API_VERSION>",
|
||||
"apiType": "azure",
|
||||
"apiKey": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -92,7 +73,7 @@ If you need to send custom headers for authentication, you may use the `requestO
|
|||
|
||||
## Customizing the Chat Template
|
||||
|
||||
Most open-source models expect a specific chat format, for example llama2 and codellama expect the input to look like `"[INST] How do I write bubble sort in Rust? [/INST]"`. Continue will automatically attempt to detect the correct prompt format based on the `model`value that you provide, but if you are receiving nonsense responses, you can use the`template`property to explicitly set the format that you expect. The options are:`["llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml", "openchat", "neural-chat", "none"]`.
|
||||
Most open-source models expect a specific chat format, for example llama2 and codellama expect the input to look like `"[INST] How do I write bubble sort in Rust? [/INST]"`. Continue will automatically attempt to detect the correct prompt format based on the `model`value that you provide, but if you are receiving nonsense responses, you can use the `template` property to explicitly set the format that you expect. The options are: `["llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml", "openchat", "neural-chat", "none"]`.
|
||||
|
||||
If you want to create an entirely new chat template, this can be done in [config.ts](../customization/code-config.md) by defining a function and adding it to the `templateMessages` property of your `LLM`. Here is an example of `templateMessages` for the Alpaca/Vicuna format:
|
||||
|
||||
|
|
|
|||
3
docs/static/schemas/config.json
vendored
3
docs/static/schemas/config.json
vendored
|
|
@ -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)",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.163",
|
||||
"version": "0.9.164",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.163",
|
||||
"version": "0.9.164",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"version": "0.9.163",
|
||||
"version": "0.9.164",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
BIN
gui/public/logos/azure.png
Normal file
BIN
gui/public/logos/azure.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
|
|
@ -6,11 +6,9 @@ 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";
|
||||
import { VscThemeContext } from "./context/VscTheme";
|
||||
import useSubmenuContextProviders from "./hooks/useSubmenuContextProviders";
|
||||
|
|
@ -54,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 />,
|
||||
|
|
|
|||
|
|
@ -7,13 +7,27 @@ import {
|
|||
lightGray,
|
||||
vscFocusBorder,
|
||||
} from "..";
|
||||
import {
|
||||
MODEL_PROVIDER_TAG_COLORS,
|
||||
PROVIDER_INFO,
|
||||
PackageDimension,
|
||||
} from "../../util/modelData";
|
||||
import HeaderButtonWithText from "../HeaderButtonWithText";
|
||||
import InfoHover from "../InfoHover";
|
||||
import ModelProviderTag, { ModelProviderTags } from "./ModelProviderTag";
|
||||
import { PackageDimension } from "../../pages/AddNewModel/configs/models";
|
||||
import { providers } from "../../pages/AddNewModel/configs/providers";
|
||||
|
||||
interface ModelCardProps {
|
||||
title: string;
|
||||
description: string;
|
||||
tags?: ModelProviderTags[];
|
||||
refUrl?: string;
|
||||
icon?: string;
|
||||
onClick?: (
|
||||
e: React.MouseEvent<HTMLDivElement, MouseEvent>,
|
||||
dimensionChoices?: string[],
|
||||
selectedProvider?: string,
|
||||
) => void;
|
||||
disabled?: boolean;
|
||||
dimensions?: PackageDimension[];
|
||||
providerOptions?: string[];
|
||||
}
|
||||
|
||||
const Div = styled.div<{ color: string; disabled: boolean; hovered: boolean }>`
|
||||
border: 1px solid ${lightGray};
|
||||
|
|
@ -71,31 +85,15 @@ const DimensionOptionDiv = styled.div<{ selected: boolean }>`
|
|||
}
|
||||
`;
|
||||
|
||||
interface ModelCardProps {
|
||||
title: string;
|
||||
description: string;
|
||||
tags?: string[];
|
||||
refUrl?: string;
|
||||
icon?: string;
|
||||
onClick?: (
|
||||
e: React.MouseEvent<HTMLDivElement, MouseEvent>,
|
||||
dimensionChoices?: string[],
|
||||
selectedProvider?: string
|
||||
) => void;
|
||||
disabled?: boolean;
|
||||
dimensions?: PackageDimension[];
|
||||
providerOptions?: string[];
|
||||
}
|
||||
|
||||
function ModelCard(props: ModelCardProps) {
|
||||
const [dimensionChoices, setDimensionChoices] = useState<string[]>(
|
||||
props.dimensions?.map((d) => Object.keys(d.options)[0]) || []
|
||||
props.dimensions?.map((d) => Object.keys(d.options)[0]) || [],
|
||||
);
|
||||
|
||||
const [hovered, setHovered] = useState(false);
|
||||
|
||||
const [selectedProvider, setSelectedProvider] = useState<string | undefined>(
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -136,21 +134,11 @@ function ModelCard(props: ModelCardProps) {
|
|||
)}
|
||||
<h3>{props.title}</h3>
|
||||
</div>
|
||||
{props.tags?.map((tag) => {
|
||||
return (
|
||||
<span
|
||||
style={{
|
||||
backgroundColor: `${MODEL_PROVIDER_TAG_COLORS[tag]}55`,
|
||||
color: "white",
|
||||
padding: "2px 4px",
|
||||
borderRadius: defaultBorderRadius,
|
||||
marginRight: "4px",
|
||||
}}
|
||||
>
|
||||
{tag}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
|
||||
{props.tags?.map((tag, i) => (
|
||||
<ModelProviderTag key={i} tag={tag} />
|
||||
))}
|
||||
|
||||
<p>{props.description}</p>
|
||||
|
||||
{props.refUrl && (
|
||||
|
|
@ -213,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;
|
||||
}
|
||||
|
|
|
|||
35
gui/src/components/modelSelection/ModelProviderTag.tsx
Normal file
35
gui/src/components/modelSelection/ModelProviderTag.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { defaultBorderRadius } from "..";
|
||||
|
||||
export enum ModelProviderTags {
|
||||
RequiresApiKey = "Requires API Key",
|
||||
Local = "Local",
|
||||
Free = "Free",
|
||||
OpenSource = "Open-Source",
|
||||
}
|
||||
|
||||
export interface ModelProviderTagProps {
|
||||
tag: ModelProviderTags;
|
||||
}
|
||||
|
||||
export const MODEL_PROVIDER_TAG_COLORS = {
|
||||
[ModelProviderTags.RequiresApiKey]: "#FF0000",
|
||||
[ModelProviderTags.Local]: "#00bb00",
|
||||
[ModelProviderTags.OpenSource]: "#0033FF",
|
||||
[ModelProviderTags.Free]: "#ffff00",
|
||||
};
|
||||
|
||||
export default function ModelProviderTag({ tag }: ModelProviderTagProps) {
|
||||
return (
|
||||
<span
|
||||
style={{
|
||||
backgroundColor: `${MODEL_PROVIDER_TAG_COLORS[tag]}55`,
|
||||
color: "white",
|
||||
padding: "2px 4px",
|
||||
borderRadius: defaultBorderRadius,
|
||||
marginRight: "4px",
|
||||
}}
|
||||
>
|
||||
{tag}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
|
@ -294,7 +294,7 @@ function ModelSelect(props: {}) {
|
|||
width="1.3em"
|
||||
height="1.3em"
|
||||
onClick={() => {
|
||||
navigate("/models");
|
||||
navigate("/addModel");
|
||||
}}
|
||||
/>
|
||||
</GridDiv>
|
||||
|
|
|
|||
|
|
@ -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 "../../../util/modelData";
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 "../../../util/modelData";
|
||||
import { DisplayInfo } from "../../../pages/ConfigureNewModel/modelProviders";
|
||||
import {
|
||||
StyledListbox,
|
||||
StyledListboxButton,
|
||||
|
|
|
|||
216
gui/src/pages/AddNewModel/AddNewModel.tsx
Normal file
216
gui/src/pages/AddNewModel/AddNewModel.tsx
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
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";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
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 />
|
||||
<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>
|
||||
<Link to="https://docs.continue.dev/model-setup/overview">
|
||||
Visit our setup overview docs
|
||||
</Link>{" "}
|
||||
to learn more.
|
||||
</IntroDiv>
|
||||
|
||||
<GridDiv>
|
||||
<Toggle
|
||||
selected={providersSelected}
|
||||
optionOne={"Start with a provider"}
|
||||
optionTwo={"Select a specific model"}
|
||||
onClick={() => {
|
||||
setProvidersSelected((prev) => !prev);
|
||||
}}
|
||||
></Toggle>
|
||||
{providersSelected ? (
|
||||
<>
|
||||
<div className="text-center">
|
||||
<h2>Providers</h2>
|
||||
<p>
|
||||
Select a provider below, or configure your own in{" "}
|
||||
<code>config.json</code>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{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}`);
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="text-center">
|
||||
<h2>Models</h2>
|
||||
<p>
|
||||
Select a model from the most popular options below, or configure
|
||||
your own in <code>config.json</code>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{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>
|
||||
),
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
<CustomModelButton
|
||||
className="w-full"
|
||||
disabled={false}
|
||||
onClick={(e) => {
|
||||
ideMessenger.post("openConfigJson", undefined);
|
||||
}}
|
||||
>
|
||||
<h3 className="text-center my-2">Open config.json</h3>
|
||||
</CustomModelButton>
|
||||
</GridDiv>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default AddNewModel;
|
||||
|
|
@ -10,18 +10,16 @@ import {
|
|||
defaultBorderRadius,
|
||||
lightGray,
|
||||
vscBackground,
|
||||
} from "../components";
|
||||
import StyledMarkdownPreview from "../components/markdown/StyledMarkdownPreview";
|
||||
import ModelCard from "../components/modelSelection/ModelCard";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../hooks/useNavigationListener";
|
||||
import { setDefaultModel } from "../redux/slices/stateSlice";
|
||||
import {
|
||||
MODEL_PROVIDER_TAG_COLORS,
|
||||
ModelInfo,
|
||||
PROVIDER_INFO,
|
||||
updatedObj,
|
||||
} from "../util/modelData";
|
||||
} from "../../components";
|
||||
import StyledMarkdownPreview from "../../components/markdown/StyledMarkdownPreview";
|
||||
import ModelCard from "../../components/modelSelection/ModelCard";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { setDefaultModel } from "../../redux/slices/stateSlice";
|
||||
import { updatedObj } from "../../util";
|
||||
import ModelProviderTag from "../../components/modelSelection/ModelProviderTag";
|
||||
import { providers } from "./configs/providers";
|
||||
import type { ProviderInfo } from "./configs/providers";
|
||||
|
||||
const GridDiv = styled.div`
|
||||
display: grid;
|
||||
|
|
@ -55,22 +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 [modelInfo, setModelInfo] = useState<ModelInfo | undefined>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
if (modelName) {
|
||||
setModelInfo(PROVIDER_INFO[modelName]);
|
||||
}
|
||||
}, [modelName]);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const [modelInfo, setModelInfo] = useState<ProviderInfo | undefined>(
|
||||
undefined,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (providerName) {
|
||||
setModelInfo(providers[providerName]);
|
||||
}
|
||||
}, [providerName]);
|
||||
|
||||
const disableModelCards = useCallback(() => {
|
||||
return (
|
||||
|
|
@ -98,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>
|
||||
|
||||
|
|
@ -117,22 +115,11 @@ function ModelConfig() {
|
|||
)}
|
||||
<h2>{modelInfo?.title}</h2>
|
||||
</div>
|
||||
{modelInfo?.tags?.map((tag, idx) => {
|
||||
return (
|
||||
<span
|
||||
key={idx}
|
||||
style={{
|
||||
backgroundColor: `${MODEL_PROVIDER_TAG_COLORS[tag]}55`,
|
||||
color: "white",
|
||||
padding: "2px 4px",
|
||||
borderRadius: defaultBorderRadius,
|
||||
marginRight: "4px",
|
||||
}}
|
||||
>
|
||||
{tag}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
|
||||
{modelInfo?.tags?.map((tag, i) => (
|
||||
<ModelProviderTag key={i} tag={tag} />
|
||||
))}
|
||||
|
||||
<StyledMarkdownPreview
|
||||
className="mt-2"
|
||||
source={modelInfo?.longDescription || modelInfo?.description}
|
||||
|
|
@ -146,26 +133,24 @@ function ModelConfig() {
|
|||
|
||||
{modelInfo?.collectInputFor
|
||||
?.filter((d) => d.required)
|
||||
.map((d, idx) => {
|
||||
return (
|
||||
<div key={idx}>
|
||||
<label htmlFor={d.key}>{d.key}</label>
|
||||
<Input
|
||||
type={d.inputType}
|
||||
id={d.key}
|
||||
className="border-2 border-gray-200 rounded-md p-2 m-2"
|
||||
placeholder={d.key}
|
||||
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>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
|
||||
|
|
@ -180,16 +165,12 @@ function ModelConfig() {
|
|||
if (d.required) return null;
|
||||
return (
|
||||
<div key={idx}>
|
||||
<label htmlFor={d.key}>
|
||||
{d.key.split(".")[d.key.split(".").length - 1]}
|
||||
</label>
|
||||
<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.key.split(".")[d.key.split(".").length - 1]
|
||||
}
|
||||
placeholder={d.label}
|
||||
defaultValue={d.defaultValue}
|
||||
min={d.min}
|
||||
max={d.max}
|
||||
|
|
@ -254,27 +235,10 @@ function ModelConfig() {
|
|||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
<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>
|
||||
</GridDiv>
|
||||
</div>
|
||||
</FormProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default ModelConfig;
|
||||
export default ConfigureProvider;
|
||||
60
gui/src/pages/AddNewModel/configs/completionParamsInputs.ts
Normal file
60
gui/src/pages/AddNewModel/configs/completionParamsInputs.ts
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import { InputDescriptor } from "./providers";
|
||||
|
||||
export const completionParamsInputs: Record<string, InputDescriptor> = {
|
||||
contextLength: {
|
||||
inputType: "number",
|
||||
key: "contextLength",
|
||||
label: "Context Length",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
},
|
||||
temperature: {
|
||||
inputType: "number",
|
||||
key: "completionOptions.temperature",
|
||||
label: "Temperature",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
min: 0.0,
|
||||
max: 1.0,
|
||||
step: 0.01,
|
||||
},
|
||||
topP: {
|
||||
inputType: "number",
|
||||
key: "completionOptions.topP",
|
||||
label: "Top-P",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
},
|
||||
topK: {
|
||||
inputType: "number",
|
||||
key: "completionOptions.topK",
|
||||
label: "Top-K",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
min: 0,
|
||||
step: 1,
|
||||
},
|
||||
presencePenalty: {
|
||||
inputType: "number",
|
||||
key: "completionOptions.presencePenalty",
|
||||
label: "Presence Penalty",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
},
|
||||
frequencyPenalty: {
|
||||
inputType: "number",
|
||||
key: "completionOptions.frequencyPenalty",
|
||||
label: "Frequency Penalty",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
},
|
||||
};
|
||||
540
gui/src/pages/AddNewModel/configs/models.ts
Normal file
540
gui/src/pages/AddNewModel/configs/models.ts
Normal file
|
|
@ -0,0 +1,540 @@
|
|||
import { ILLM, ModelName, ModelProvider } from "core";
|
||||
import { ModelProviderTags } 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?: ModelProviderTags[];
|
||||
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,
|
||||
},
|
||||
};
|
||||
476
gui/src/pages/AddNewModel/configs/providers.ts
Normal file
476
gui/src/pages/AddNewModel/configs/providers.ts
Normal file
|
|
@ -0,0 +1,476 @@
|
|||
import { ModelProvider } from "core";
|
||||
import { ftl } from "../../../components/dialogs/FTCDialog";
|
||||
import type { ModelPackage } from "./models";
|
||||
import { HTMLInputTypeAttribute } from "react";
|
||||
import { ModelProviderTags } from "../../../components/modelSelection/ModelProviderTag";
|
||||
import { models } from "./models";
|
||||
import { completionParamsInputs } from "./completionParamsInputs";
|
||||
|
||||
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;
|
||||
description: string;
|
||||
longDescription?: string;
|
||||
tags?: ModelProviderTags[];
|
||||
packages: ModelPackage[];
|
||||
params?: any;
|
||||
collectInputFor?: InputDescriptor[];
|
||||
refPage?: string;
|
||||
apiKeyUrl?: string;
|
||||
downloadUrl?: string;
|
||||
}
|
||||
|
||||
const completionParamsInputsConfigs = Object.values(completionParamsInputs);
|
||||
|
||||
const openSourceModels = Object.values(models).filter(
|
||||
({ isOpenSource }) => isOpenSource,
|
||||
);
|
||||
|
||||
export const apiBaseInput: InputDescriptor = {
|
||||
inputType: "text",
|
||||
key: "apiBase",
|
||||
label: "API Base",
|
||||
placeholder: "e.g. http://localhost:8080",
|
||||
required: false,
|
||||
};
|
||||
|
||||
export const providers: Partial<Record<ModelProvider, ProviderInfo>> = {
|
||||
openai: {
|
||||
title: "OpenAI",
|
||||
provider: "openai",
|
||||
description: "Use gpt-4, gpt-3.5-turbo, or any other OpenAI model",
|
||||
longDescription:
|
||||
"Use 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.",
|
||||
icon: "openai.png",
|
||||
tags: [ModelProviderTags.RequiresApiKey],
|
||||
packages: [
|
||||
models.gpt4o,
|
||||
models.gpt4turbo,
|
||||
models.gpt35turbo,
|
||||
{
|
||||
...models.AUTODETECT,
|
||||
params: {
|
||||
...models.AUTODETECT.params,
|
||||
title: "OpenAI",
|
||||
},
|
||||
},
|
||||
],
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your OpenAI API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
apiKeyUrl: "https://platform.openai.com/account/api-keys",
|
||||
},
|
||||
anthropic: {
|
||||
title: "Anthropic",
|
||||
provider: "anthropic",
|
||||
refPage: "anthropicllm",
|
||||
description:
|
||||
"Anthropic builds state-of-the-art models with large context length and high recall",
|
||||
icon: "anthropic.png",
|
||||
tags: [ModelProviderTags.RequiresApiKey],
|
||||
longDescription:
|
||||
"To get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.",
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your Anthropic API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputsConfigs,
|
||||
{
|
||||
...completionParamsInputs.contextLength,
|
||||
defaultValue: 100000,
|
||||
},
|
||||
],
|
||||
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.
|
||||
|
||||
Select the \`GPT-4o\` model below to complete your provider configuration, but note that this will not affect the specific model you need to select when creating your Azure deployment.`,
|
||||
icon: "azure.png",
|
||||
tags: [ModelProviderTags.RequiresApiKey],
|
||||
refPage: "azure",
|
||||
apiKeyUrl:
|
||||
"https://azure.microsoft.com/en-us/products/ai-services/openai-service",
|
||||
packages: [models.gpt4o],
|
||||
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 },
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
},
|
||||
mistral: {
|
||||
title: "Mistral API",
|
||||
provider: "mistral",
|
||||
description:
|
||||
"The Mistral API provides seamless access to their models, including Codestral, Mistral 8x22B, Mistral Large, and more.",
|
||||
icon: "mistral.png",
|
||||
longDescription: `To get access to the Mistral API, obtain your API key from [here](https://console.mistral.ai/codestral) for Codestral or the [Mistral platform](https://docs.mistral.ai/) for all other models.`,
|
||||
tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource],
|
||||
params: {
|
||||
apiKey: "",
|
||||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your Mistral API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
packages: [
|
||||
models.codestral,
|
||||
models.mistralLarge,
|
||||
models.mistralSmall,
|
||||
models.mistral8x22b,
|
||||
models.mistral8x7b,
|
||||
models.mistral7b,
|
||||
],
|
||||
apiKeyUrl: "https://console.mistral.ai/codestral",
|
||||
},
|
||||
ollama: {
|
||||
title: "Ollama",
|
||||
provider: "ollama",
|
||||
description:
|
||||
"One of the fastest ways to get started with local models on Mac, Linux, or Windows",
|
||||
longDescription:
|
||||
'To get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run <MODEL_NAME>`. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model="codellama:7b-instruct"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.',
|
||||
icon: "ollama.png",
|
||||
tags: [ModelProviderTags.Local, ModelProviderTags.OpenSource],
|
||||
packages: [
|
||||
{
|
||||
...models.AUTODETECT,
|
||||
params: {
|
||||
...models.AUTODETECT.params,
|
||||
title: "Ollama",
|
||||
},
|
||||
},
|
||||
...openSourceModels,
|
||||
],
|
||||
collectInputFor: [
|
||||
...completionParamsInputsConfigs,
|
||||
{ ...apiBaseInput, defaultValue: "http://localhost:11434" },
|
||||
],
|
||||
downloadUrl: "https://ollama.ai/",
|
||||
},
|
||||
cohere: {
|
||||
title: "Cohere",
|
||||
provider: "cohere",
|
||||
refPage: "cohere",
|
||||
description:
|
||||
"Optimized for enterprise generative AI, search and discovery, and advanced retrieval.",
|
||||
icon: "cohere.png",
|
||||
tags: [ModelProviderTags.RequiresApiKey],
|
||||
longDescription:
|
||||
"To use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.",
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your Cohere API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
packages: [models.commandR, models.commandRPlus],
|
||||
},
|
||||
groq: {
|
||||
title: "Groq",
|
||||
provider: "groq",
|
||||
icon: "groq.png",
|
||||
description:
|
||||
"Groq is the fastest LLM provider by a wide margin, using 'LPUs' to serve open-source models at blazing speed.",
|
||||
longDescription:
|
||||
"To get started with Groq, obtain an API key from their website [here](https://wow.groq.com/).",
|
||||
tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource],
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your Groq API key",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
packages: [
|
||||
models.llama370bChat,
|
||||
models.llama38bChat,
|
||||
{ ...models.mixtralTrial, title: "Mixtral" },
|
||||
models.llama270bChat,
|
||||
{
|
||||
...models.AUTODETECT,
|
||||
params: {
|
||||
...models.AUTODETECT.params,
|
||||
title: "Groq",
|
||||
},
|
||||
},
|
||||
,
|
||||
],
|
||||
apiKeyUrl: "https://console.groq.com/keys",
|
||||
},
|
||||
together: {
|
||||
title: "TogetherAI",
|
||||
provider: "together",
|
||||
refPage: "togetherllm",
|
||||
description:
|
||||
"Use the TogetherAI API for extremely fast streaming of open-source models",
|
||||
icon: "together.png",
|
||||
longDescription: `Together is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset`,
|
||||
tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource],
|
||||
params: {
|
||||
apiKey: "",
|
||||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your TogetherAI API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
packages: [
|
||||
models.llama3Chat,
|
||||
models.codeLlamaInstruct,
|
||||
models.mistralOs,
|
||||
].map((p) => {
|
||||
p.params.contextLength = 4096;
|
||||
return p;
|
||||
}),
|
||||
},
|
||||
gemini: {
|
||||
title: "Google Gemini API",
|
||||
provider: "gemini",
|
||||
refPage: "geminiapi",
|
||||
description:
|
||||
"Try out Google's state-of-the-art Gemini model from their API.",
|
||||
longDescription: `To get started with Google Gemini API, obtain your API key from [here](https://ai.google.dev/tutorials/workspace_auth_quickstart) and paste it below.`,
|
||||
icon: "gemini.png",
|
||||
tags: [ModelProviderTags.RequiresApiKey],
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your Gemini API key",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
packages: [models.gemini15Pro, models.geminiPro, models.gemini15Flash],
|
||||
apiKeyUrl: "https://aistudio.google.com/app/apikey",
|
||||
},
|
||||
lmstudio: {
|
||||
title: "LM Studio",
|
||||
provider: "lmstudio",
|
||||
description:
|
||||
"One of the fastest ways to get started with local models on Mac or Windows",
|
||||
longDescription:
|
||||
"LMStudio provides a professional and well-designed GUI for exploring, configuring, and serving LLMs. It is available on both Mac and Windows. To get started:\n1. Download from [lmstudio.ai](https://lmstudio.ai/) and open the application\n2. Search for and download the desired model from the home screen of LMStudio.\n3. In the left-bar, click the '<->' icon to open the Local Inference Server and press 'Start Server'.\n4. Once your model is loaded and the server has started, you can begin using Continue.",
|
||||
icon: "lmstudio.png",
|
||||
tags: [ModelProviderTags.Local, ModelProviderTags.OpenSource],
|
||||
params: {
|
||||
apiBase: "http://localhost:1234/v1/",
|
||||
},
|
||||
packages: [
|
||||
{
|
||||
...models.AUTODETECT,
|
||||
params: {
|
||||
...models.AUTODETECT.params,
|
||||
title: "LM Studio",
|
||||
},
|
||||
},
|
||||
...openSourceModels,
|
||||
],
|
||||
collectInputFor: [...completionParamsInputsConfigs],
|
||||
downloadUrl: "https://lmstudio.ai/",
|
||||
},
|
||||
llamafile: {
|
||||
title: "llamafile",
|
||||
provider: "llamafile",
|
||||
icon: "llamafile.png",
|
||||
description:
|
||||
"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: [ModelProviderTags.Local, ModelProviderTags.OpenSource],
|
||||
packages: openSourceModels,
|
||||
collectInputFor: [...completionParamsInputsConfigs],
|
||||
downloadUrl:
|
||||
"https://github.com/Mozilla-Ocho/llamafile?tab=readme-ov-file#quickstart",
|
||||
},
|
||||
replicate: {
|
||||
title: "Replicate",
|
||||
provider: "replicate",
|
||||
refPage: "replicatellm",
|
||||
description: "Use the Replicate API to run open-source models",
|
||||
longDescription: `Replicate is a hosted service that makes it easy to run ML models. To get started with Replicate:\n1. Obtain an API key from [here](https://replicate.com)\n2. Paste below\n3. Select a model preset`,
|
||||
params: {
|
||||
apiKey: "",
|
||||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your Replicate API key",
|
||||
required: true,
|
||||
},
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
icon: "replicate.png",
|
||||
tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource],
|
||||
packages: [
|
||||
models.llama3Chat,
|
||||
models.codeLlamaInstruct,
|
||||
models.wizardCoder,
|
||||
models.mistralOs,
|
||||
],
|
||||
apiKeyUrl: "https://replicate.com/account/api-tokens",
|
||||
},
|
||||
"llama.cpp": {
|
||||
title: "llama.cpp",
|
||||
provider: "llama.cpp",
|
||||
refPage: "llamacpp",
|
||||
description: "If you are running the llama.cpp server from source",
|
||||
longDescription: `llama.cpp comes with a [built-in server](https://github.com/ggerganov/llama.cpp/tree/master/examples/server#llamacppexampleserver) that can be run from source. To do this:
|
||||
|
||||
1. Clone the repository with \`git clone https://github.com/ggerganov/llama.cpp\`.
|
||||
2. \`cd llama.cpp\`
|
||||
3. Run \`make\` to build the server.
|
||||
4. Download the model you'd like to use and place it in the \`llama.cpp/models\` directory (the best place to find models is [The Bloke on HuggingFace](https://huggingface.co/TheBloke))
|
||||
5. Run the llama.cpp server with the command below (replacing with the model you downloaded):
|
||||
|
||||
\`\`\`shell
|
||||
.\\server.exe -c 4096 --host 0.0.0.0 -t 16 --mlock -m models/codellama-7b-instruct.Q8_0.gguf
|
||||
\`\`\`
|
||||
|
||||
After it's up and running, you can start using Continue.`,
|
||||
icon: "llamacpp.png",
|
||||
tags: [ModelProviderTags.Local, ModelProviderTags.OpenSource],
|
||||
packages: openSourceModels,
|
||||
collectInputFor: [...completionParamsInputsConfigs],
|
||||
downloadUrl: "https://github.com/ggerganov/llama.cpp",
|
||||
},
|
||||
"openai-aiohttp": {
|
||||
title: "Other OpenAI-compatible API",
|
||||
provider: "openai",
|
||||
description:
|
||||
"If you are using any other OpenAI-compatible API, for example text-gen-webui, FastChat, LocalAI, or llama-cpp-python, you can simply enter your server URL",
|
||||
longDescription: `If you are using any other OpenAI-compatible API, you can simply enter your server URL. If you still need to set up your model server, you can follow a guide below:
|
||||
|
||||
- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation)
|
||||
- [LocalAI](https://localai.io/basics/getting_started/)
|
||||
- [llama-cpp-python](https://github.com/continuedev/ggml-server-example)
|
||||
- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md)`,
|
||||
params: {
|
||||
apiBase: "",
|
||||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
...apiBaseInput,
|
||||
defaultValue: "http://localhost:8000/v1/",
|
||||
},
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
icon: "openai.png",
|
||||
tags: [ModelProviderTags.Local, ModelProviderTags.OpenSource],
|
||||
packages: [
|
||||
{
|
||||
...models.AUTODETECT,
|
||||
params: {
|
||||
...models.AUTODETECT.params,
|
||||
title: "OpenAI",
|
||||
},
|
||||
},
|
||||
...openSourceModels,
|
||||
],
|
||||
},
|
||||
"free-trial": {
|
||||
title: "Continue limited free trial",
|
||||
provider: "free-trial",
|
||||
refPage: "freetrial",
|
||||
description:
|
||||
"New users can try out Continue for free using a proxy server that securely makes calls to OpenAI, Anthropic, or Together using our API key",
|
||||
longDescription: `New users can try out Continue for free using a proxy server that securely makes calls to OpenAI, Anthropic, or Together using our API key. If you are ready to set up a model for long-term use or have used all ${ftl()} free uses, you can enter your API key or use a local model.`,
|
||||
icon: "openai.png",
|
||||
tags: [ModelProviderTags.Free],
|
||||
packages: [
|
||||
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)" },
|
||||
{
|
||||
...models.AUTODETECT,
|
||||
params: {
|
||||
...models.AUTODETECT.params,
|
||||
title: "Free Trial",
|
||||
},
|
||||
},
|
||||
],
|
||||
collectInputFor: [...completionParamsInputsConfigs],
|
||||
},
|
||||
};
|
||||
2
gui/src/pages/AddNewModel/index.ts
Normal file
2
gui/src/pages/AddNewModel/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export { default as AddNewModel } from "./AddNewModel";
|
||||
export { default as ConfigureProvider } from "./ConfigureProvider";
|
||||
|
|
@ -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 "../util/modelData";
|
||||
import { CustomModelButton } from "./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;
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { getLocalStorage } from "./localStorage";
|
||||
import _ from "lodash";
|
||||
|
||||
type Platform = "mac" | "linux" | "windows" | "unknown";
|
||||
|
||||
|
|
@ -75,3 +76,31 @@ export function isPrerelease() {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the values of an object's properties based on the specified paths.
|
||||
*
|
||||
* This function creates a deep clone of the provided object and updates its properties
|
||||
* based on the given path-to-value mappings. If a value in the mapping is a function,
|
||||
* it will be used to determine the new value for the property. Otherwise, the value itself
|
||||
* will be set for the property.
|
||||
*
|
||||
* @param {Object} old - The original object to be cloned and updated.
|
||||
* @param {Object} pathToValue - An object where the keys represent the paths to the properties
|
||||
* to be updated and the values represent the new values or functions
|
||||
* to determine the new values.
|
||||
* @returns {Object} A new object with the updated values.
|
||||
*/
|
||||
export function updatedObj(old: any, pathToValue: { [key: string]: any }) {
|
||||
const newObject = _.cloneDeep(old);
|
||||
|
||||
for (const key in pathToValue) {
|
||||
if (typeof pathToValue[key] === "function") {
|
||||
_.updateWith(newObject, key, pathToValue[key]);
|
||||
} else {
|
||||
_.updateWith(newObject, key, (__) => pathToValue[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return newObject;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue