Python SDK Quickstart
Get started with the Endee Python SDK to build powerful vector search applications. This guide will walk you through installation, setup, and creating your first index.
Requirements
- Python 3.8 or higher
- Endee Local server running (see Quick Start)
New to Endee? Set up your local environment first by following the Quick Start Guide.
Installation
Install the Endee Python SDK using pip:
pip install endeeSetup Endee and Create Index
Initialize the Client
The Endee client is the main interface for all vector operations. Initialize it to connect to your local server:
from endee import Endee
# Connect to local Endee server (defaults to localhost:8080)
client = Endee()Using Authentication? If your server has NDD_AUTH_TOKEN set, pass the same token when initializing:
client = Endee("your-auth-token")See Authentication for details.
Create a Dense Index
Create a vector index for semantic similarity search:
from endee import Precision
client.create_index(
name="my_vectors",
dimension=384,
space_type="cosine",
precision=Precision.INT8D
)Dense Index Parameters:
| Parameter | Description |
|---|---|
name | Unique name for your index |
dimension | Vector dimensionality (must match your embedding model’s output) |
space_type | Distance metric - "cosine", "l2", or "ip" (inner product) |
M | Graph connectivity - higher values increase recall but use more memory (default: 16) |
ef_con | Construction-time parameter - higher values improve index quality (default: 128) |
precision | Quantization precision (default: Precision.INT8D) |
Create a Hybrid Index
Hybrid indexes combine dense vector search with sparse vector search for improved retrieval. Add the sparse_dim parameter to enable hybrid search:
from endee import Precision
client.create_index(
name="my_hybrid_index",
dimension=384, # Dense vector dimension
sparse_dim=30000, # Sparse vector dimension (vocabulary size)
space_type="cosine",
precision=Precision.INT8D
)Additional Hybrid Parameter:
| Parameter | Description |
|---|---|
sparse_dim | Sparse vector dimension (e.g., vocabulary size for SPLADE) |
List and Access Indexes
# List all indexes
indexes = client.list_indexes()
# Get reference to an existing index
index = client.get_index(name="my_vectors")
# Delete an index
client.delete_index(name="my_vectors")Complete Example
Here’s a complete example putting it all together:
from endee import Endee, Precision
# Initialize client
client = Endee()
# Create a dense index
client.create_index(
name="documents",
dimension=384,
space_type="cosine",
precision=Precision.INT8D
)
# Get the index
index = client.get_index(name="documents")
# Add vectors
index.upsert([
{
"id": "doc1",
"vector": [0.1, 0.2, ...], # 384-dimensional vector
"meta": {"title": "First Document"},
"filter": {"category": "tech"}
},
{
"id": "doc2",
"vector": [0.3, 0.4, ...],
"meta": {"title": "Second Document"},
"filter": {"category": "science"}
}
])
# Query the index
results = index.query(
vector=[0.15, 0.25, ...],
top_k=5
)
for item in results:
print(f"ID: {item['id']}, Similarity: {item['similarity']}")Next Steps
Now that you have your index set up, learn how to: