init
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from typing import Optional
|
||||
from langchain_openai import ChatOpenAI
|
||||
from config import Config
|
||||
|
||||
|
||||
def create_chat_model(model_section: Optional[str] = None) -> ChatOpenAI:
|
||||
"""创建 LLM 实例"""
|
||||
model_config = Config.get_model_config(model_section)
|
||||
return ChatOpenAI(
|
||||
model=model_config['model'],
|
||||
api_key=model_config['api_key'],
|
||||
base_url=model_config.get('base_url'),
|
||||
temperature=0.1,
|
||||
max_retries=Config.MAX_RETRIES,
|
||||
timeout=Config.TIMEOUT
|
||||
)
|
||||
Reference in New Issue
Block a user