From acc60696bd1758150f21f4ca541a5405ea59a726 Mon Sep 17 00:00:00 2001 From: Hayden Housen Date: Tue, 1 Aug 2023 10:35:22 -0700 Subject: [PATCH] Make upsert work --- vocode/streaming/vector_db/pinecone.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vocode/streaming/vector_db/pinecone.py b/vocode/streaming/vector_db/pinecone.py index f21f819b1..b1c52fb4a 100644 --- a/vocode/streaming/vector_db/pinecone.py +++ b/vocode/streaming/vector_db/pinecone.py @@ -60,13 +60,16 @@ async def add_texts( docs.append({"id": ids[i], "values": embedding, "metadata": metadata}) # upsert to Pinecone async with self.aiohttp_session.post( - f"{self.pinecone_url}/upsert", + f"{self.pinecone_url}/vectors/upsert", headers={"Api-Key": self.pinecone_api_key}, json={ "vectors": docs, + "namespace": namespace, }, ) as response: - print(await response.text()) + response_json = await response.json() + if "message" in response_json: + logger.error(f"Error upserting vectors: {response_json}") return ids