diff --git a/api/src/serge/routers/chat.py b/api/src/serge/routers/chat.py index 7cd0bd2..6de1568 100644 --- a/api/src/serge/routers/chat.py +++ b/api/src/serge/routers/chat.py @@ -1,3 +1,5 @@ +import os + from typing import Optional from fastapi import APIRouter, HTTPException from langchain.memory import RedisChatMessageHistory @@ -30,13 +32,8 @@ async def create_new_chat( init_prompt: str = "Below is an instruction that describes a task. Write a response that appropriately completes the request.", n_threads: int = 4, ): - try: - client = Llama( - model_path=f"/usr/src/app/weights/{model}.bin", - ) - del client - except Exception as exc: - raise ValueError(f"Model can't be found: {exc}") + if not os.path.exists(f"/usr/src/app/weights/{model}.bin"): + raise ValueError(f"Model can't be found: /usr/src/app/weights/{model}.bin") client = Redis(host="localhost", port=6379, decode_responses=False)