Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

VectorBucketScope

import { VectorBucketScope } from "https://esm.sh/@supabase/storage-js@2.89.0/dist/index.d.mts";
class VectorBucketScope extends VectorIndexApi {
constructor(
url: string,
headers: {
[key: string]: string;
}
,
vectorBucketName: string,
fetch?: Fetch,
);
private vectorBucketName;
 
createIndex(options: Omit<CreateIndexOptions, "vectorBucketName">): Promise<ApiResponse<undefined>>;
deleteIndex(indexName: string): Promise<ApiResponse<undefined>>;
getIndex(indexName: string): Promise<ApiResponse<{
index: VectorIndex;
}
>
>
;
index(indexName: string): VectorIndexScope;
listIndexes(options?: Omit<ListIndexesOptions, "vectorBucketName">): Promise<ApiResponse<ListIndexesResponse>>;
}

§Extends

§
VectorIndexApi
[src]

§Constructors

§
new VectorBucketScope(url: string, headers: {
[key: string]: string;
}
, vectorBucketName: string, fetch?: Fetch)
[src]
@example
const bucket = supabase.storage.vectors.from('embeddings-prod')

§Properties

§
vectorBucketName
[src]

§Methods

§
createIndex(options: Omit<CreateIndexOptions, "vectorBucketName">): Promise<ApiResponse<undefined>>
[src]
@param options
  • Index configuration (vectorBucketName is automatically set)
@return

Promise with empty response on success or error

@example
const bucket = supabase.storage.vectors.from('embeddings-prod')
await bucket.createIndex({
  indexName: 'documents-openai',
  dataType: 'float32',
  dimension: 1536,
  distanceMetric: 'cosine',
  metadataConfiguration: {
    nonFilterableMetadataKeys: ['raw_text']
  }
})
§
deleteIndex(indexName: string): Promise<ApiResponse<undefined>>
[src]
@param indexName
  • Name of the index to delete
@return

Promise with empty response on success or error

@example
const bucket = supabase.storage.vectors.from('embeddings-prod')
await bucket.deleteIndex('old-index')
§
getIndex(indexName: string): Promise<ApiResponse<{
index: VectorIndex;
}
>
>
[src]
@param indexName
  • Name of the index to retrieve
@return

Promise with index metadata or error

@example
const bucket = supabase.storage.vectors.from('embeddings-prod')
const { data } = await bucket.getIndex('documents-openai')
console.log('Dimension:', data?.index.dimension)
§
index(indexName: string): VectorIndexScope
[src]
@param indexName
  • Name of the index
@return

Index-scoped client with vector data operations

@example
const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')

// Insert vectors
await index.putVectors({
  vectors: [
    { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }
  ]
})

// Query similar vectors
const { data } = await index.queryVectors({
  queryVector: { float32: [...] },
  topK: 5
})
§
listIndexes(options?: Omit<ListIndexesOptions, "vectorBucketName">): Promise<ApiResponse<ListIndexesResponse>>
[src]
@param options
  • Listing options (vectorBucketName is automatically set)
@return

Promise with response containing indexes array and pagination token or error

@example
const bucket = supabase.storage.vectors.from('embeddings-prod')
const { data } = await bucket.listIndexes({ prefix: 'documents-' })