Skip to content

Update XAI model #581

Closed
Closed

Description

@ngoiyaeric

The codebase needs an update to the XAI model to the recent release grok 4.3 alias 'grok-latest'

Activity

  1. ngoiyaeric commented on May 6, 2026

    @ngoiyaeric
    CollaboratorAuthor
  2. coderabbitai commented on May 6, 2026

    @coderabbitai
    Contributor

    Coding Plan

    Summary

    • This is a functional migration, not just a cosmetic rename—requires investigation of behavioral differences and validation of continued functionality
    • Phase 1 establishes understanding of grok-latest capabilities, multi-modal support status, and tool calling compatibility before making changes
    • The API model identifier changes from grok-4-fast-non-reasoning to grok-latest (xAI's rolling alias for the latest Grok model)
    • Phase 3 validates that text generation, tool execution, and multi-modal handling all function correctly after the migration
    • The existing @ai-sdk/xai SDK and API endpoint remain unchanged as they support the new model alias
    Design Choices
    Design Choice 1: Rolling Alias Behavior

    Options Considered:

    1. Use grok-latest alias for automatic updates to newest model
    2. Use a pinned model identifier (e.g., grok-4.3-<date>) for reproducibility

    Chosen Option: 1

    Rationale: The ticket explicitly requests using grok-latest, accepting that behavior may evolve as xAI updates the alias target.

    💡 User Tips

    Regenerate the plan with different choices with @coderabbitai <feedback>.

    Implementation Steps

    Phase 1: Compatibility Investigation & Diagnosis

    Before making changes, investigate and document differences between the current grok-4-fast-non-reasoning model and grok-latest that could affect functionality, and diagnose the state of multi-modal support.

    Task 1: Analyze Inference Behavior Differences

    Investigate response format and inference behavior differences between the current model and grok-latest.

    • Review xAI API documentation for the grok-latest alias to understand what model it currently references
    • Determine if grok-latest is a rolling alias (updates automatically) vs a fixed model version
    • Document any changes in response format, streaming behavior, or token limits between models
    • Note any differences in error responses, rate limiting, or API behavior
    Task 2: Diagnose Multi-Modal Support Status

    Assess the current state of multi-modal/vision support and determine if changes are needed for grok-latest.

    • In lib/utils/index.ts, examine the unused requireVision parameter in getModel() to understand the gap between intent and implementation
    • Check xAI documentation to determine if grok-latest supports vision/image inputs natively
    • Review image detection logic in lib/agents/researcher.tsx (lines 108-111) and lib/agents/resolution-search.tsx (lines 175-179) to understand current multi-modal expectations
    • Document whether existing image handling will function correctly with grok-latest or if the unused requireVision parameter needs implementation
    • If grok-latest requires explicit vision model variant selection, identify the necessary changes to getModel()
    Task 3: Verify Tool Calling Compatibility

    Verify that existing tool definitions and response parsing work with grok-latest.

    • Review xAI documentation for tool calling format requirements with grok-latest
    • Confirm compatibility with existing tools defined in lib/agents/tools/index.tsx (search, retrieve, geospatialQueryTool, videoSearch)
    • Verify the fullStream delta types (text-delta, tool-call, tool-result) in lib/agents/researcher.tsx will parse correctly
    • Identify any schema or format adjustments needed for tool definitions
    🤖 Prompt for AI agents
    This is an investigation and documentation phase — no code changes are made yet.
    The goal is to research and record findings about `grok-latest` before updating
    anything.
    
    - Review xAI API documentation for the `grok-latest` alias to determine what
    underlying model it references and whether it is a rolling alias
    - Document differences in response format, streaming behavior, token limits,
    error responses, and rate limiting between `grok-4-fast-non-reasoning` and
    `grok-latest`
    - In `lib/utils/index.ts`, examine the unused `requireVision` parameter in
    `getModel()` and cross-reference with image detection logic in
    `lib/agents/researcher.tsx` (lines 108-111) and
    `lib/agents/resolution-search.tsx` (lines 175-179) to understand the gap between
    intent and implementation
    - Check xAI documentation to confirm whether `grok-latest` supports vision/image
    inputs natively and whether explicit vision model variant selection is needed
    - Review tool calling format requirements for `grok-latest` and verify
    compatibility with tools in `lib/agents/tools/index.tsx` (`search`, `retrieve`,
    `geospatialQueryTool`, `videoSearch`)
    - Verify `fullStream` delta types (`text-delta`, `tool-call`, `tool-result`) in
    `lib/agents/researcher.tsx` will parse correctly with `grok-latest`
    - Capture all findings to inform implementation decisions in Phase 2 (especially
    conditional multi-modal changes)
    

    Phase 2: Update XAI Model References

    Update all hardcoded Grok model identifiers and display names across the codebase to reflect the new Grok 4.3 release.

    Task 1: Update Core Model Provider Logic

    Update the model provider utility to use the new Grok 4.3 model identifier.

    • In lib/utils/index.ts, change the switch case label from 'Grok 4.2' to 'Grok 4.3'
    • Update both occurrences of the API model identifier from 'grok-4-fast-non-reasoning' to 'grok-latest' (user-selected path ~line 44, default fallback ~line 88)
    • Update the fallback chain comment from "Grok" to "Grok 4.3" for clarity (~line 81)
    • Update error and warning message strings that reference "Grok 4.2" to "Grok 4.3" (~lines 46, 50)
    • If Phase 1 findings indicate multi-modal support changes are needed, implement the requireVision parameter handling for the xAI case
    Task 2: Update UI Model Selection Options

    Update the settings UI to display the new model name and appropriate description.

    • In components/settings/components/model-selection-form.tsx, update the model entry in the models array:
      • Change id from "Grok 4.2" to "Grok 4.3"
      • Change name from "Grok 4.2" to "Grok 4.3"
      • Update the description text to reflect Grok 4.3 (e.g., "The latest from xAI featuring Grok 4.3...")
      • Consider updating the badge from "New" to "Updated" or keeping it as "New" to highlight the upgrade
    🤖 Prompt for AI agents
    Update all hardcoded Grok model identifiers and display names across the
    codebase to reflect the new Grok 4.3 release. Apply changes based on the
    findings from Phase 1, particularly for any multi-modal support adjustments.
    
    **`lib/utils/index.ts`**
    - Change the switch case label from `'Grok 4.2'` to `'Grok 4.3'`
    - Update both occurrences of the API model identifier from
    `'grok-4-fast-non-reasoning'` to `'grok-latest'` (user-selected path ~line 44,
    default fallback ~line 88)
    - Update the fallback chain comment from "Grok" to "Grok 4.3" for clarity (~line
    81)
    - Update error and warning message strings that reference "Grok 4.2" to "Grok
    4.3" (~lines 46, 50)
    - If Phase 1 findings indicate multi-modal support changes are needed, implement
    the `requireVision` parameter handling for the xAI case in `getModel()`
    
    **`components/settings/components/model-selection-form.tsx`**
    - In the `models` array, update the Grok model entry:
      - Change `id` from `"Grok 4.2"` to `"Grok 4.3"`
      - Change `name` from `"Grok 4.2"` to `"Grok 4.3"`
    - Update the `description` text to reflect Grok 4.3 (e.g., "The latest from xAI
    featuring Grok 4.3...")
    - Consider updating the `badge` from `"New"` to `"Updated"` or keeping it as
    `"New"` to highlight the upgrade
    

    Phase 3: End-to-End Validation

    Test the updated model integration to ensure all functionality is preserved and working correctly with grok-latest.

    Task 1: Validate Basic Text Generation

    Verify core text generation functionality works correctly with the updated model.

    • Test text-only prompts through the researcher agent pipeline
    • Verify streaming responses render correctly in the UI via streamText.update()
    • Confirm response format and content quality matches expected output structure
    • Test error handling when XAI_API_KEY is missing or invalid
    Task 2: Validate Tool Execution

    Test that all tool calling functionality works correctly with grok-latest.

    • Test search tool invocation and verify results are correctly parsed from tool-result deltas
    • Verify retrieve tool functionality for fetching and processing web content
    • Test geospatialQueryTool with appropriate geospatial prompts
    • If videoSearch is enabled, verify video search tool execution
    • Confirm tool results are correctly incorporated into assistant messages
    Task 3: Validate Multi-Modal Inputs

    Test image handling behavior with the updated model.

    • Test messages containing images through lib/agents/researcher.tsx pipeline
    • Verify the model either processes images correctly or gracefully handles them based on Phase 1 findings
    • Test the satellite image analysis flow in lib/agents/resolution-search.tsx with streamObject
    • Document any limitations or behavioral differences in multi-modal support compared to the previous model
    🤖 Prompt for AI agents
    This is a validation phase to confirm the updated `grok-latest` integration
    works end-to-end. No new code changes are expected unless issues are uncovered
    during testing.
    
    - Test text-only prompts through the researcher agent pipeline and verify
    streaming responses render correctly in the UI via `streamText.update()`
    - Confirm response format and content quality matches expected output structure
    - Test error handling when `XAI_API_KEY` is missing or invalid
    - Test search tool invocation and verify results are correctly parsed from
    `tool-result` deltas; verify retrieve, geospatialQueryTool, and (if enabled)
    videoSearch tool execution
    - Confirm tool results are correctly incorporated into assistant messages
    - Test messages containing images through the `lib/agents/researcher.tsx`
    pipeline and the satellite image analysis flow in
    `lib/agents/resolution-search.tsx` with `streamObject`
    - Verify image inputs are either processed correctly or handled gracefully based
    on Phase 1 findings
    - Document any limitations or behavioral differences in multi-modal support
    compared to the previous model
    
    Research

    The XAI/Grok model integration is centralized across three files: lib/utils/index.ts handles the core model provider logic including SDK initialization and API model identifier usage; components/settings/components/model-selection-form.tsx defines the user-facing model options in the settings UI; and components/settings/components/settings.tsx sets the default selected model. The application uses the @ai-sdk/xai SDK to communicate with the xAI API at https://api.x.ai/v1. Notably, the getModel() function accepts a requireVision parameter that is currently unused, despite callers detecting image content. All model identifier strings are hardcoded and require manual updates when changing versions.


    🚀 Next Steps

    🤖 All AI agent prompts combined
    Task: 1
    
    This is an investigation and documentation phase — no code changes are made yet.
    The goal is to research and record findings about `grok-latest` before updating
    anything.
    
    - Review xAI API documentation for the `grok-latest` alias to determine what
    underlying model it references and whether it is a rolling alias
    - Document differences in response format, streaming behavior, token limits,
    error responses, and rate limiting between `grok-4-fast-non-reasoning` and
    `grok-latest`
    - In `lib/utils/index.ts`, examine the unused `requireVision` parameter in
    `getModel()` and cross-reference with image detection logic in
    `lib/agents/researcher.tsx` (lines 108-111) and
    `lib/agents/resolution-search.tsx` (lines 175-179) to understand the gap between
    intent and implementation
    - Check xAI documentation to confirm whether `grok-latest` supports vision/image
    inputs natively and whether explicit vision model variant selection is needed
    - Review tool calling format requirements for `grok-latest` and verify
    compatibility with tools in `lib/agents/tools/index.tsx` (`search`, `retrieve`,
    `geospatialQueryTool`, `videoSearch`)
    - Verify `fullStream` delta types (`text-delta`, `tool-call`, `tool-result`) in
    `lib/agents/researcher.tsx` will parse correctly with `grok-latest`
    - Capture all findings to inform implementation decisions in Phase 2 (especially
    conditional multi-modal changes)
    ===============================================================================
    
    Task: 2
    
    Update all hardcoded Grok model identifiers and display names across the
    codebase to reflect the new Grok 4.3 release. Apply changes based on the
    findings from Phase 1, particularly for any multi-modal support adjustments.
    
    **`lib/utils/index.ts`**
    - Change the switch case label from `'Grok 4.2'` to `'Grok 4.3'`
    - Update both occurrences of the API model identifier from
    `'grok-4-fast-non-reasoning'` to `'grok-latest'` (user-selected path ~line 44,
    default fallback ~line 88)
    - Update the fallback chain comment from "Grok" to "Grok 4.3" for clarity (~line
    81)
    - Update error and warning message strings that reference "Grok 4.2" to "Grok
    4.3" (~lines 46, 50)
    - If Phase 1 findings indicate multi-modal support changes are needed, implement
    the `requireVision` parameter handling for the xAI case in `getModel()`
    
    **`components/settings/components/model-selection-form.tsx`**
    - In the `models` array, update the Grok model entry:
      - Change `id` from `"Grok 4.2"` to `"Grok 4.3"`
      - Change `name` from `"Grok 4.2"` to `"Grok 4.3"`
    - Update the `description` text to reflect Grok 4.3 (e.g., "The latest from xAI
    featuring Grok 4.3...")
    - Consider updating the `badge` from `"New"` to `"Updated"` or keeping it as
    `"New"` to highlight the upgrade
    ===============================================================================
    
    Task: 3
    
    This is a validation phase to confirm the updated `grok-latest` integration
    works end-to-end. No new code changes are expected unless issues are uncovered
    during testing.
    
    - Test text-only prompts through the researcher agent pipeline and verify
    streaming responses render correctly in the UI via `streamText.update()`
    - Confirm response format and content quality matches expected output structure
    - Test error handling when `XAI_API_KEY` is missing or invalid
    - Test search tool invocation and verify results are correctly parsed from
    `tool-result` deltas; verify retrieve, geospatialQueryTool, and (if enabled)
    videoSearch tool execution
    - Confirm tool results are correctly incorporated into assistant messages
    - Test messages containing images through the `lib/agents/researcher.tsx`
    pipeline and the satellite image analysis flow in
    `lib/agents/resolution-search.tsx` with `streamObject`
    - Verify image inputs are either processed correctly or handled gracefully based
    on Phase 1 findings
    - Document any limitations or behavioral differences in multi-modal support
    compared to the previous model
    
    💡 Iterate on the plan with: @coderabbitai <feedback>
    Example Feedback
    - @coderabbitai You can skip phase 3. Add a simple unit test case for phase 2.
    - @coderabbitai For design choice 1 go ahead with option 3 and replan.
    

    💬 Have feedback or questions? Drop into our discord!

  3. ngoiyaeric commented on May 26, 2026

    @ngoiyaeric
    CollaboratorAuthor

    @coderabbitai plan latest model does not inference responses as the old 4.1 model. No multi-modal features are functional.

  4. coderabbitai commented on May 26, 2026

    @coderabbitai
    Contributor

    I've updated the plan above based on your feedback. Ready to proceed when you are!

  5. added 3 commits that reference this issue on May 26, 2026
    90c15b8
    e2f83b1
    5bd0143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions