# How to implement Mistral with Embeddings

**URL:** https://meta.discourse.org/t/how-to-implement-mistral-with-embeddings/361095
**Category:** Support
**Tags:** ai, related-topics
**Created:** [April 9, 2025, 3:36pm UTC](https://meta.discourse.org/t/how-to-implement-mistral-with-embeddings/361095 "2025-04-09T15:36:33Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [April 9, 2025, 3:36pm UTC](https://meta.discourse.org/t/how-to-implement-mistral-with-embeddings/361095/1 "2025-04-09T15:36:33Z")

</div>

> [@Concerns over personal privacy with the AI plugin](https://meta.discourse.org/t/concerns-over-personal-privacy-with-the-ai-plugin/361068/3):
>
> Discourse AI was built agnostic from AI providers since day one, so the admins can pick an AI provider that they trust with the data

I’ve been struggling to set up Embeddings with Mistral AI, I suspect because Mistral requires a model to be passed. Do you know whether this is possible (and if so, how), or what should be done to make it possible?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 9, 2025, 3:42pm UTC](https://meta.discourse.org/t/how-to-implement-mistral-with-embeddings/361095/2 "2025-04-09T15:42:24Z")

</div>

Try setting `mistral-embed` in the “Model name” field, that appears after you select “Provider” as OpenAI.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [April 10, 2025, 6:32pm UTC](https://meta.discourse.org/t/how-to-implement-mistral-with-embeddings/361095/3 "2025-04-10T18:32:00Z")

</div>

Thanks, that works 👍

I’m struggling to find out what would be the best tokenizer to use for this use case though. The Mixtral tokenizer is not selectable here. Do you have any suggestions?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 10, 2025, 7:00pm UTC](https://meta.discourse.org/t/how-to-implement-mistral-with-embeddings/361095/4 "2025-04-10T19:00:10Z")

</div>

Your post above token length according to some tokenizers:

OpenAI: 45  
Mixtral: 52  
Gemini: 47  
E5: 50  
bge-large-en: 49  
bge-m3: 50  
mpnet: 49

Looks like Mistral-embed doesn’t differ much from the others. And since it supports a very large context window of 8k, you should be safe picking any and leaving some room to spare by limiting the context window in Discourse to 7 or 7.5k.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 11, 2025, 2:04pm UTC](https://meta.discourse.org/t/how-to-implement-mistral-with-embeddings/361095/5 "2025-04-11T14:04:40Z")

</div>

Looks like `mistral-embed` uses the same tokenizer as the first Mixtral model, and we already ship that anyway, so what do you think about enabling that tokenizer in the embeddings config page @Roman ?

---

<div class="post-metadata">

### Author: ![Roman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roman/32/157504_2.png) [@Roman](https://meta.discourse.org/u/Roman)
#### Post date: [April 11, 2025, 2:44pm UTC](https://meta.discourse.org/t/how-to-implement-mistral-with-embeddings/361095/6 "2025-04-11T14:44:35Z")

</div>

Sure. I don’t see why not if it’s already there. This change will add it to the available options:

[https://github.com/discourse/discourse-ai/pull/1258](https://github.com/discourse/discourse-ai/pull/1258)

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [May 11, 2025, 2:44pm UTC](https://meta.discourse.org/t/how-to-implement-mistral-with-embeddings/361095/7 "2025-05-11T14:44:54Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
