mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
fix: reverted to having register_model func and changed error type
This commit is contained in:
parent
7ccf83fb74
commit
042cb89db2
1 changed files with 8 additions and 0 deletions
|
@ -40,7 +40,9 @@ from llama_stack.apis.inference.inference import (
|
||||||
OpenAIMessageParam,
|
OpenAIMessageParam,
|
||||||
OpenAIResponseFormatParam,
|
OpenAIResponseFormatParam,
|
||||||
)
|
)
|
||||||
|
from llama_stack.apis.models.models import Model
|
||||||
from llama_stack.distribution.request_headers import NeedsRequestProviderData
|
from llama_stack.distribution.request_headers import NeedsRequestProviderData
|
||||||
|
from llama_stack.exceptions import UnsupportedModelError
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
from llama_stack.providers.utils.inference.model_registry import ModelRegistryHelper
|
from llama_stack.providers.utils.inference.model_registry import ModelRegistryHelper
|
||||||
from llama_stack.providers.utils.inference.openai_compat import (
|
from llama_stack.providers.utils.inference.openai_compat import (
|
||||||
|
@ -90,6 +92,12 @@ class LiteLLMOpenAIMixin(
|
||||||
async def shutdown(self):
|
async def shutdown(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
async def register_model(self, model: Model) -> Model:
|
||||||
|
model_id = self.get_provider_model_id(model.provider_resource_id)
|
||||||
|
if model_id is None:
|
||||||
|
raise UnsupportedModelError(model.provider_resource_id, self.alias_to_provider_id_map.keys())
|
||||||
|
return model
|
||||||
|
|
||||||
def get_litellm_model_name(self, model_id: str) -> str:
|
def get_litellm_model_name(self, model_id: str) -> str:
|
||||||
# users may be using openai/ prefix in their model names. the openai/models.py did this by default.
|
# 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.
|
# model_id.startswith("openai/") is for backwards compatibility.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue