forked from phoenix-oss/llama-stack-mirror
Improve an important error message
This commit is contained in:
parent
2089427d60
commit
8cfbb9d38b
1 changed files with 14 additions and 1 deletions
|
@ -87,8 +87,21 @@ class CommonRoutingTableImpl(RoutingTable):
|
||||||
def get_provider_impl(
|
def get_provider_impl(
|
||||||
self, routing_key: str, provider_id: Optional[str] = None
|
self, routing_key: str, provider_id: Optional[str] = None
|
||||||
) -> Any:
|
) -> Any:
|
||||||
|
def apiname_object():
|
||||||
|
if isinstance(self, ModelsRoutingTable):
|
||||||
|
return ("Inference", "model")
|
||||||
|
elif isinstance(self, ShieldsRoutingTable):
|
||||||
|
return ("Safety", "shield")
|
||||||
|
elif isinstance(self, MemoryBanksRoutingTable):
|
||||||
|
return ("Memory", "memory_bank")
|
||||||
|
else:
|
||||||
|
raise ValueError("Unknown routing table type")
|
||||||
|
|
||||||
if routing_key not in self.registry:
|
if routing_key not in self.registry:
|
||||||
raise ValueError(f"`{routing_key}` not registered")
|
apiname, objname = apiname_object()
|
||||||
|
raise ValueError(
|
||||||
|
f"`{routing_key}` not registered. Make sure there is an {apiname} provider serving this {objname}."
|
||||||
|
)
|
||||||
|
|
||||||
objs = self.registry[routing_key]
|
objs = self.registry[routing_key]
|
||||||
for obj in objs:
|
for obj in objs:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue