Skip to content

Commit 4d2dc16

Browse files
committed
chore: Update dependencies and environment variable handling
- Bump package version to 0.1.9 - Add python-dotenv and faiss-cpu to dependencies - Implement .env file loading in chains.py - Update graph.py to use os.getcwd() for file paths
1 parent 96217fd commit 4d2dc16

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

llm_utils/chains.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33

44
from .llm_factory import get_llm
55

6+
from dotenv import load_dotenv
7+
8+
env_path = os.path.join(os.getcwd(), ".env")
9+
10+
if os.path.exists(env_path):
11+
load_dotenv(env_path)
12+
else:
13+
print(f"⚠️ 환경변수 파일(.env)이 {os.getcwd()}에 없습니다!")
14+
615
llm = get_llm(
716
model_type="openai",
817
model_name="gpt-4o-mini",

llm_utils/graph.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1+
import os
12
import json
2-
from dotenv import load_dotenv
3-
4-
load_dotenv()
53

64
from typing_extensions import TypedDict, Annotated
75
from langgraph.graph import END, StateGraph
@@ -53,14 +51,14 @@ def get_table_info_node(state: QueryMakerState):
5351
embeddings = OpenAIEmbeddings(model="text-embedding-3-small")
5452
try:
5553
db = FAISS.load_local(
56-
"/home/pseudo.dwlee/autosql/table_info_db",
54+
os.getcwd() + "/table_info_db",
5755
embeddings,
5856
allow_dangerous_deserialization=True,
5957
)
6058
except:
6159
documents = get_info_from_db()
6260
db = FAISS.from_documents(documents, embeddings)
63-
db.save_local("/home/pseudo.dwlee/autosql/table_info_db")
61+
db.save_local(os.getcwd() + "/table_info_db")
6462
print("table_info_db not found")
6563
doc_res = db.similarity_search(state["messages"][-1].content)
6664
documents_dict = {}

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="lang2sql", # 패키지 이름
9-
version="0.1.8", # 버전
9+
version="0.1.9", # 버전
1010
author="ehddnr301",
1111
author_email="[email protected]",
1212
url="https://github.com/CausalInferenceLab/Lang2SQL",
@@ -22,6 +22,8 @@
2222
"openai==1.59.8",
2323
"langchain-openai==0.3.0",
2424
"streamlit==1.41.1",
25+
"python-dotenv==1.0.1",
26+
"faiss-cpu==1.10.0",
2527
],
2628
entry_points={
2729
"console_scripts": [

0 commit comments

Comments
 (0)