mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
support all-models-on-proxy
This commit is contained in:
parent
dfc020ca5f
commit
b83c452ddd
4 changed files with 13 additions and 13 deletions
|
@ -639,7 +639,7 @@ async def user_api_key_auth(
|
|||
pass
|
||||
elif (
|
||||
isinstance(valid_token.models, list)
|
||||
and "all-models" in valid_token.models
|
||||
and "all-models-on-proxy" in valid_token.models
|
||||
):
|
||||
# Admin UI - Special alias to allow `all_models`
|
||||
pass
|
||||
|
|
|
@ -247,14 +247,14 @@ def test_call_with_valid_model(prisma_client):
|
|||
|
||||
|
||||
def test_call_with_valid_model_using_all_models(prisma_client):
|
||||
# Make a call to a key with model = `all-models` this is an Alias from LiteLLM Admin UI
|
||||
# Make a call to a key with model = `all-models-on-proxy` this is an Alias from LiteLLM Admin UI
|
||||
setattr(litellm.proxy.proxy_server, "prisma_client", prisma_client)
|
||||
setattr(litellm.proxy.proxy_server, "master_key", "sk-1234")
|
||||
try:
|
||||
|
||||
async def test():
|
||||
await litellm.proxy.proxy_server.prisma_client.connect()
|
||||
request = GenerateKeyRequest(models=["all-models"])
|
||||
request = GenerateKeyRequest(models=["all-models-on-proxy"])
|
||||
key = await generate_key_fn(data=request)
|
||||
print(key)
|
||||
|
||||
|
@ -273,11 +273,11 @@ def test_call_with_valid_model_using_all_models(prisma_client):
|
|||
result = await user_api_key_auth(request=request, api_key=bearer_token)
|
||||
print("result from user auth with new key", result)
|
||||
|
||||
# call /key/info for key - models == "all-models"
|
||||
# call /key/info for key - models == "all-models-on-proxy"
|
||||
key_info = await info_key_fn(key=generated_key)
|
||||
print("key_info", key_info)
|
||||
models = key_info["info"]["models"]
|
||||
assert models == ["all-models"]
|
||||
assert models == ["all-models-on-proxy"]
|
||||
|
||||
asyncio.run(test())
|
||||
except Exception as e:
|
||||
|
|
|
@ -115,16 +115,16 @@ const Team: React.FC<TeamProps> = ({
|
|||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="Models" name="models">
|
||||
<Select2.Option key="all-models" value="all-models">
|
||||
All Models
|
||||
<Select2.Option key="all-models-on-proxy" value="all-models-on-proxy">
|
||||
All Models on Proxy
|
||||
</Select2.Option>
|
||||
<Select2
|
||||
mode="multiple"
|
||||
placeholder="Select models"
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
<Select2.Option key="all-models" value="all-models">
|
||||
All Models
|
||||
<Select2.Option key="all-models-on-proxy" value="all-models-on-proxy">
|
||||
All Models on Proxy
|
||||
</Select2.Option>
|
||||
{userModels && userModels.map((model) => (
|
||||
<Select2.Option key={model} value={model}>
|
||||
|
@ -364,7 +364,7 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
|||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{team.models.length === 0 ? (
|
||||
<Badge size={"xs"} className="mb-1" color="blue">
|
||||
<Text>all-models</Text>
|
||||
<Text>all-models-on-proxy</Text>
|
||||
</Badge>
|
||||
) : (
|
||||
team.models.map((model: string, index: number) => (
|
||||
|
@ -483,8 +483,8 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
|||
placeholder="Select models"
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
<Select2.Option key="all-models" value="all-models">
|
||||
All Models
|
||||
<Select2.Option key="all-models-on-proxy" value="all-models-on-proxy">
|
||||
All Models on Proxy
|
||||
</Select2.Option>
|
||||
{userModels.map((model) => (
|
||||
<Select2.Option key={model} value={model}>
|
||||
|
|
|
@ -418,7 +418,7 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
|||
) : (
|
||||
// If selected team is None or selected team's models are empty, show all models
|
||||
<Badge size={"xs"} className="mb-1" color="blue">
|
||||
<Text>all-models</Text>
|
||||
<Text>all-models-on-proxy</Text>
|
||||
</Badge>
|
||||
)}
|
||||
</>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue