mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
Feature: Router aembedding
This commit is contained in:
parent
046e1384c3
commit
bf98d48bba
2 changed files with 40 additions and 1 deletions
|
@ -112,7 +112,20 @@ class Router:
|
|||
data["caching"] = self.cache_responses
|
||||
# call via litellm.embedding()
|
||||
return litellm.embedding(**{**data, **kwargs})
|
||||
|
||||
|
||||
async def aembedding(self,
|
||||
model: str,
|
||||
input: Union[str, List],
|
||||
is_async: Optional[bool] = True,
|
||||
**kwargs) -> Union[List[float], None]:
|
||||
# pick the one that is available (lowest TPM/RPM)
|
||||
deployment = self.get_available_deployment(model=model, input=input)
|
||||
|
||||
data = deployment["litellm_params"]
|
||||
data["input"] = input
|
||||
data["caching"] = self.cache_responses
|
||||
return await litellm.aembedding(**{**data, **kwargs})
|
||||
|
||||
def set_model_list(self, model_list: list):
|
||||
self.model_list = model_list
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue