-
-
Notifications
You must be signed in to change notification settings - Fork 6
Update xAI model to Grok 4.3 (grok-latest) #582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Code Review Request: Update xAI Model to Grok 4.3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Changes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1. Updated `lib/utils/index.ts`: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Replaced `Grok 4.2` with `Grok 4.3` in switch cases and error messages. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Updated model identifier from `grok-4-fast-non-reasoning` to `grok-latest`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2. Updated `components/settings/components/settings.tsx`: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Updated default `selectedModel` to `Grok 4.3`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3. Updated `components/settings/components/model-selection-form.tsx`: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Updated `models` array entries from `Grok 4.2` to `Grok 4.3`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Verification: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Targetted unit tests in `lib/utils/index.test.ts` pass. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Syntax verification using `bun build` for all modified files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Verified no remaining occurrences of old model strings. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typo and heading spacing flagged by linters.
📝 Proposed fix # Code Review Request: Update xAI Model to Grok 4.3
## Changes:
+
1. Updated `lib/utils/index.ts`:
- Replaced `Grok 4.2` with `Grok 4.3` in switch cases and error messages.
- Updated model identifier from `grok-4-fast-non-reasoning` to `grok-latest`.
2. Updated `components/settings/components/settings.tsx`:
- Updated default `selectedModel` to `Grok 4.3`.
3. Updated `components/settings/components/model-selection-form.tsx`:
- Updated `models` array entries from `Grok 4.2` to `Grok 4.3`.
## Verification:
-- Targetted unit tests in `lib/utils/index.test.ts` pass.
+
+- Targeted unit tests in `lib/utils/index.test.ts` pass.
- Syntax verification using `bun build` for all modified files.
- Verified no remaining occurrences of old model strings.📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[grammar] ~12-~12: Ensure spelling is correct (QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1) 🪛 markdownlint-cli2 (0.22.1)[warning] 3-3: Headings should be surrounded by blank lines (MD022, blanks-around-headings) [warning] 12-12: Headings should be surrounded by blank lines (MD022, blanks-around-headings) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ export type SettingsFormValues = z.infer<typeof settingsFormSchema> | |
| const defaultValues: Partial<SettingsFormValues> = { | ||
| systemPrompt: | ||
| "You are a planetary copilot, an AI assistant designed to help users with information about planets, space exploration, and astronomy. Provide accurate, educational, and engaging responses about our solar system and beyond.", | ||
| selectedModel: "Grok 4.2", | ||
| selectedModel: "Grok 4.3", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Persisted user preferences for "Grok 4.2" are now orphaned — consider a migration or normalization. Existing users who previously saved
Options: (a) backfill stored values from 🤖 Prompt for AI Agents |
||
| users: [], | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,20 +34,20 @@ export async function getModel(requireVision: boolean = false) { | |||||||||||||
|
|
||||||||||||||
| if (selectedModel) { | ||||||||||||||
| switch (selectedModel) { | ||||||||||||||
| case 'Grok 4.2': | ||||||||||||||
| case 'Grok 4.3': | ||||||||||||||
| if (xaiApiKey) { | ||||||||||||||
| const xai = createXai({ | ||||||||||||||
| apiKey: xaiApiKey, | ||||||||||||||
| baseURL: 'https://api.x.ai/v1', | ||||||||||||||
| }); | ||||||||||||||
| try { | ||||||||||||||
| return xai('grok-4-fast-non-reasoning'); | ||||||||||||||
| return xai('grok-latest'); | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: No, the xAI API does not expose a "grok-latest" alias. "grok-4.3" is the primary public identifier for Grok 4.3, with model-specific aliases like "grok-4.3-latest" available according to official documentation [1][2]. The xAI docs describe a general alias pattern where specific models use "-latest" for the latest version of that model, and a blank alias for the latest stable version, but no source explicitly lists or confirms a generic "grok-latest" alias [1][3][2]. Examples for other models include "grok-4-latest" [4] and "grok-4.20-reasoning-latest" [5], following the per-model pattern. Secondary sources mention "grok-4.3-latest" specifically for Grok 4.3 [6]. API examples and model lists consistently use "grok-4.3" directly [7]. Citations:
Critical: xAI's official documentation at docs.x.ai/developers/models confirms that the canonical identifier for Grok 4.3 is Two consequences:
Use the documented identifier 🔧 Proposed fix case 'Grok 4.3':
if (xaiApiKey) {
const xai = createXai({
apiKey: xaiApiKey,
baseURL: 'https://api.x.ai/v1',
});
try {
- return xai('grok-latest');
+ return xai('grok-4.3');
} catch (error) {
console.error('Selected model "Grok 4.3" is configured but failed to initialize.', error);
throw new Error('Failed to initialize selected model.');
}
} else {
@@
if (xaiApiKey) {
const xai = createXai({
apiKey: xaiApiKey,
baseURL: 'https://api.x.ai/v1',
});
try {
- return xai('grok-latest');
+ return xai('grok-4.3');
} catch (error) {
console.warn('xAI API unavailable, falling back to next provider:');
}
}Also applies to: 88-88 🤖 Prompt for AI Agents |
||||||||||||||
| } catch (error) { | ||||||||||||||
| console.error('Selected model "Grok 4.2" is configured but failed to initialize.', error); | ||||||||||||||
| console.error('Selected model "Grok 4.3" is configured but failed to initialize.', error); | ||||||||||||||
| throw new Error('Failed to initialize selected model.'); | ||||||||||||||
| } | ||||||||||||||
| } else { | ||||||||||||||
| console.error('User selected "Grok 4.2" but XAI_API_KEY is not set.'); | ||||||||||||||
| console.error('User selected "Grok 4.3" but XAI_API_KEY is not set.'); | ||||||||||||||
| throw new Error('Selected model is not configured.'); | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+37
to
52
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Grok 4.2 ignored Existing users with a persisted selectedModel value of "Grok 4.2" will no longer match any case in getModel(), so their stored preference is silently ignored and the function falls back to the default provider order. The settings UI also won’t present "Grok 4.2" as an option anymore, but the form still treats the stale value as valid and can keep re-saving it unchanged. Agent Prompt
Comment on lines
38
to
52
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial | 💤 Low value Synchronous
The same observation applies to the 🤖 Prompt for AI Agents |
||||||||||||||
| case 'Gemini 3': | ||||||||||||||
|
|
@@ -85,7 +85,7 @@ export async function getModel(requireVision: boolean = false) { | |||||||||||||
| baseURL: 'https://api.x.ai/v1', | ||||||||||||||
| }); | ||||||||||||||
| try { | ||||||||||||||
| return xai('grok-4-fast-non-reasoning'); | ||||||||||||||
| return xai('grok-latest'); | ||||||||||||||
| } catch (error) { | ||||||||||||||
| console.warn('xAI API unavailable, falling back to next provider:'); | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
89
to
91
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fallback warn discards the caught error and is misleading.
📝 Suggested log fix- } catch (error) {
- console.warn('xAI API unavailable, falling back to next provider:');
- }
+ } catch (error) {
+ console.warn('xAI API unavailable, falling back to next provider:', error);
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The model identifier change documented here is wrong — see comment in
lib/utils/index.ts.This line documents switching from
grok-4-fast-non-reasoningtogrok-latest, butgrok-latestis not a documented xAI model id. Per xAI's official quickstart and models docs, the correct identifier for Grok 4.3 isgrok-4.3. Once the source change is corrected, please update this doc accordingly.🤖 Prompt for AI Agents