File size: 531 Bytes
4225666
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from pathlib import Path
from langchain_community.llms import LlamaCpp
from langchain_community.chat_models import ChatLlamaCpp
from app.core.config import settings
model_file = Path(settings.model_path) / settings.local_model_name

def load_model():
    return ChatLlamaCpp(
        model_path=str(model_file),  # Direct path
        n_ctx=8192,
        n_batch=512,
        n_threads=4,
        temperature=0.05,
        top_p=0.8,
        top_k=20,
        repeat_penalty=1.1,
        f16_kv=True,
        verbose=False,
    )