Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# OpenAI-compatible models that reject the `dimensions=` request parameter.
_EMBEDDING_KNOWN_REJECTING_MODELS: frozenset[str] = frozenset(
{"text-embedding-ada-002"}
{"text-embedding-ada-002", "mistral-embed"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What is the correct model identifier for Mistral AI's embedding model when using OpenAI-compatible API endpoints? Does the mistral-embed model support or reject the dimensions parameter?

💡 Result:

Correct OpenAI-compatible model identifier for Mistral’s embedding model: use model="mistral-embed" for Mistral embedding requests on the OpenAI-compatible endpoint base URL https://api.mistral.ai/v1 [1][2]. Does mistral-embed support or reject a dimensions parameter? The Mistral embeddings API docs show the request body uses model and inputs, and do not list any supported “dimensions” field for the embeddings endpoint [2]. Additionally, Mistral’s embedding model constants indicate multiple fixed-dimension variants via different model IDs (e.g., "mistral-embed" = 1024 dims, and other model IDs for 256/128 dims), rather than a configurable dimensions parameter on a single model [3]. Therefore, for model="mistral-embed", you should not expect a “dimensions” parameter to be accepted; use the appropriate model ID if you need a different output dimensionality [3].

Citations:


Confirm mistral-embed is treated as dimensions-rejecting and add a matching test

Mistral’s OpenAI-compatible embeddings endpoint uses model="mistral-embed", and the documented embeddings request schema includes model and inputs only—there’s no supported dimensions field to send—so blocking dimensions for "mistral-embed" is consistent with the API.

Add coverage mirroring the ADA test:

def test_resolve_send_dimensions_auto_mistral_embed_returns_false(
    monkeypatch: pytest.MonkeyPatch,
) -> None:
    s = _build_embedding_settings(
        {
            "EMBEDDING_VECTOR_DIMENSIONS": "1536",
            "EMBEDDING_MODEL_CONFIG__MODEL": "mistral-embed",
        },
        monkeypatch,
    )
    assert s.resolve_send_dimensions() is False
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/config.py` at line 31, The code must treat "mistral-embed" the same as
"text-embedding-ada-002" for rejecting sending dimensions: update
resolve_send_dimensions in the embedding settings logic to return False when
EMBEDDING_MODEL_CONFIG__MODEL == "mistral-embed" (same branch that handles
"text-embedding-ada-002"), and add a unit test mirroring the existing ADA test
named test_resolve_send_dimensions_auto_mistral_embed_returns_false that builds
settings via _build_embedding_settings with EMBEDDING_VECTOR_DIMENSIONS="1536"
and EMBEDDING_MODEL_CONFIG__MODEL="mistral-embed" and asserts
resolve_send_dimensions() is False.

)


Expand Down