Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

added mistral as a provider, updated model prices to the latest

Fixes #1587

Type of Change

  • New feature

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 12, 2025 3:34am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

Added comprehensive Mistral AI provider integration and updated model pricing across multiple providers.

Key Changes

  • Integrated Mistral AI with 10 models (mistral-large, magistral-medium, mistral-medium/small, open-mistral-nemo, codestral, ministral variants)
  • Added tool usage control support matching xAI implementation pattern
  • Updated pricing for Anthropic (added claude-sonnet-4-5, claude-opus-4-1), xAI (added grok-4-fast variants, grok-code-fast), Cerebras (added llama-4-scout), and Groq providers
  • Integrated provider across configuration, tokenization, and type system

Implementation Quality

The Mistral provider follows established patterns from xAI and OpenAI providers using OpenAI SDK with custom baseURL. Implementation includes:

  • Comprehensive tool calling with forced tool support
  • Streaming responses with usage tracking
  • Detailed timing metrics and iteration tracking
  • Proper error handling with timing metadata

Issues Found

  • Commit title has typo: "mistal" should be "mistral"
  • Uses @ts-ignore at line 552 (style issue per custom rules)

Confidence Score: 4/5

  • This PR is safe to merge with only minor style improvements needed
  • Score reflects solid implementation following established patterns with comprehensive testing coverage. The only issues are a typo in the commit title and one style violation using @ts-ignore. All core functionality is properly implemented with tool usage control, streaming, error handling, and proper integration across the codebase.
  • No files require special attention - all changes follow established patterns

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/providers/mistral/index.ts 4/5 New Mistral AI provider implementation with comprehensive tool handling, streaming support, and OpenAI-compatible API integration
apps/sim/providers/models.ts 4/5 Added Mistral provider definition with 10 models and updated pricing for Anthropic, xAI, Cerebras, and Groq providers
apps/sim/providers/types.ts 5/5 Added 'mistral' to ProviderId union type for type safety

Sequence Diagram

sequenceDiagram
    participant Client
    participant MistralProvider
    participant OpenAI_SDK
    participant Mistral_API
    participant ToolExecutor

    Client->>MistralProvider: executeRequest(request)
    MistralProvider->>MistralProvider: Prepare messages & tools
    MistralProvider->>MistralProvider: prepareToolsWithUsageControl()
    
    alt Streaming without tools
        MistralProvider->>OpenAI_SDK: chat.completions.create(stream=true)
        OpenAI_SDK->>Mistral_API: POST /v1/chat/completions
        Mistral_API-->>OpenAI_SDK: Stream chunks
        OpenAI_SDK-->>MistralProvider: Stream response
        MistralProvider-->>Client: ReadableStream
    else Non-streaming or with tools
        MistralProvider->>OpenAI_SDK: chat.completions.create()
        OpenAI_SDK->>Mistral_API: POST /v1/chat/completions
        Mistral_API-->>OpenAI_SDK: Response with tool_calls
        
        loop Tool calling iterations (max 10)
            MistralProvider->>MistralProvider: Process tool_calls
            loop For each tool_call
                MistralProvider->>ToolExecutor: executeTool(toolName, params)
                ToolExecutor-->>MistralProvider: Tool result
                MistralProvider->>MistralProvider: Track timing & results
            end
            MistralProvider->>OpenAI_SDK: chat.completions.create(with results)
            OpenAI_SDK->>Mistral_API: POST /v1/chat/completions
            Mistral_API-->>OpenAI_SDK: Next response
            alt Has more tool_calls
                MistralProvider->>MistralProvider: Continue loop
            else No more tool_calls
                MistralProvider->>MistralProvider: Exit loop
            end
        end
        
        alt Streaming final response
            MistralProvider->>OpenAI_SDK: chat.completions.create(stream=true)
            OpenAI_SDK->>Mistral_API: POST /v1/chat/completions
            Mistral_API-->>OpenAI_SDK: Stream final response
            OpenAI_SDK-->>MistralProvider: Stream
            MistralProvider-->>Client: StreamingExecution
        else Non-streaming final response
            MistralProvider-->>Client: ProviderResponse
        end
    end
Loading

7 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 3d34132 into staging Oct 12, 2025
4 checks passed
waleedlatif1 added a commit that referenced this pull request Oct 12, 2025
* feat(mistal): added mistral as a provider, updated model prices

* remove the ability for a block to reference its own outluts

* fixed order of responses for guardrails block
waleedlatif1 added a commit that referenced this pull request Oct 12, 2025
* feat(mistal): added mistral as a provider, updated model prices

* remove the ability for a block to reference its own outluts

* fixed order of responses for guardrails block
@waleedlatif1 waleedlatif1 mentioned this pull request Oct 12, 2025
10 tasks
waleedlatif1 added a commit that referenced this pull request Oct 12, 2025
* improvement(performance): remove unused source/target indices, add index on snapshot id (#1603)

* fix(blog): rename building to blogs with redirect (#1604)

* improvement(privacy-policy): updated privacy policy for google (#1602)

* updated privacy policy for google

* update terms, privacy, and emails to incl address and update verbiage

* feat(guardrails): added guardrails block/tools and docs (#1605)

* Adding guardrails block

* ack PR comments

* cleanup checkbox in dark mode

* cleanup

* fix supabase tools

* fix(inference-billing): fix inference billing when stream is true via API, add drag-and-drop functionality to deployed chat (#1606)

* fix(inference): fix inference billing when stream is true via API

* add drag-and-drop to deployed chat

* feat(mistal): added mistral as a provider, updated model prices (#1607)

* feat(mistal): added mistral as a provider, updated model prices

* remove the ability for a block to reference its own outluts

* fixed order of responses for guardrails block

* feat(versions): added the ability to rename deployment versions (#1610)

* fix(vulns): fix various vulnerabilities and enhanced code security (#1611)

* fix(vulns): fix SSRF vulnerabilities

* cleanup

* cleanup

* regen docs

* remove unused deps

* fix failing tests

* cleanup

* update deps

* regen bun lock
@waleedlatif1 waleedlatif1 deleted the feat/mistral branch October 13, 2025 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants