Skip to content

MistralConfig

Base classes

Name Children Inherits
BaseConverterConfig
docler_config.converter_configs
Base configuration for document converters.

⋔ Inheritance diagram

graph TD
  2951828035["converter_configs.MistralConfig"]
  2232753316["converter_configs.BaseConverterConfig"]
  1396724084["provider.ProviderConfig"]
  1261767679["main.BaseSettings"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  2232753316 --> 2951828035
  1396724084 --> 2232753316
  1261767679 --> 1396724084
  3879467795 --> 1261767679
  2751680898 --> 3879467795

🛈 DocStrings

Bases: BaseConverterConfig

Configuration for Mistral-based converter.

Source code in src/docler_config/converter_configs.py
class MistralConfig(BaseConverterConfig):
    """Configuration for Mistral-based converter."""

    type: Literal["mistral"] = Field("mistral", init=False)
    """Type discriminator for Mistral converter."""

    languages: set[SupportedLanguage] = Field(default_factory=default_languages)
    """List of supported languages for the converter."""

    api_key: SecretStr | None = None
    """Mistral API key. If None, will try env var MISTRAL_API_KEY."""

    model_config = SettingsConfigDict(env_prefix="MISTRAL_")

    # right now there only is one model
    # ocr_model: str = "mistral-ocr-latest"
    # """Mistral OCR model to use."""

    def get_provider(self) -> DocumentConverter:
        """Get the converter instance."""
        from docler.converters.mistral_provider import MistralConverter

        return MistralConverter(**self.get_config_fields())

api_key class-attribute instance-attribute

api_key: SecretStr | None = None

Mistral API key. If None, will try env var MISTRAL_API_KEY.

languages class-attribute instance-attribute

languages: set[SupportedLanguage] = Field(default_factory=default_languages)

List of supported languages for the converter.

type class-attribute instance-attribute

type: Literal['mistral'] = Field('mistral', init=False)

Type discriminator for Mistral converter.

get_provider

get_provider() -> DocumentConverter

Get the converter instance.

Source code in src/docler_config/converter_configs.py
def get_provider(self) -> DocumentConverter:
    """Get the converter instance."""
    from docler.converters.mistral_provider import MistralConverter

    return MistralConverter(**self.get_config_fields())

:fa-brands-github: Show source on GitHub