# `LangChain.ChatModels.ChatMistralAI`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L1)

# `t`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L80)

```elixir
@type t() :: %LangChain.ChatModels.ChatMistralAI{
  api_key: term(),
  callbacks: term(),
  endpoint: term(),
  json_response: term(),
  json_schema: term(),
  max_tokens: term(),
  model: term(),
  parallel_tool_calls: term(),
  random_seed: term(),
  receive_timeout: term(),
  retry_count: term(),
  safe_prompt: term(),
  stream: term(),
  temperature: term(),
  tool_choice: term(),
  top_p: term(),
  verbose_api: term()
}
```

# `call`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L353)

Calls the Mistral API passing the ChatMistralAI struct plus either a simple string
prompt or a list of messages as the prompt. Optionally pass in a list of tools.

# `for_api`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L233)

```elixir
@spec for_api(
  struct(),
  LangChain.Message.t()
  | LangChain.Message.ContentPart.t()
  | LangChain.Message.ToolCall.t()
  | LangChain.Message.ToolResult.t()
  | LangChain.Function.t()
) :: %{required(String.t()) =&gt; any()} | [%{required(String.t()) =&gt; any()}]
```

Converts a LangChain Message-based structure into the expected map of data for
Mistral. We also include any `tool_calls` stored on the message.

# `for_api`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L138)

```elixir
@spec for_api(t(), [LangChain.Message.t()], LangChain.ChatModels.ChatModel.tools()) ::
  %{
    required(atom()) =&gt; any()
  }
```

Formats this struct plus the given messages and tools as a request payload.

# `new`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L111)

```elixir
@spec new(attrs :: map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
```

# `new!`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L119)

```elixir
@spec new!(attrs :: map()) :: t() | no_return()
```

# `restore_from_map`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L902)

Restores the model from the config map.

# `retry_on_fallback?`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L863)

```elixir
@spec retry_on_fallback?(LangChain.LangChainError.t()) :: boolean()
```

Determine if an error should be retried. If `true`, a fallback LLM may be
used. If `false`, the error is understood to be more fundamental with the
request rather than a service issue and it should not be retried or fallback
to another service.

# `serialize_config`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.14/lib/chat_models/chat_mistral_ai.ex#L877)

```elixir
@spec serialize_config(t()) :: %{required(String.t()) =&gt; any()}
```

Generate a config map that can later restore the model's configuration.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
