forked from phoenix-oss/llama-stack-mirror
feat: expand set of known openai models, allow using openai canonical model names (#2164)
note: the openai provider exposes the litellm specific model names to the user. this change is compatible with that. the litellm names should be deprecated.
This commit is contained in:
parent
5052c3cbf3
commit
aa5bef8e05
5 changed files with 222 additions and 9 deletions
|
@ -62,6 +62,9 @@ class LiteLLMOpenAIMixin(
|
|||
Inference,
|
||||
NeedsRequestProviderData,
|
||||
):
|
||||
# TODO: avoid exposing the litellm specific model names to the user.
|
||||
# potential change: add a prefix param that gets added to the model name
|
||||
# when calling litellm.
|
||||
def __init__(
|
||||
self,
|
||||
model_entries,
|
||||
|
@ -92,7 +95,9 @@ class LiteLLMOpenAIMixin(
|
|||
return model
|
||||
|
||||
def get_litellm_model_name(self, model_id: str) -> str:
|
||||
return "openai/" + model_id if self.is_openai_compat else model_id
|
||||
# users may be using openai/ prefix in their model names. the openai/models.py did this by default.
|
||||
# model_id.startswith("openai/") is for backwards compatibility.
|
||||
return "openai/" + model_id if self.is_openai_compat and not model_id.startswith("openai/") else model_id
|
||||
|
||||
async def completion(
|
||||
self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue