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

@@ -5,7 +5,7 @@ from sys import maxsize
from common import config, model
from common.auth import check_api_key
from common.model import check_model_container
from common.model import check_embeddings_container, check_model_container
from common.networking import handle_request_error, run_with_request_disconnect
from common.utils import unwrap
from endpoints.OAI.types.completion import CompletionRequest, CompletionResponse
@@ -132,7 +132,7 @@ async def chat_completion_request(
# Embeddings endpoint
@router.post(
"/v1/embeddings",
dependencies=[Depends(check_api_key), Depends(check_model_container)],
dependencies=[Depends(check_api_key), Depends(check_embeddings_container)],
)
async def embeddings(request: Request, data: EmbeddingsRequest) -> EmbeddingsResponse:
embeddings_task = asyncio.create_task(get_embeddings(data, request))