[PR #1090] [MERGED] feat(mistralai): Major model update #1716

Closed
opened 2026-02-16 10:23:46 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-official-plugins/pull/1090
Author: @Asterovim
Created: 6/14/2025
Status: Merged
Merged: 6/17/2025
Merged by: @crazywoola

Base: mainHead: main


📝 Commits (3)

  • 7cff8c6 feat(mistralai): add Mistral Embed model and update manifest files
  • c9d32f8 feat(mistralai): Major model update - remove deprecated models and add latest releases
  • 6949082 bump deps

📊 Changes

41 files changed (+2090 additions, -92 deletions)

View changed files

📝 models/mistralai/README.md (+72 -2)
📝 models/mistralai/manifest.yaml (+4 -4)
📝 models/mistralai/models/llm/_position.yaml (+25 -9)
📝 models/mistralai/models/llm/codestral-2501.yaml (+30 -8)
📝 models/mistralai/models/llm/codestral-latest.yaml (+29 -7)
models/mistralai/models/llm/devstral-small-2505.yaml (+73 -0)
models/mistralai/models/llm/devstral-small-latest.yaml (+73 -0)
📝 models/mistralai/models/llm/llm.py (+18 -0)
models/mistralai/models/llm/magistral-medium-2506.yaml (+86 -0)
models/mistralai/models/llm/magistral-medium-latest.yaml (+86 -0)
models/mistralai/models/llm/magistral-small-2506.yaml (+86 -0)
models/mistralai/models/llm/magistral-small-latest.yaml (+86 -0)
models/mistralai/models/llm/mathstral.yaml (+69 -0)
models/mistralai/models/llm/ministral-3b-2410.yaml (+73 -0)
models/mistralai/models/llm/ministral-3b-latest.yaml (+73 -0)
📝 models/mistralai/models/llm/ministral-8b-2410.yaml (+30 -8)
models/mistralai/models/llm/ministral-8b-latest.yaml (+73 -0)
📝 models/mistralai/models/llm/mistral-large-2411.yaml (+30 -8)
📝 models/mistralai/models/llm/mistral-large-latest.yaml (+29 -7)
models/mistralai/models/llm/mistral-medium-2505.yaml (+73 -0)

...and 21 more files

📄 Description

Related Issues or Context

This PR fixes the MistralAI text embedding model implementation that was incorrectly classified and had API compatibility issues. The mistral-embed model was previously classified as an LLM instead of a text embedding model, and the implementation had several technical issues preventing proper functionality.

fix https://github.com/langgenius/dify-official-plugins/issues/419
Issues resolved:

  • Model misclassification causing it to appear in LLM section instead of embedding models
  • API 422 "Unprocessable Entity" errors due to unsupported user parameter
  • JSON unmarshaling errors due to incorrect return type in get_num_tokens method
  • Timeout issues during embedding operations

This PR contains Changes to Non-Plugin

  • Documentation
  • Other

This PR contains Changes to Non-LLM Models Plugin

  • I have Run Comprehensive Tests Relevant to My Changes

Testing performed:

  • Model correctly appears in text embedding section
  • Successful document indexing with PDF files
  • Embedding generation working without API errors
  • Token counting functionality working properly
  • No more 422 or timeout errors in logs

Screenshots/Evidence:

  • Plugin logs show successful embedding operations with 200 OK responses
  • Document indexing completes successfully
  • Token counting operations execute in ~2ms
  • Embedding operations complete in ~200ms (normal for Mistral API)

This PR contains Changes to LLM Models Plugin

  • My Changes Affect Message Flow Handling (System Messages and User→Assistant Turn-Taking)
  • My Changes Affect Tool Interaction Flow (Multi-Round Usage and Output Handling, for both Agent App and Agent Node)
  • My Changes Affect Multimodal Input Handling (Images, PDFs, Audio, Video, etc.)
  • My Changes Affect Multimodal Output Generation (Images, Audio, Video, etc.)
  • My Changes Affect Structured Output Format (JSON, XML, etc.)
  • My Changes Affect Token Consumption Metrics
  • My Changes Affect Other LLM Functionalities (Reasoning Process, Grounding, Prompt Caching, etc.)
  • Other Changes (Add New Models, Fix Model Parameters etc.)

Version Control (Any Changes to the Plugin Will Require Bumping the Version)

  • I have Bumped Up the Version in Manifest.yaml (Top-Level Version Field, Not in Meta Section)

Version updated: 0.0.1 → 0.0.3 (PATCH increments for bug fixes and improvements)

Dify Plugin SDK Version

  • I'm Using dify_plugin>=0.3.0,<0.4.0 in requirements.txt (SDK docs)

Environment Verification (If Any Code Changes)

Local Deployment Environment

  • Dify Version is: Latest (Docker deployment), I have Tested My Changes on Local Deployment Dify with a Clean Environment That Matches the Production Configuration.

Technical changes made:

  1. Model Classification Fix: Moved mistral-embed from LLM to text embedding model type
  2. API Implementation: Replaced OAICompatEmbeddingModel with direct TextEmbeddingModel implementation to avoid unsupported parameters
  3. Request Format: Implemented proper Mistral API request format without user parameter
  4. Return Type Fix: Changed get_num_tokens return type from int to list[int] to match expected format
  5. Error Handling: Added comprehensive error handling for 401, 429, 500+ status codes
  6. Pricing: Implemented correct pricing calculation ($0.1 per 1M tokens)

SaaS Environment

  • I have Tested My Changes on cloud.dify.ai with a Clean Environment That Matches the Production Configuration

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-official-plugins/pull/1090 **Author:** [@Asterovim](https://github.com/Asterovim) **Created:** 6/14/2025 **Status:** ✅ Merged **Merged:** 6/17/2025 **Merged by:** [@crazywoola](https://github.com/crazywoola) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`7cff8c6`](https://github.com/langgenius/dify-official-plugins/commit/7cff8c60d70fc4e58aba4da92fa257ff6501ac31) feat(mistralai): add Mistral Embed model and update manifest files - [`c9d32f8`](https://github.com/langgenius/dify-official-plugins/commit/c9d32f8c6a982c67d4d4c09c3e27cb539f35b78f) feat(mistralai): Major model update - remove deprecated models and add latest releases - [`6949082`](https://github.com/langgenius/dify-official-plugins/commit/6949082d5d188ed32338bf632e63a62be84e9139) bump deps ### 📊 Changes **41 files changed** (+2090 additions, -92 deletions) <details> <summary>View changed files</summary> 📝 `models/mistralai/README.md` (+72 -2) 📝 `models/mistralai/manifest.yaml` (+4 -4) 📝 `models/mistralai/models/llm/_position.yaml` (+25 -9) 📝 `models/mistralai/models/llm/codestral-2501.yaml` (+30 -8) 📝 `models/mistralai/models/llm/codestral-latest.yaml` (+29 -7) ➕ `models/mistralai/models/llm/devstral-small-2505.yaml` (+73 -0) ➕ `models/mistralai/models/llm/devstral-small-latest.yaml` (+73 -0) 📝 `models/mistralai/models/llm/llm.py` (+18 -0) ➕ `models/mistralai/models/llm/magistral-medium-2506.yaml` (+86 -0) ➕ `models/mistralai/models/llm/magistral-medium-latest.yaml` (+86 -0) ➕ `models/mistralai/models/llm/magistral-small-2506.yaml` (+86 -0) ➕ `models/mistralai/models/llm/magistral-small-latest.yaml` (+86 -0) ➕ `models/mistralai/models/llm/mathstral.yaml` (+69 -0) ➕ `models/mistralai/models/llm/ministral-3b-2410.yaml` (+73 -0) ➕ `models/mistralai/models/llm/ministral-3b-latest.yaml` (+73 -0) 📝 `models/mistralai/models/llm/ministral-8b-2410.yaml` (+30 -8) ➕ `models/mistralai/models/llm/ministral-8b-latest.yaml` (+73 -0) 📝 `models/mistralai/models/llm/mistral-large-2411.yaml` (+30 -8) 📝 `models/mistralai/models/llm/mistral-large-latest.yaml` (+29 -7) ➕ `models/mistralai/models/llm/mistral-medium-2505.yaml` (+73 -0) _...and 21 more files_ </details> ### 📄 Description ## Related Issues or Context This PR fixes the MistralAI text embedding model implementation that was incorrectly classified and had API compatibility issues. The `mistral-embed` model was previously classified as an LLM instead of a text embedding model, and the implementation had several technical issues preventing proper functionality. fix https://github.com/langgenius/dify-official-plugins/issues/419 **Issues resolved:** - Model misclassification causing it to appear in LLM section instead of embedding models - API 422 "Unprocessable Entity" errors due to unsupported `user` parameter - JSON unmarshaling errors due to incorrect return type in `get_num_tokens` method - Timeout issues during embedding operations ## This PR contains Changes to *Non-Plugin* - [ ] Documentation - [ ] Other ## This PR contains Changes to *Non-LLM Models Plugin* - [x] I have Run Comprehensive Tests Relevant to My Changes **Testing performed:** - ✅ Model correctly appears in text embedding section - ✅ Successful document indexing with PDF files - ✅ Embedding generation working without API errors - ✅ Token counting functionality working properly - ✅ No more 422 or timeout errors in logs **Screenshots/Evidence:** - Plugin logs show successful embedding operations with 200 OK responses - Document indexing completes successfully - Token counting operations execute in ~2ms - Embedding operations complete in ~200ms (normal for Mistral API) ## This PR contains Changes to *LLM Models Plugin* - [ ] My Changes Affect Message Flow Handling (System Messages and User→Assistant Turn-Taking) - [ ] My Changes Affect Tool Interaction Flow (Multi-Round Usage and Output Handling, for both Agent App and Agent Node) - [ ] My Changes Affect Multimodal Input Handling (Images, PDFs, Audio, Video, etc.) - [ ] My Changes Affect Multimodal Output Generation (Images, Audio, Video, etc.) - [ ] My Changes Affect Structured Output Format (JSON, XML, etc.) - [ ] My Changes Affect Token Consumption Metrics - [ ] My Changes Affect Other LLM Functionalities (Reasoning Process, Grounding, Prompt Caching, etc.) - [ ] Other Changes (Add New Models, Fix Model Parameters etc.) ## Version Control (Any Changes to the Plugin Will Require Bumping the Version) - [x] I have Bumped Up the Version in Manifest.yaml (Top-Level `Version` Field, Not in Meta Section) **Version updated:** 0.0.1 → 0.0.3 (PATCH increments for bug fixes and improvements) ## Dify Plugin SDK Version - [x] I'm Using `dify_plugin>=0.3.0,<0.4.0` in requirements.txt ([SDK docs](https://github.com/langgenius/dify-plugin-sdks/blob/main/python/README.md)) ## Environment Verification (If Any Code Changes) ### Local Deployment Environment - [x] Dify Version is: Latest (Docker deployment), I have Tested My Changes on Local Deployment Dify with a Clean Environment That Matches the Production Configuration. **Technical changes made:** 1. **Model Classification Fix:** Moved `mistral-embed` from LLM to text embedding model type 2. **API Implementation:** Replaced `OAICompatEmbeddingModel` with direct `TextEmbeddingModel` implementation to avoid unsupported parameters 3. **Request Format:** Implemented proper Mistral API request format without `user` parameter 4. **Return Type Fix:** Changed `get_num_tokens` return type from `int` to `list[int]` to match expected format 5. **Error Handling:** Added comprehensive error handling for 401, 429, 500+ status codes 6. **Pricing:** Implemented correct pricing calculation ($0.1 per 1M tokens) ### SaaS Environment - [x] I have Tested My Changes on cloud.dify.ai with a Clean Environment That Matches the Production Configuration --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 10:23:46 -05:00
yindo closed this issue 2026-02-16 10:23:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#1716