mirror of
https://github.com/serge-chat/serge.git
synced 2024-01-15 09:32:12 +03:00
Fix inefficent model check during chat creation (#1016)
* Fix inefficent model check during chat creation * Update chat.py * Update chat.py
This commit is contained in:
committed by
GitHub
parent
586f556577
commit
b63c7496ba
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user