Documentation

Everything you need to build with Vector Panda

Quick Start

Get started with Vector Panda in just a few minutes. This guide will walk you through installation, authentication, and your first vector search.

Prerequisites

You'll need Python 3.7+ and an API key from your Vector Panda dashboard.

Installation

Install the Vector Panda Python SDK using pip:

# Install via pip
pip install veep

# Or with conda
conda install -c vectorpanda veep

For other languages, check our SDK documentation:

  • JavaScript/TypeScript: npm install @vectorpanda/client
  • Go: go get github.com/vectorpanda/go-client
  • Ruby: gem install vector_panda

Authentication

Initialize the Vector Panda client with your API key. You can find your API key in the dashboard under Settings → API Keys.

from veep import Client

# Initialize client
client = Client(api_key="your-api-key")

# Or use environment variable
import os
os.environ["VECTOR_PANDA_API_KEY"] = "your-api-key"
client = Client()  # Automatically uses env var
Security Note

Never commit your API key to version control. Use environment variables or a secrets manager.

Your First Query

Let's create a collection, add some vectors, and perform a search:

# Create or connect to a collection
collection = client.collection("my-first-collection")

# Add vectors with metadata
collection.upsert(
    id="doc1",
    vector=[0.1, 0.2, 0.3, 0.4],
    metadata={
        "title": "Introduction to Vector Search",
        "category": "tutorial"
    }
)

# Search for similar vectors
results = collection.search(
    vector=[0.15, 0.25, 0.35, 0.45],
    k=5,
    include_metadata=True
)

for result in results:
    print(f"ID: {result.id}, Score: {result.score}")
    print(f"Metadata: {result.metadata}")

Congratulations! You've just performed your first vector search with Vector Panda.

Collections

Collections are containers for your vectors. Each collection can store billions of vectors with their associated metadata.

Creating Collections

# Create a new collection
collection = client.collection("products")

# List all collections
collections = client.list_collections()
for col in collections:
    print(col.name, col.vector_count)

Collection Configuration

Vector Panda is zero-configuration by default, but you can customize settings if needed:

Setting Default Description
dimension Auto-detected Vector dimension (set on first insert)
metric cosine Distance metric: cosine, euclidean, dot
storage_tier warm Default tier: hot, warm, cold

Vectors & Embeddings

Vectors are numerical representations of your data. You can generate them using any embedding model and store them in Vector Panda.

Generating Embeddings

Example using OpenAI embeddings:

from openai import OpenAI

openai_client = OpenAI()

# Generate embedding for text
text = "Vector databases are amazing!"
response = openai_client.embeddings.create(
    input=text,
    model="text-embedding-3-small"
)
embedding = response.data[0].embedding

# Store in Vector Panda
collection.upsert(
    id="text1",
    vector=embedding,
    metadata={"text": text}
)

Supported Dimensions

Vector Panda supports vectors from 1 to 65,536 dimensions. Common embedding models produce vectors of these sizes:

  • OpenAI text-embedding-3-small: 1,536 dimensions
  • OpenAI text-embedding-3-large: 3,072 dimensions
  • Sentence Transformers: 384-768 dimensions
  • CLIP ViT-B/32: 512 dimensions

API Reference

Complete reference for all Vector Panda operations.

Search for the most similar vectors in a collection.

results = collection.search(
    vector=[0.1, 0.2, 0.3],      # Query vector
    k=10,                        # Number of results
    filters={                    # Optional metadata filters
        "category": "electronics",
        "price": {"$gte": 100, "$lte": 500}
    },
    include_metadata=True,       # Include metadata in results
    score_threshold=0.7          # Minimum similarity score
)

Upsert

Insert or update vectors in a collection.

# Single upsert
collection.upsert(
    id="product123",
    vector=[0.1, 0.2, 0.3],
    metadata={
        "name": "Laptop",
        "price": 999.99
    }
)

# Batch upsert
collection.upsert_batch(
    ids=["id1", "id2", "id3"],
    vectors=[[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]],
    metadata=[
        {"type": "A"},
        {"type": "B"},
        {"type": "C"}
    ]
)

Best Practices

1. Batch Operations

Use batch operations for better performance when dealing with multiple vectors:

# Good: Batch insert
collection.upsert_batch(ids=ids, vectors=vectors, metadata=metadata)

# Avoid: Individual inserts in a loop
for i in range(len(ids)):
    collection.upsert(ids[i], vectors[i], metadata[i])

2. Metadata Design

Structure your metadata for efficient filtering:

# Good: Flat structure with indexed fields
metadata = {
    "category": "electronics",
    "price": 499.99,
    "brand": "TechCorp",
    "in_stock": True
}

# Avoid: Deeply nested structures
metadata = {
    "product": {
        "details": {
            "specs": {
                "category": "electronics"
            }
        }
    }
}

3. Storage Tier Selection

Choose the right storage tier for your use case:

  • Hot: Real-time applications, frequently accessed data
  • Warm: Most applications, balanced performance/cost
  • Cold: Archival, backup, rarely accessed data
Pro Tip

Start with warm tier and monitor your usage. Move to hot if you need <10ms latency consistently.