mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-23 08:49:43 +00:00
refactor: standardize InferenceRouter model handling
* introduces ModelTypeError custom exception class * introduces _get_model private method in InferenceRouter class * standardizes inconsistent variable name usage for models in InferenceRouter class * removes unneeded model type check in ollama provider Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
This commit is contained in:
parent
803114180b
commit
ff8942bc71
4 changed files with 28 additions and 38 deletions
|
|
@ -62,3 +62,13 @@ class SessionNotFoundError(ValueError):
|
|||
def __init__(self, session_name: str) -> None:
|
||||
message = f"Session '{session_name}' not found or access denied."
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class ModelTypeError(TypeError):
|
||||
"""raised when a model is present but not the correct type"""
|
||||
|
||||
def __init__(self, model_name: str, model_type: str, expected_model_type: str) -> None:
|
||||
message = (
|
||||
f"Model '{model_name}' is of type '{model_type}' rather than the expected type '{expected_model_type}'"
|
||||
)
|
||||
super().__init__(message)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue