Merge pull request #2817 from continuedev/dallin/grok
xAI Grok Beta support
This commit is contained in:
commit
73369967db
13 changed files with 695 additions and 172 deletions
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
|
|
@ -41,7 +41,7 @@
|
|||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": ">",
|
||||
"endsPattern": "node scripts/esbuild.js --sourcemap --watch"
|
||||
"endsPattern": "VS Code Extension esbuild complete"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
17
core/index.d.ts
vendored
17
core/index.d.ts
vendored
|
|
@ -48,9 +48,9 @@ export interface IndexingProgressUpdate {
|
|||
export type PromptTemplate =
|
||||
| string
|
||||
| ((
|
||||
history: ChatMessage[],
|
||||
otherData: Record<string, string>,
|
||||
) => string | ChatMessage[]);
|
||||
history: ChatMessage[],
|
||||
otherData: Record<string, string>,
|
||||
) => string | ChatMessage[]);
|
||||
|
||||
export interface ILLM extends LLMOptions {
|
||||
get providerName(): ModelProvider;
|
||||
|
|
@ -646,7 +646,8 @@ type ModelProvider =
|
|||
| "cerebras"
|
||||
| "askSage"
|
||||
| "vertexai"
|
||||
| "nebius";
|
||||
| "nebius"
|
||||
| "xAI";
|
||||
|
||||
export type ModelName =
|
||||
| "AUTODETECT"
|
||||
|
|
@ -696,6 +697,8 @@ export type ModelName =
|
|||
| "llama3.2-3b"
|
||||
| "llama3.2-11b"
|
||||
| "llama3.2-90b"
|
||||
// xAI
|
||||
| "grok-beta"
|
||||
// Other Open-source
|
||||
| "phi2"
|
||||
| "phind-codellama-34b"
|
||||
|
|
@ -1054,9 +1057,9 @@ export interface Config {
|
|||
embeddingsProvider?: EmbeddingsProviderDescription | EmbeddingsProvider;
|
||||
/** The model that Continue will use for tab autocompletions. */
|
||||
tabAutocompleteModel?:
|
||||
| CustomLLM
|
||||
| ModelDescription
|
||||
| (CustomLLM | ModelDescription)[];
|
||||
| CustomLLM
|
||||
| ModelDescription
|
||||
| (CustomLLM | ModelDescription)[];
|
||||
/** Options for tab autocomplete */
|
||||
tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
|
||||
/** UI styles customization */
|
||||
|
|
|
|||
|
|
@ -146,7 +146,8 @@ function autodetectTemplateType(model: string): TemplateType | undefined {
|
|||
lower.includes("command") ||
|
||||
lower.includes("chat-bison") ||
|
||||
lower.includes("pplx") ||
|
||||
lower.includes("gemini")
|
||||
lower.includes("gemini") ||
|
||||
lower.includes("grok")
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import WatsonX from "./WatsonX";
|
|||
import ContinueProxy from "./stubs/ContinueProxy";
|
||||
import VertexAI from "./VertexAI";
|
||||
import Asksage from "./Asksage";
|
||||
import xAI from "./xAI";
|
||||
|
||||
const LLMs = [
|
||||
Anthropic,
|
||||
|
|
@ -84,7 +85,8 @@ const LLMs = [
|
|||
Cerebras,
|
||||
Asksage,
|
||||
Nebius,
|
||||
VertexAI
|
||||
VertexAI,
|
||||
xAI
|
||||
];
|
||||
|
||||
export async function llmFromDescription(
|
||||
|
|
|
|||
20
core/llm/llms/xAI.ts
Normal file
20
core/llm/llms/xAI.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { LLMOptions, ModelProvider } from "../../index.js";
|
||||
|
||||
import OpenAI from "./OpenAI.js";
|
||||
|
||||
class xAI extends OpenAI {
|
||||
static providerName: ModelProvider = "xAI";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: "https://api.x.ai/v1/",
|
||||
};
|
||||
|
||||
private static MODEL_IDS: { [name: string]: string } = {
|
||||
"grok-beta": "grok-beta", // Future names might not line up
|
||||
};
|
||||
|
||||
protected _convertModelName(model: string) {
|
||||
return xAI.MODEL_IDS[model] || this.model;
|
||||
}
|
||||
}
|
||||
|
||||
export default xAI;
|
||||
53
docs/docs/customize/model-providers/top-level/xAI.md
Normal file
53
docs/docs/customize/model-providers/top-level/xAI.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
title: xAI
|
||||
slug: ../xai
|
||||
---
|
||||
|
||||
:::info
|
||||
|
||||
You can get an API key from the [xAI console](https://console.x.ai/)
|
||||
|
||||
:::
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **grok-beta** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Grok Beta",
|
||||
"provider": "xAI",
|
||||
"model": "grok-beta",
|
||||
"apiKey": "[API_KEY]"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
xAI currently does not offer any autocomplete models.
|
||||
|
||||
[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
xAI currently does not offer any embeddings models.
|
||||
|
||||
[Click here](../../model-types/embeddings.md) to see a list of embeddings model providers.
|
||||
|
||||
## Reranking model
|
||||
|
||||
xAI currently does not offer any reranking models.
|
||||
|
||||
[Click here](../../model-types/reranking.md) to see a list of reranking model providers.
|
||||
|
||||
## Legacy Completions
|
||||
|
||||
To force usage of `chat/completions` instead of `completions` endpoint you can set
|
||||
|
||||
```json
|
||||
"useLegacyCompletionsEndpoint": false
|
||||
```
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -30,4 +30,5 @@ const esbuildConfig = {
|
|||
} else {
|
||||
await esbuild.build(esbuildConfig);
|
||||
}
|
||||
})();
|
||||
console.log("VS Code Extension esbuild complete"); // Used in task endpattern to signal completion
|
||||
})();
|
||||
BIN
gui/public/logos/xAI.png
Normal file
BIN
gui/public/logos/xAI.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
|
|
@ -1059,6 +1059,19 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
providerOptions: ["nebius"],
|
||||
isOpenSource: true,
|
||||
},
|
||||
grokBeta: {
|
||||
title: "Grok Beta",
|
||||
description: "Generative artificial intelligence chatbot developed by xAI.",
|
||||
refUrl: "",
|
||||
params: {
|
||||
title: "Grok Beta",
|
||||
model: "grok-beta",
|
||||
contextLength: 128_000,
|
||||
},
|
||||
icon: "xAI.png",
|
||||
providerOptions: ["xAI"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
AUTODETECT: {
|
||||
title: "Autodetect",
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -352,6 +352,27 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
|
|||
packages: [models.gemini15Pro, models.geminiPro, models.gemini15Flash],
|
||||
apiKeyUrl: "https://aistudio.google.com/app/apikey",
|
||||
},
|
||||
xAI: {
|
||||
title: "xAI",
|
||||
provider: "xAI",
|
||||
icon: "xAI.png",
|
||||
description: "xAI is a company working on building artificial intelligence to accelerate human scientific discovery",
|
||||
longDescription: "To get started with xAI, obtain an API key from their [console](https://console.x.ai/).",
|
||||
tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource],
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your xAI API key",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
packages: [
|
||||
models.grokBeta,
|
||||
],
|
||||
apiKeyUrl: "https://console.x.ai/",
|
||||
},
|
||||
lmstudio: {
|
||||
title: "LM Studio",
|
||||
provider: "lmstudio",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { Ollama } from "./providers/ollama.js";
|
|||
import { OpenAi } from "./providers/openai.js";
|
||||
import { Vllm } from "./providers/vllm.js";
|
||||
import { Voyage } from "./providers/voyage.js";
|
||||
import { xAI } from "./providers/xAI.js";
|
||||
import { LlmInfo, ModelProvider, UseCase } from "./types.js";
|
||||
|
||||
export const allModelProviders: ModelProvider[] = [
|
||||
|
|
@ -21,6 +22,7 @@ export const allModelProviders: ModelProvider[] = [
|
|||
Vllm,
|
||||
Bedrock,
|
||||
Cohere,
|
||||
xAI
|
||||
];
|
||||
|
||||
export const allLlms: LlmInfo[] = allModelProviders.flatMap((provider) =>
|
||||
|
|
|
|||
14
packages/llm-info/src/providers/xAI.ts
Normal file
14
packages/llm-info/src/providers/xAI.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { ModelProvider } from "../types.js";
|
||||
|
||||
export const xAI: ModelProvider = {
|
||||
models: [
|
||||
{
|
||||
model: "grok-beta",
|
||||
displayName: "Grok Beta",
|
||||
contextLength: 128000,
|
||||
recommendedFor: ["chat"],
|
||||
},
|
||||
],
|
||||
id: "xAI",
|
||||
displayName: "xAI",
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue