vector-inspector 0.3.4__py3-none-any.whl → 0.3.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import time
5
5
  from pinecone import Pinecone, ServerlessSpec
6
6
  from pinecone.exceptions import PineconeException
7
7
 
8
- from .base_connection import VectorDBConnection
8
+ from vector_inspector.core.connections.base_connection import VectorDBConnection
9
9
  from vector_inspector.core.logging import log_error
10
10
 
11
11
 
@@ -229,9 +229,15 @@ class PineconeConnection(VectorDBConnection):
229
229
  Returns:
230
230
  True if successful, False otherwise
231
231
  """
232
- if not embeddings:
233
- log_error("Embeddings are required for Pinecone")
234
- return False
232
+ # If embeddings not provided, compute using base helper
233
+ if not embeddings and documents:
234
+ try:
235
+ embeddings = self.compute_embeddings_for_documents(
236
+ collection_name, documents, getattr(self, "connection_id", None)
237
+ )
238
+ except Exception as e:
239
+ log_error("Embeddings are required for Pinecone and computing them failed: %s", e)
240
+ return False
235
241
 
236
242
  index = self._get_index(collection_name)
237
243
  if not index:
@@ -660,6 +666,20 @@ class PineconeConnection(VectorDBConnection):
660
666
 
661
667
  # Update document
662
668
  if documents and i < len(documents):
669
+ # If embedding not supplied, compute for this updated document
670
+ if (
671
+ embeddings is None or i >= len(embeddings) or embeddings[i] is None
672
+ ) and documents[i]:
673
+ try:
674
+ computed = self.compute_embeddings_for_documents(
675
+ collection_name,
676
+ [documents[i]],
677
+ getattr(self, "connection_id", None),
678
+ )
679
+ if computed:
680
+ values = computed[0]
681
+ except Exception as e:
682
+ log_error("Failed to compute embedding for Pinecone update: %s", e)
663
683
  metadata["document"] = documents[i]
664
684
 
665
685
  vectors.append({"id": vid, "values": values, "metadata": metadata})