Skip to content

Commit 2051f9f

Browse files
vmeselecarrara
andcommitted
fix: Fixes session opening on load_csv.
Co-authored-by: @ecarrara <carrara.erle@gmail.com>
1 parent e5cac55 commit 2051f9f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎dialog_lib/manage.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,13 @@ def anthropic(model, temperature, llm_api_key, prompt, debug):
7878
def load_csv(database_url, llm_api_key, file):
7979
engine = create_engine(database_url)
8080
dbsession = Session(engine.connect())
81-
csv_loader(
82-
file_path=file,
83-
dbsession=dbsession,
84-
embedding_llm_model="openai",
85-
embedding_llm_api_key=llm_api_key
86-
)
81+
with Session(engine.connect()) as session:
82+
csv_loader(
83+
file_path=file,
84+
dbsession=session,
85+
embedding_llm_model="openai",
86+
embedding_llm_api_key=llm_api_key
87+
)
8788
click.echo("## Loaded the CSV file to the database")
8889

8990

0 commit comments

Comments
 (0)