This commit is contained in:
2025-07-01 15:50:40 +08:00
parent b7d59835ce
commit 1d86109d64
7 changed files with 144 additions and 60 deletions
+25
View File
@@ -0,0 +1,25 @@
import json
import os
from pathlib import Path
from langchain_openai import ChatOpenAI
from pydantic import SecretStr
PROJECT_PATH = Path(__file__).parent.parent.parent.absolute()
if os.path.exists(os.path.join(PROJECT_PATH, "config", "config_local.json")):
CONFIG_PATH = os.path.join(PROJECT_PATH, "config", "config_local.json")
elif os.path.exists(os.path.join(PROJECT_PATH, "config", "config.json")):
CONFIG_PATH = os.path.join(PROJECT_PATH, "config", "config.json")
else:
raise FileNotFoundError('Unable to locate config file, check src/config/config.json')
with open(CONFIG_PATH, 'r', encoding='utf-8') as config_file:
project_config = json.load(config_file)
LLM = ChatOpenAI(model=project_config['llm_model_name'], api_key= SecretStr(project_config['llm_secret_key']),
base_url=project_config['llm_base_url'], temperature=0.01)