forked from phoenix/litellm-mirror
fix(proxy_server.py): router model group alias routing
check model alias group routing before specific deployment routing, to deal with an alias being the same as a deployment name (e.g. gpt-3.5-turbo) n
This commit is contained in:
parent
027218c3f0
commit
8ff3bbcfee
1 changed files with 14 additions and 14 deletions
|
@ -1130,18 +1130,18 @@ async def completion(
|
||||||
llm_router is not None and data["model"] in router_model_names
|
llm_router is not None and data["model"] in router_model_names
|
||||||
): # model in router model list
|
): # model in router model list
|
||||||
response = await llm_router.atext_completion(**data)
|
response = await llm_router.atext_completion(**data)
|
||||||
elif (
|
|
||||||
llm_router is not None and data["model"] in llm_router.deployment_names
|
|
||||||
): # model in router deployments, calling a specific deployment on the router
|
|
||||||
response = await llm_router.atext_completion(
|
|
||||||
**data, specific_deployment=True
|
|
||||||
)
|
|
||||||
elif (
|
elif (
|
||||||
llm_router is not None
|
llm_router is not None
|
||||||
and llm_router.model_group_alias is not None
|
and llm_router.model_group_alias is not None
|
||||||
and data["model"] in llm_router.model_group_alias
|
and data["model"] in llm_router.model_group_alias
|
||||||
): # model set in model_group_alias
|
): # model set in model_group_alias
|
||||||
response = await llm_router.atext_completion(**data)
|
response = await llm_router.atext_completion(**data)
|
||||||
|
elif (
|
||||||
|
llm_router is not None and data["model"] in llm_router.deployment_names
|
||||||
|
): # model in router deployments, calling a specific deployment on the router
|
||||||
|
response = await llm_router.atext_completion(
|
||||||
|
**data, specific_deployment=True
|
||||||
|
)
|
||||||
else: # router is not set
|
else: # router is not set
|
||||||
response = await litellm.atext_completion(**data)
|
response = await litellm.atext_completion(**data)
|
||||||
|
|
||||||
|
@ -1278,16 +1278,16 @@ async def chat_completion(
|
||||||
llm_router is not None and data["model"] in router_model_names
|
llm_router is not None and data["model"] in router_model_names
|
||||||
): # model in router model list
|
): # model in router model list
|
||||||
response = await llm_router.acompletion(**data)
|
response = await llm_router.acompletion(**data)
|
||||||
elif (
|
|
||||||
llm_router is not None and data["model"] in llm_router.deployment_names
|
|
||||||
): # model in router deployments, calling a specific deployment on the router
|
|
||||||
response = await llm_router.acompletion(**data, specific_deployment=True)
|
|
||||||
elif (
|
elif (
|
||||||
llm_router is not None
|
llm_router is not None
|
||||||
and llm_router.model_group_alias is not None
|
and llm_router.model_group_alias is not None
|
||||||
and data["model"] in llm_router.model_group_alias
|
and data["model"] in llm_router.model_group_alias
|
||||||
): # model set in model_group_alias
|
): # model set in model_group_alias
|
||||||
response = await llm_router.acompletion(**data)
|
response = await llm_router.acompletion(**data)
|
||||||
|
elif (
|
||||||
|
llm_router is not None and data["model"] in llm_router.deployment_names
|
||||||
|
): # model in router deployments, calling a specific deployment on the router
|
||||||
|
response = await llm_router.acompletion(**data, specific_deployment=True)
|
||||||
else: # router is not set
|
else: # router is not set
|
||||||
response = await litellm.acompletion(**data)
|
response = await litellm.acompletion(**data)
|
||||||
|
|
||||||
|
@ -1438,10 +1438,6 @@ async def embeddings(
|
||||||
llm_router is not None and data["model"] in router_model_names
|
llm_router is not None and data["model"] in router_model_names
|
||||||
): # model in router model list
|
): # model in router model list
|
||||||
response = await llm_router.aembedding(**data)
|
response = await llm_router.aembedding(**data)
|
||||||
elif (
|
|
||||||
llm_router is not None and data["model"] in llm_router.deployment_names
|
|
||||||
): # model in router deployments, calling a specific deployment on the router
|
|
||||||
response = await llm_router.aembedding(**data, specific_deployment=True)
|
|
||||||
elif (
|
elif (
|
||||||
llm_router is not None
|
llm_router is not None
|
||||||
and llm_router.model_group_alias is not None
|
and llm_router.model_group_alias is not None
|
||||||
|
@ -1450,6 +1446,10 @@ async def embeddings(
|
||||||
response = await llm_router.aembedding(
|
response = await llm_router.aembedding(
|
||||||
**data
|
**data
|
||||||
) # ensure this goes the llm_router, router will do the correct alias mapping
|
) # ensure this goes the llm_router, router will do the correct alias mapping
|
||||||
|
elif (
|
||||||
|
llm_router is not None and data["model"] in llm_router.deployment_names
|
||||||
|
): # model in router deployments, calling a specific deployment on the router
|
||||||
|
response = await llm_router.aembedding(**data, specific_deployment=True)
|
||||||
else:
|
else:
|
||||||
response = await litellm.aembedding(**data)
|
response = await litellm.aembedding(**data)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue