Overview
TheSolVec class is the main entry point for the VecLabs Python SDK. It manages connections to the Solana network and provides access to vector collections.
Constructor
Parameters
Solana network to connect to. Options:
"mainnet-beta"- Production Solana mainnet"devnet"- Solana devnet for testing"localnet"- Local Solana validator
Path to your Solana keypair JSON file. Required for write operations (upsert, delete).Example:
"~/.config/solana/id.json"Custom RPC URL. If not provided, uses default RPC for the selected network.Use this for premium RPC providers like Helius or QuickNode for better performance.
Raises
ValueError- If an invalid network name is provided
Methods
collection()
Get or create a vector collection. Equivalent to Pinecone’sIndex().
Parameters
Collection name (maximum 64 characters). Used as a unique identifier for the collection.
Vector dimension. Default is 1536, which matches OpenAI’s
text-embedding-3-small and text-embedding-ada-002 models.Common dimensions:1536- OpenAI embeddings768- Sentence transformers384- MiniLM models
Distance metric for similarity search. Options:
"cosine"orDistanceMetric.COSINE- Cosine similarity (recommended for most use cases)"euclidean"orDistanceMetric.EUCLIDEAN- Euclidean distance"dot"orDistanceMetric.DOT- Dot product
Returns
A
SolVecCollection instance for performing vector operations.Example
list_collections()
List all collection names in the current session.Returns
List of collection names that have been accessed in this session.
Example
Class Attributes
RPC_URLS
Default RPC URLs for each Solana network:Complete Example
Notes
- Collections are cached in memory per
SolVecinstance - Calling
collection()multiple times with the same name returns the same instance - The SDK is designed to be Pinecone-compatible for easy migration