本页还没有译文
本页 25 段还没译成简体中文,下面显示的是英文原文。Creating Vector Buckets
还没翻译译自英文(supabase.com)本页 25 段都还没译
This feature is in alpha
Expect rapid changes, limited features, and possible breaking updates. Share feedback as we refine the experience and expand access.
Vector buckets organize your vector data into logical units. Within each bucket, you create indexes that define how vectors are stored and searched based on their dimensions and distance metrics.
Creating a Vector bucket
You can create vector buckets using either the Supabase Dashboard or the SDK.
Using the Supabase Dashboard
- Navigate to the Storage section in the Supabase Dashboard.
- Click Create Bucket.
- Enter a name for your bucket (e.g.,
embeddingsorsemantic-search). - Select Vector Bucket as the bucket type.
- Click Create.
Your vector bucket is now ready. The next step is to create indexes within it.
Using the SDK
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://your-project-id.supabase.co', 'your-service-key')
// Create a vector bucket
await supabase.storage.vectors.createBucket('embeddings')
console.log('✓ Vector bucket created: embeddings')from supabase import create_client
supabase = create_client('https://your-project-id.supabase.co', 'your-service-key')
# Create a vector bucket
supabase.storage.vectors().create_bucket('embeddings')
print('✓ Vector bucket created: embeddings')Creating indexes
Indexes organize vectors within a bucket with consistent dimensions and distance metrics. For comprehensive index management documentation, see Working with Vector Indexes.
Quick start: Creating an index via Dashboard
- Open your vector bucket.
- Click Create Index.
- Enter an index name (e.g.,
documents-openai). - Set the dimension matching your embeddings (e.g.,
1536for OpenAI's text-embedding-3-small). - Select the distance metric (
cosine,euclidean, orl2). - Click Create.
Quick start: Creating an index via SDK
const bucket = supabase.storage.vectors.from('embeddings')
// Create an index
await bucket.createIndex({
indexName: 'documents-openai',
dataType: 'float32',
dimension: 1536,
distanceMetric: 'cosine',
})
console.log('✓ Index created: documents-openai')bucket = supabase.storage.vectors().from_('embeddings')
# Create an index
bucket.create_index(
index_name='documents-openai',
dimension=1536,
distance_metric='cosine',
data_type='float32'
)
print('✓ Index created: documents-openai')Key details
- Dimension must match your embedding model (e.g., 1536 for OpenAI)
- Distance metric (
cosine,euclidean, orl2) is immutable after creation - Maximum indexes per bucket: 10
- Maximum batch size: 500 vectors per operation
For detailed information on distance metrics, embedding dimensions, managing multiple indexes, and advanced index operations, see Working with Vector Indexes.
Next steps
After creating your bucket and indexes, you can: