mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-07-03 14:05:26 +02:00
32 lines
963 B
Python
32 lines
963 B
Python
"""Mistral La Plateforme provider implementation (OpenAI-compatible chat completions)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from providers.base import ProviderConfig
|
|
from providers.defaults import MISTRAL_DEFAULT_BASE
|
|
from providers.openai_compat import OpenAIChatTransport
|
|
|
|
from .request import build_request_body
|
|
|
|
|
|
class MistralProvider(OpenAIChatTransport):
|
|
"""Mistral API using ``https://api.mistral.ai/v1/chat/completions``."""
|
|
|
|
def __init__(self, config: ProviderConfig):
|
|
super().__init__(
|
|
config,
|
|
provider_name="MISTRAL",
|
|
base_url=config.base_url or MISTRAL_DEFAULT_BASE,
|
|
api_key=config.api_key,
|
|
)
|
|
|
|
def _build_request_body(
|
|
self, request: Any, thinking_enabled: bool | None = None
|
|
) -> dict:
|
|
return build_request_body(
|
|
request,
|
|
thinking_enabled=self._is_thinking_enabled(request, thinking_enabled),
|
|
)
|