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)
