- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.3k
feat(mistal): added mistral as a provider, updated model prices #1607
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
Conversation
| The latest updates on your projects. Learn more about Vercel for GitHub. | 
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.
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-ignoreat 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
    7 files reviewed, 1 comment
* 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(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
* 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
Summary
added mistral as a provider, updated model prices to the latest
Fixes #1587
Type of Change
Testing
Tested manually.
Checklist