From 14b4bc96ce31086a807dc9d204a5409e8e812a3b Mon Sep 17 00:00:00 2001 From: yangdx Date: Thu, 17 Apr 2025 05:20:22 +0800 Subject: [PATCH] Fix OPENAI_API_BASE not working in .env --- lightrag/llm/openai.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lightrag/llm/openai.py b/lightrag/llm/openai.py index 68b92e83..8b05c61b 100644 --- a/lightrag/llm/openai.py +++ b/lightrag/llm/openai.py @@ -37,6 +37,13 @@ from lightrag.api import __api_version__ import numpy as np from typing import Any, Union +from dotenv import load_dotenv + +# use the .env that is inside the current folder +# allows to use different .env file for each lightrag instance +# the OS environment variables take precedence over the .env file +load_dotenv(dotenv_path=".env", override=False) + class InvalidResponseError(Exception): """Custom exception class for triggering retry mechanism"""