Remove hardcoded model list from OpenAIProvider file #8649
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following discussion in #8589. This PR is a continuation of #8589 because I need to rebase the main branch.
Litellm is not strictly enforcing the rule that the model name must follow
{provider_name}/{model_name}
, e.g., openai finetuned model is specified asresponse = completion(model="ft:gpt-4-0613", messages=messages)
, this makes it hard to validate model name at constructing time, but need to rely on the actual call to validate the model name.For this specifc problem, we can rely on checking the prefix of
openai/
andft:
. The only case we are missing is users dodspy.LM("gpt-4.1")
and didn't specifyprovider
arg indspy.LM
. For this case, we just raise an explicit error message.