Embeddings: Add model load checks

Same as the normal model container.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-07-30 11:17:36 -04:00
parent 01c7702859
commit f13d0fb8b3
3 changed files with 17 additions and 4 deletions

View file

@ -162,9 +162,15 @@ async def check_model_container():
async def check_embeddings_container():
"""FastAPI depends that checks if an embeddings model is loaded."""
"""
FastAPI depends that checks if an embeddings model is loaded.
if embeddings_container is None:
This is the same as the model container check, but with embeddings instead.
"""
if embeddings_container is None or not (
embeddings_container.model_is_loading or embeddings_container.model_loaded
):
error_message = handle_request_error(
"No embeddings models are currently loaded.",
exc_info=False,