-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
handle check_provider_endpoint:True with multiple wildcard models via openai like provider #10358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Please suggest the test approach for this. I used to test such cases with vcrpy, but can't see this lib usage here. |
custom/*
models via openai/*
@mkhludnev please add corresponding unit tests inside |
turns out only |
done |
…models based on key (#7538) * test(test_utils.py): initial test for valid models Addresses #7525 * fix: test * feat(fireworks_ai/transformation.py): support retrieving valid models from fireworks ai endpoint * refactor(fireworks_ai/): support checking model info on `/v1/models` route * docs(set_keys.md): update docs to clarify check llm provider api usage * fix(watsonx/common_utils.py): support 'WATSONX_ZENAPIKEY' for iam auth * fix(watsonx): read in watsonx token from env var * fix: fix linting errors * fix(utils.py): fix provider config check * style: cleanup unused imports
Hi @mkhludnev trying to understand your PR
Are you just trying to return the public wildcard route prefix in the |
litellm/proxy/auth/model_checks.py
Outdated
@@ -167,12 +171,12 @@ def get_known_models_from_wildcard( | |||
return [] | |||
# get all known provider models | |||
wildcard_models = get_provider_models( | |||
provider=provider, litellm_params=litellm_params | |||
provider=provider, model=model, litellm_params=litellm_params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would you pass in the model to get provider models?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. got it
@@ -347,6 +347,15 @@ def validate_environment( | |||
|
|||
return headers | |||
|
|||
@staticmethod | |||
def strip_v1(api_base:str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of inference servers serves at .../v1
url. So, to make /chat/completions
work, I need to specify api_base: ../v1
like:
model_list:
- model_name: "foo/*"
litellm_params:
model: openai/*
api_base: https://my.host/proxy/v1
api_key: os.environ/AI_PROXY_KEY
general_settings:
master_key: sk-foo
litellm_settings:
check_provider_endpoint: true
In this case, get_models()
fails due to requesting
https://my.host/proxy/v1/v1/models
see here
url=f"{api_base}/v1/models", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the test asserting that regardless of /v1 tail in api_base it requests /v1/models as expected.
@pytest.mark.parametrize("api_base, v1_models_url", [("http://foo.bar/baz", "http://foo.bar/baz/v1/models"), |
@krrishdholakia may I ask if this PR is considered for merging? |
Hi everyone, Thanks for the PR, we need this fix as well. Some points:
|
Hi @zkck
Generally I agree, but I worry about backward compatibility. What about colleagues with existing configs w/o
I'm blind guessing: it seems like legacy to me. It looks like initially just
Regarding this config, how to handle two openai endpoints distinguishing between them?
Right . It's a fallback logic letting to minimize changes and support existing configs as much as possible. Pardon for continuing this awkwardness. |
Hi, |
Title
handle
custom/*
models viaopenai/*
orlitellm_proxy/*
Relevant issues
Fixes #10357
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
TBC
tests/litellm/
directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit
)[https://docs.litellm.ai/docs/extras/contributing_code]Type
🐛 Bug Fix
Changes
This allows to configure LitteLLM and a relay\proxy for OpenAI compatible providers via wildcard models. eg
This fix let to handle
/models
, pulling actual model names from these providers, prepend models with provider prefixes. And then handle/chat/completion
with"model":"foo/my_llama_etc"
.