fix(embeddings): handle empty API key in LiteLLMEmbeddingEngine

- Add conditional check for empty API key to prevent authentication errors- Set default API key to "EMPTY" when no valid key is provided- This ensures proper fallback behavior when API key is not configured
```
This commit is contained in:
maozhen 2025-12-29 11:15:33 +08:00
parent a0f25f4f50
commit 2c79d693fd

View file

@ -134,7 +134,7 @@ class LiteLLMEmbeddingEngine(EmbeddingEngine):
litellm.aembedding(
model=self.model,
input=text,
api_key=self.api_key,
api_key=self.api_key if self.api_key and self.api_key.strip() != "" else "EMPTY",
api_base=self.endpoint,
api_version=self.api_version,
),