Fix Mistral-Thinker

function

Adds <think> tag and thinking guide for Mistral-Thinker

praul2
@praul2
·
2 years ago
86
0
663
Updated 2 years ago
Created Mar 5, 2025
fix_mistral_thinker.py
Python · 69 lines
"""
Mistral-Thinker needs this hack to properly initiate the thinking process.
- The filter adds a think-tag by default.
- It attempts to prevent repeated insertion, but this works with moderate success.
- Since Mistral-Thinker doesn't respect system prompts very well, the filter converts the chat's system prompt into a user input.
- The filter can also be used to influence Mistral's thinking process. To do this, change the valve think_guide to a sentence that guides the beginning of the thinking process.
- Example valve setting for this: 'Okay, ich antworte auf deutsch.' to make Mistral-Thinker respond in german
"""

from pydantic import BaseModel, Field
from typing import Optional, Dict, Any, List

Adds tag and thinking guide for Mistral-Thinker


0