Vectorstore Pinecone Backend
The Pinecone backend: a managed service.
See https://www.pinecone.io/. A vectorstore is one serverless Pinecone index. Its API key is
the Secret of the vectorstore’s ApiConnection. The backend embeds the chunks itself and calls the
Pinecone index directly. The chunks’ text is in the metadata’s text, where LangChain’s
PineconeVectorStore stores it, so indexes that it wrote stay searchable. Dumps are Pinecone backups, which Pinecone keeps,
and which require a paid Pinecone plan.
- class smarter.apps.vectorstore.backends.pinecone.PineconeBackend(vectorstore, embeddings=None, client=None)[source]
Bases:
SmarterVectorstoreBackendThe Pinecone backend.
- Parameters:
client (
Pinecone|None) – A Pinecone client, e.g. a mock in tests. By default it is created with the API key of the vectorstore’s ApiConnection.
- property client: Pinecone
- property index
- infrastructure_ready()[source]
Whether the index is ready.
Pinecone takes a little while to initialize a new one.
- restore_snapshot(name)[source]
Replace the index with a new one from the backup.
Pinecone requires that the index is deleted first.
- Return type:
- search(query, k=4, search_type='similarity', score_threshold=None, fetch_k=None, lambda_mult=None, metadata_filter=None)[source]
Search the index with the query’s embedding.
Scores are Pinecone’s raw scores for the index’s metric. MMR re-ranks
fetch_kmatches for diversity, and its results have no score.- Return type:
list[SearchResult]