chore: standardize model not found error

Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
This commit is contained in:
Nathan Weinberg 2025-07-30 13:14:53 -04:00 committed by Nathan Weinberg
parent 266e2afb9c
commit 22c451fc17
6 changed files with 23 additions and 10 deletions

View file

@ -7,6 +7,7 @@
import time
from typing import Any
from llama_stack.apis.common.errors import ModelNotFoundError
from llama_stack.apis.models import ListModelsResponse, Model, Models, ModelType, OpenAIListModelsResponse, OpenAIModel
from llama_stack.distribution.datatypes import (
ModelWithOwner,
@ -111,7 +112,7 @@ class ModelsRoutingTable(CommonRoutingTableImpl, Models):
async def unregister_model(self, model_id: str) -> None:
existing_model = await self.get_model(model_id)
if existing_model is None:
raise ValueError(f"Model {model_id} not found")
raise ModelNotFoundError(model_id)
await self.unregister_object(existing_model)
async def update_registered_models(