mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
fix(core): forward LiteLLM embedding dimensions
Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user