sales-assistant-py-new/app/llm.py

28 lines
1.0 KiB
Python

from langchain.chat_models import init_chat_model
from httpx import Client, Timeout
from app.conf.app_config import app_config
http_client = Client(
timeout=Timeout(120.0, connect=10.0, read=60.0),
follow_redirects=True,
)
llm = init_chat_model(model=app_config.llm.model_name,
api_key=app_config.llm.api_key,
base_url=app_config.llm.base_url,
temperature=0.8,
extra_body={"thinking": {"type": "disabled"}},
max_retries=3,
request_timeout=120,
http_client=http_client)
llm_low = init_chat_model(model=app_config.llm.model_name,
api_key=app_config.llm.api_key,
base_url=app_config.llm.base_url,
temperature=0.1,
extra_body={"thinking": {"type": "disabled"}},
max_retries=3,
request_timeout=120,
http_client=http_client)