Skip to content

Commit 330e6a0

Browse files
committed
Update spanish examples so they can run from the root
1 parent b8e5b59 commit 330e6a0

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

spanish/rag_csv.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import csv
22
import os
3+
from pathlib import Path
34

45
import azure.identity
56
import openai
@@ -33,7 +34,8 @@
3334
MODEL_NAME = os.environ["OPENAI_MODEL"]
3435

3536
# Indexamos los datos del CSV
36-
with open("hybridos.csv") as file:
37+
CSV_PATH = Path(__file__).with_name("hybridos.csv")
38+
with CSV_PATH.open(newline="", encoding="utf-8") as file:
3739
reader = csv.reader(file)
3840
rows = list(reader)
3941
documents = [{"id": (i + 1), "body": " ".join(row)} for i, row in enumerate(rows[1:])]

spanish/retrieval_augmented_generation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import csv
22
import os
3+
from pathlib import Path
34

45
import azure.identity
56
import openai
@@ -35,7 +36,8 @@
3536
USER_MESSAGE = "¿qué tan rápido es el Prius v?"
3637

3738
# Abrir el CSV y almacenar en una lista
38-
with open("hybridos.csv") as file:
39+
CSV_PATH = Path(__file__).with_name("hybridos.csv")
40+
with CSV_PATH.open(newline="", encoding="utf-8") as file:
3941
reader = csv.reader(file)
4042
rows = list(reader)
4143

0 commit comments

Comments
 (0)