Skip to content

Commit 2655a90

Browse files
committed
fix(scripts): add load_dotenv + catch Exception in final_v3_test
1 parent d1476e2 commit 2655a90

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

backend/scripts/final_v3_test.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
1111

12+
# Load .env file if present
13+
try:
14+
from dotenv import load_dotenv
15+
load_dotenv()
16+
except ImportError:
17+
pass # dotenv not installed, rely on exported env vars
18+
1219
# Load from environment (set in .env or export manually)
1320
if not os.environ.get("VOYAGE_API_KEY"):
1421
print("❌ VOYAGE_API_KEY not set. Export it or add to .env file.")
@@ -77,7 +84,8 @@ async def run_final_test():
7784
start = time.time()
7885
try:
7986
v2_results = await indexer.search_v2(query, repo["id"], top_k=3)
80-
except:
87+
except Exception as e:
88+
print(f" V2 error [{repo['name']}] '{query}': {e}")
8189
v2_results = []
8290
v2_time = (time.time() - start) * 1000
8391
total_v2_time += v2_time
@@ -86,7 +94,8 @@ async def run_final_test():
8694
start = time.time()
8795
try:
8896
v3_results = await indexer.search_v3(query, repo["id"], top_k=3, include_tests=False)
89-
except:
97+
except Exception as e:
98+
print(f" V3 error [{repo['name']}] '{query}': {e}")
9099
v3_results = []
91100
v3_time = (time.time() - start) * 1000
92101
total_v3_time += v3_time

0 commit comments

Comments
 (0)