The PineconeHandshake class provides seamless integration between Chonkie’s chunking system and Pinecone, a managed vector database.Embed and store your Chonkie chunks in Pinecone directly from the Chonkie SDK.
from chonkie import PineconeHandshake, SemanticChunker # Initialize the handshakehandshake = PineconeHandshake(api_key="YOUR_API_KEY", index_name="my_documents")# Create some chunkschunker = SemanticChunker()chunks = chunker.chunk("Chonkie loves to chonk your texts!")# Write chunks to Pineconehandshake.write(chunks)
You can retrieve the most similar chunks from your Pinecone index using the search method:
Copy
Ask AI
from chonkie import PineconeHandshake# Initialize the handshakehandshake = PineconeHandshake(api_key="YOUR_API_KEY", index_name="my_documents")results = handshake.search(query="chonk your texts", limit=2)for result in results: print(result["score"], result["text"])