feat: grok model additions
This commit is contained in:
parent
5262cf255e
commit
1e3bf050d2
9 changed files with 178 additions and 33 deletions
|
|
@ -7,14 +7,6 @@ class xAI extends OpenAI {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -280,6 +280,23 @@ describe("PROVIDER_TOOL_SUPPORT", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("xAI", () => {
|
||||
const supportsFn = PROVIDER_TOOL_SUPPORT["xAI"];
|
||||
|
||||
it("should return true for Grok-3 models", () => {
|
||||
expect(supportsFn("grok-3")).toBe(true);
|
||||
expect(supportsFn("grok-3-mini")).toBe(true);
|
||||
expect(supportsFn("grok-3-fast")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true for Grok-4 models", () => {
|
||||
expect(supportsFn("grok-4")).toBe(true);
|
||||
expect(supportsFn("grok-4-fast-non-reasoning")).toBe(true);
|
||||
expect(supportsFn("grok-4-fast-reasoning")).toBe(true);
|
||||
expect(supportsFn("Grok-4-Fast")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("novita", () => {
|
||||
const supportsFn = PROVIDER_TOOL_SUPPORT["novita"];
|
||||
|
||||
|
|
|
|||
|
|
@ -105,11 +105,15 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
|
|||
vertexai: (model) => {
|
||||
const lowerCaseModel = model.toLowerCase();
|
||||
// All gemini models except flash 2.0 lite support function calling
|
||||
if (lowerCaseModel.includes("lite")) {
|
||||
if (lowerCaseModel.includes("grok-3")) {
|
||||
return false;
|
||||
}
|
||||
return ["claude", "gemini"].some((val) => lowerCaseModel.includes(val));
|
||||
},
|
||||
xAI: (model) => {
|
||||
const lowerCaseModel = model.toLowerCase();
|
||||
return ["grok-3", "grok-4"].some((val) => lowerCaseModel.includes(val));
|
||||
},
|
||||
bedrock: (model) => {
|
||||
if (
|
||||
[
|
||||
|
|
|
|||
|
|
@ -65,10 +65,10 @@ Read more about [model roles](/customize/model-roles), [model capabilities](/cus
|
|||
3. Add `GEMINI_API_KEY` as a [User Secret](https://docs.continue.dev/hub/secrets/secret-types#user-secrets) on Continue Hub [here](https://hub.continue.dev/settings/secrets)
|
||||
4. Click `Reload config` in the agent selector in the Continue IDE extension
|
||||
|
||||
[Grok 4](https://hub.continue.dev/xai/grok-4) from xAI
|
||||
[Grok Code Fast 1](https://hub.continue.dev/xai/grok-code-fast-1) from xAI
|
||||
|
||||
1. Get your API key from [xAI](https://console.x.ai/)
|
||||
2. Add [Grok 4](https://hub.continue.dev/xai/grok-4) to an agent on Continue Hub
|
||||
2. Add [Grok Code Fast 1](https://hub.continue.dev/xai/grok-code-fast-1) to an agent on Continue Hub
|
||||
3. Add `XAI_API_KEY` as a [User Secret](https://docs.continue.dev/hub/secrets/secret-types#user-secrets) on Continue Hub [here](https://hub.continue.dev/settings/secrets)
|
||||
4. Click `Reload config` in the agent selector in the Continue IDE extension
|
||||
|
||||
|
|
|
|||
|
|
@ -210,9 +210,14 @@ This matrix shows which models support tool use and image input capabilities. Co
|
|||
|
||||
### xAI
|
||||
|
||||
| Model | Tool Use | Image Input | Context Window |
|
||||
| :----- | -------- | ----------- | -------------- |
|
||||
| Grok 4 | Yes | Yes | 128k |
|
||||
| Model | Tool Use | Image Input | Context Window |
|
||||
| :------------------------ | -------- | ----------- | -------------- |
|
||||
| Grok Code Fast 1 | Yes | Yes | 256k |
|
||||
| Grok 4 Fast Reasoning. | Yes | Yes | 2M |
|
||||
| Grok 4 Fast Non-Reasoning | Yes | Yes | 2M |
|
||||
| Grok 4 | Yes | Yes | 256k |
|
||||
| Grok 3 | Yes | Yes | 131k |
|
||||
| Grok 3 Mini | Yes | Yes | 131k |
|
||||
|
||||
### Moonshot AI
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,9 @@ title: xAI
|
|||
slug: ../xai
|
||||
---
|
||||
|
||||
<Tip>
|
||||
**Discover xAI models [here](https://hub.continue.dev/xai)**
|
||||
</Tip>
|
||||
<Tip>**Discover xAI models [here](https://hub.continue.dev/xai)**</Tip>
|
||||
|
||||
<Info>
|
||||
Get an API key from the [xAI Console](https://console.x.ai/)
|
||||
</Info>
|
||||
<Info>Get an API key from the [xAI Console](https://console.x.ai/)</Info>
|
||||
|
||||
## Configuration
|
||||
|
||||
|
|
@ -19,7 +15,7 @@ slug: ../xai
|
|||
models:
|
||||
- name: <MODEL_NAME>
|
||||
provider: xai
|
||||
model: <MODEL_ID>
|
||||
model: <MODEL_ID> # e.g. grok-code-fast-1
|
||||
apiKey: <YOUR_XAI_API_KEY>
|
||||
```
|
||||
</Tab>
|
||||
|
|
@ -29,8 +25,8 @@ slug: ../xai
|
|||
"models": [
|
||||
{
|
||||
"title": "<MODEL_NAME>",
|
||||
"provider": "anthropic",
|
||||
"model": "<MODEL_ID>",
|
||||
"provider": "xai",
|
||||
"model": "<MODEL_ID>", // e.g. grok-code-fast-1
|
||||
"apiKey": "<YOUR_XAI_API_KEY>"
|
||||
}
|
||||
]
|
||||
|
|
@ -40,5 +36,6 @@ slug: ../xai
|
|||
</Tabs>
|
||||
|
||||
<Info>
|
||||
**Check out a more advanced configuration [here](https://hub.continue.dev/xai/grok-4?view=config)**
|
||||
</Info>
|
||||
**Check out a more advanced configuration
|
||||
[here](https://hub.continue.dev/xai/grok-code-fast-1?view=config)**
|
||||
</Info>
|
||||
|
|
|
|||
|
|
@ -1585,14 +1585,83 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
providerOptions: ["scaleway", "nebius", "ovhcloud", "ncompass"],
|
||||
isOpenSource: true,
|
||||
},
|
||||
grokBeta: {
|
||||
title: "Grok Beta",
|
||||
description: "Generative artificial intelligence chatbot developed by xAI.",
|
||||
refUrl: "",
|
||||
grokCodeFast1: {
|
||||
title: "Grok Code Fast 1",
|
||||
description:
|
||||
"A speedy and economical reasoning model that excels at agentic coding",
|
||||
refUrl: "https://docs.x.ai/docs/models/grok-code-fast-1",
|
||||
params: {
|
||||
title: "Grok Beta",
|
||||
model: "grok-beta",
|
||||
contextLength: 128_000,
|
||||
title: "Grok Code Fast 1",
|
||||
model: "grok-code-fast-1",
|
||||
contextLength: 256000,
|
||||
},
|
||||
icon: "xAI.png",
|
||||
providerOptions: ["xAI", "askSage"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
grok4FastReasoning: {
|
||||
title: "Grok 4 Fast Reasoning",
|
||||
description: "xAI's latest advancement in cost-efficient reasoning models",
|
||||
refUrl: "https://docs.x.ai/docs/models/grok-4-fast-reasoning",
|
||||
params: {
|
||||
title: "Grok 4 Fast Reasoning",
|
||||
model: "grok-4-fast-reasoning",
|
||||
contextLength: 2_000_000,
|
||||
},
|
||||
icon: "xAI.png",
|
||||
providerOptions: ["xAI", "askSage"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
grok4FastNonReasoning: {
|
||||
title: "Grok 4 Fast Non-Reasoning",
|
||||
description: "xAI's latest advancement in cost-efficient models",
|
||||
refUrl: "https://docs.x.ai/docs/models/grok-4-fast-non-reasoning",
|
||||
params: {
|
||||
title: "Grok 4 Fast Non-Reasoning",
|
||||
model: "grok-4-fast-non-reasoning",
|
||||
contextLength: 2_000_000,
|
||||
},
|
||||
icon: "xAI.png",
|
||||
providerOptions: ["xAI", "askSage"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
grok4: {
|
||||
title: "Grok 4",
|
||||
description:
|
||||
"xAI's latest and greatest flagship model, offering strong performance in natural language, math and reasoning.",
|
||||
refUrl: "https://docs.x.ai/docs/models/grok-4",
|
||||
params: {
|
||||
title: "Grok 4",
|
||||
model: "grok-4",
|
||||
contextLength: 256_000,
|
||||
},
|
||||
icon: "xAI.png",
|
||||
providerOptions: ["xAI", "askSage"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
grok3: {
|
||||
title: "Grok 3",
|
||||
description:
|
||||
"Excels at enterprise use cases like data extraction, coding, and text summarization",
|
||||
refUrl: "https://docs.x.ai/docs/models/grok-3",
|
||||
params: {
|
||||
title: "Grok 3",
|
||||
model: "grok-3",
|
||||
contextLength: 131_072,
|
||||
},
|
||||
icon: "xAI.png",
|
||||
providerOptions: ["xAI", "askSage"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
grok3Mini: {
|
||||
title: "Grok 3 Mini",
|
||||
description:
|
||||
"A lightweight model that thinks before responding. Fast, smart, and great for logic-based tasks that do not require deep domain knowledge.",
|
||||
refUrl: "https://docs.x.ai/docs/models/grok-3-mini",
|
||||
params: {
|
||||
title: "Grok 3 Mini",
|
||||
model: "grok-3-mini",
|
||||
contextLength: 131_072,
|
||||
},
|
||||
icon: "xAI.png",
|
||||
providerOptions: ["xAI", "askSage"],
|
||||
|
|
|
|||
|
|
@ -563,7 +563,14 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
|
|||
required: true,
|
||||
},
|
||||
],
|
||||
packages: [models.grokBeta],
|
||||
packages: [
|
||||
models.grokCodeFast1,
|
||||
models.grok4FastReasoning,
|
||||
models.grok4FastNonReasoning,
|
||||
models.grok4,
|
||||
models.grok3,
|
||||
models.grok3Mini,
|
||||
],
|
||||
apiKeyUrl: "https://console.x.ai/",
|
||||
},
|
||||
lemonade: {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,60 @@ export const xAI: ModelProvider = {
|
|||
displayName: "Grok Beta",
|
||||
contextLength: 128000,
|
||||
recommendedFor: ["chat"],
|
||||
regex: /grok-beta/,
|
||||
},
|
||||
{
|
||||
model: "grok-2",
|
||||
displayName: "Grok 2",
|
||||
contextLength: 131072,
|
||||
recommendedFor: ["chat"],
|
||||
regex: /grok-2-/,
|
||||
},
|
||||
{
|
||||
model: "grok-3-mini",
|
||||
displayName: "Grok 3 Mini",
|
||||
contextLength: 131072,
|
||||
maxCompletionTokens: 8000,
|
||||
recommendedFor: ["chat"],
|
||||
regex: /grok-3-mini/,
|
||||
},
|
||||
{
|
||||
model: "grok-3",
|
||||
displayName: "Grok 3",
|
||||
contextLength: 131072,
|
||||
recommendedFor: ["chat"],
|
||||
regex: /grok-3-/,
|
||||
},
|
||||
{
|
||||
model: "grok-4-fast-reasoning",
|
||||
displayName: "Grok 4 Fast Reasoning",
|
||||
contextLength: 2000000,
|
||||
maxCompletionTokens: 30000,
|
||||
recommendedFor: ["chat"],
|
||||
regex: /grok-4-fast-reasoning/,
|
||||
},
|
||||
{
|
||||
model: "grok-4-fast-non-reasoning",
|
||||
displayName: "Grok 4 Fast Non-Reasoning",
|
||||
contextLength: 2000000,
|
||||
maxCompletionTokens: 30000,
|
||||
recommendedFor: ["chat"],
|
||||
regex: /grok-4-fast-non-reasoning/,
|
||||
},
|
||||
{
|
||||
model: "grok-4",
|
||||
displayName: "Grok 4 Fast",
|
||||
contextLength: 256000,
|
||||
recommendedFor: ["chat"],
|
||||
regex: /grok-4/,
|
||||
},
|
||||
{
|
||||
model: "grok-code-fast-1",
|
||||
displayName: "Grok Code Fast 1",
|
||||
contextLength: 256000,
|
||||
maxCompletionTokens: 10000,
|
||||
recommendedFor: ["chat"],
|
||||
regex: /grok-code-fast-1/,
|
||||
},
|
||||
],
|
||||
id: "xAI",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue