Skip to content

# `mistral_common.exceptions`

## `InvalidAssistantMessageException(message)`

Bases: `MistralCommonException`

Exception raised for invalid assistant messages.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    88
    89
    90
    91
    92
    93
    94

    def __init__(self, message: str) -> None:
        r"""Initialize the `InvalidAssistantMessageException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)

## `InvalidFunctionCallException(message)`

Bases: `MistralCommonException`

Exception raised for invalid function calls.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    136
    137
    138
    139
    140
    141
    142

    def __init__(self, message: str) -> None:
        r"""Initialize the `InvalidFunctionCallException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)

## `InvalidMessageStructureException(message)`

Bases: `MistralCommonException`

Exception raised for invalid message structures.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    76
    77
    78
    79
    80
    81
    82

    def __init__(self, message: str) -> None:
        r"""Initialize the `InvalidMessageStructureException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)

## `InvalidRequestException(message)`

Bases: `MistralCommonException`

Exception raised for invalid requests.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    52
    53
    54
    55
    56
    57
    58

    def __init__(self, message: str) -> None:
        r"""Initialize the `InvalidRequestException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)

## `InvalidSystemPromptException(message)`

Bases: `MistralCommonException`

Exception raised for invalid system prompts.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    64
    65
    66
    67
    68
    69
    70

    def __init__(self, message: str) -> None:
        r"""Initialize the `InvalidSystemPromptException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)

## `InvalidToolException(message)`

Bases: `MistralCommonException`

Exception raised for invalid tools.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    148
    149
    150
    151
    152
    153
    154

    def __init__(self, message: str) -> None:
        r"""Initialize the `InvalidToolException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)

## `InvalidToolMessageException(message)`

Bases: `MistralCommonException`

Exception raised for invalid tool messages.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    100
    101
    102
    103
    104
    105
    106

    def __init__(self, message: str) -> None:
        r"""Initialize the `InvalidToolMessageException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)

## `InvalidToolSchemaException(message)`

Bases: `MistralCommonException`

Exception raised for invalid tool schemas.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    112
    113
    114
    115
    116
    117
    118

    def __init__(self, message: str) -> None:
        r"""Initialize the `InvalidToolSchemaException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)

## `InvalidUserMessageException(message)`

Bases: `MistralCommonException`

Exception raised for invalid user messages.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    124
    125
    126
    127
    128
    129
    130

    def __init__(self, message: str) -> None:
        r"""Initialize the `InvalidUserMessageException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)

## `MistralCommonException(message=None)`

Bases: `Exception`

Base class for all Mistral exceptions.

Attributes:

Name | Type | Description
--- | --- | ---
`message` | `str` | A human-readable message describing the error.

If no message is provided, the default message is used.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str | None` | A human-readable message describing the error. | `None`

Source code in `src/mistral_common/exceptions.py`

    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22

    def __init__(
        self,
        message: str | None = None,
    ) -> None:
        r"""Initialize the `MistralCommonException` with an optional message.

        If no message is provided, the default message is used.

        Args:
           message: A human-readable message describing the error.
        """
        if message:
            self.message = message

## `TokenizerException(message)`

Bases: `MistralCommonException`

Exception raised for errors in the tokenizer.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    28
    29
    30
    31
    32
    33
    34

    def __init__(self, message: str) -> None:
        r"""Initialize the `TokenizerException` with a message.

        Args:
          message: A human-readable message describing the error.
        """
        super().__init__(message)

## `UnsupportedTokenizerFeatureException(message)`

Bases: `MistralCommonException`

Exception raised for unsupported features in the tokenizer.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`message` | `str` | A human-readable message describing the error. | required

Source code in `src/mistral_common/exceptions.py`

    40
    41
    42
    43
    44
    45
    46

    def __init__(self, message: str) -> None:
        r"""Initialize the `UnsupportedTokenizerFeatureException` with a message.

        Args:
           message: A human-readable message describing the error.
        """
        super().__init__(message)