mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
fix: also apply custom api_base/api_key to async embedding path
Greptile correctly identified that _get_async_embedding() had the same bug in its else branch — calling litellm.aembedding() without api_base or api_key when the model is not in the router model list. Apply the same kwargs pattern to the async fallback path.
This commit is contained in:
parent
654664795f
commit
fbf949c0d9
1 changed files with 10 additions and 5 deletions
|
|
@ -313,11 +313,16 @@ class RedisSemanticCache(BaseCache):
|
|||
)
|
||||
else:
|
||||
# Generate embedding directly
|
||||
embedding_response = await litellm.aembedding(
|
||||
model=self.embedding_model,
|
||||
input=prompt,
|
||||
cache={"no-store": True, "no-cache": True},
|
||||
)
|
||||
async_embed_kwargs: dict = {
|
||||
"model": self.embedding_model,
|
||||
"input": prompt,
|
||||
"cache": {"no-store": True, "no-cache": True},
|
||||
}
|
||||
if self.embedding_api_base is not None:
|
||||
async_embed_kwargs["api_base"] = self.embedding_api_base
|
||||
if self.embedding_api_key is not None:
|
||||
async_embed_kwargs["api_key"] = self.embedding_api_key
|
||||
embedding_response = await litellm.aembedding(**async_embed_kwargs)
|
||||
|
||||
# Extract and return the embedding vector
|
||||
return embedding_response["data"][0]["embedding"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue