fix: embed() sends string input instead of array, breaking OpenAI-compatible providers (#586)

* fix: wrap single embed() input in array for OpenAI-compatible provider compatibility

* Fix input format in embedding test assertion
This commit is contained in:
qxxaa 2026-04-20 21:35:13 +01:00 committed by GitHub
parent 2c50791642
commit 1c3e3f8816
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -99,7 +99,7 @@ class _EmbeddingClient:
return self._validate_embedding_dimensions(response.embeddings[0].values)
else: # openai
response = await self.client.embeddings.create(
model=self.model, input=query
model=self.model, input=[query]
)
return self._validate_embedding_dimensions(response.data[0].embedding)

View File

@ -51,7 +51,7 @@ async def test_openai_embedding_client_uses_configured_model_and_dimensions(
assert embedding == [0.1] * 8
assert fake_embeddings.calls == [
{"model": "text-embedding-3-small", "input": "hello world"}
{"model": "text-embedding-3-small", "input": ["hello world"]}
]