update
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user