fix(core): forward LiteLLM embedding dimensions

Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
phernandez
2026-05-28 19:33:31 -05:00
parent a758657537
commit 8270405a1c
2 changed files with 15 additions and 0 deletions
@@ -119,6 +119,7 @@ class LiteLLMEmbeddingProvider(EmbeddingProvider):
params: dict[str, Any] = {
"model": self.model_name,
"input": batch,
"dimensions": self.dimensions,
"drop_params": True,
"timeout": self._timeout,
}
+14
View File
@@ -131,6 +131,20 @@ async def test_litellm_provider_drop_params_always_set(monkeypatch):
assert calls[0]["drop_params"] is True
@pytest.mark.asyncio
async def test_litellm_provider_forwards_configured_dimensions(monkeypatch):
"""Configured output dimensions should be sent to LiteLLM."""
calls = _install_litellm_stub(monkeypatch, dim=4)
provider = LiteLLMEmbeddingProvider(
model_name="openai/text-embedding-3-small",
dimensions=4,
)
await provider.embed_query("test")
assert calls[0]["dimensions"] == 4
@pytest.mark.asyncio
async def test_litellm_provider_uses_cohere_document_and_query_input_types(monkeypatch):
"""Cohere v3 embeddings require different input_type values per embedding role."""