From 4e8e7267fbeea2d75bbbd87fcd3cfcbcc16ef53c Mon Sep 17 00:00:00 2001
From: James Briggs <35938317+jamescalam@users.noreply.github.com>
Date: Sun, 18 Feb 2024 17:23:07 +0400
Subject: [PATCH] fix for loading routes in pinecone

---
 semantic_router/index/pinecone.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/semantic_router/index/pinecone.py b/semantic_router/index/pinecone.py
index a6492226..ae210a4f 100644
--- a/semantic_router/index/pinecone.py
+++ b/semantic_router/index/pinecone.py
@@ -156,10 +156,12 @@ class PineconeIndex(BaseIndex):
             # Make the request to list vectors. Adjust headers and parameters as needed.
             response = requests.get(list_url, params=params, headers=headers)
             response_data = response.json()
-            print(response_data)
 
             # Extract vector IDs from the response and add them to the list
             vector_ids = [vec["id"] for vec in response_data.get("vectors", [])]
+            # check that there are vector IDs, otherwise break the loop
+            if not vector_ids:
+                break
             all_vector_ids.extend(vector_ids)
 
             # if we need metadata, we fetch it
-- 
GitLab