mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-24 05:28:04 +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
|
|
@ -8,7 +8,7 @@ from typing import Any
|
|||
|
||||
from pydantic import TypeAdapter
|
||||
|
||||
from llama_stack.apis.common.errors import ModelNotFoundError, VectorStoreNotFoundError
|
||||
from llama_stack.apis.common.errors import ModelNotFoundError, ModelTypeError, VectorStoreNotFoundError
|
||||
from llama_stack.apis.models import ModelType
|
||||
from llama_stack.apis.resource import ResourceType
|
||||
from llama_stack.apis.vector_dbs import ListVectorDBsResponse, VectorDB, VectorDBs
|
||||
|
|
@ -66,7 +66,7 @@ class VectorDBsRoutingTable(CommonRoutingTableImpl, VectorDBs):
|
|||
if model is None:
|
||||
raise ModelNotFoundError(embedding_model)
|
||||
if model.model_type != ModelType.embedding:
|
||||
raise ValueError(f"Model {embedding_model} is not an embedding model")
|
||||
raise ModelTypeError(embedding_model, model.model_type, ModelType.embedding)
|
||||
if "embedding_dimension" not in model.metadata:
|
||||
raise ValueError(f"Model {embedding_model} does not have an embedding dimension")
|
||||
vector_db_data = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue