Supabase.Storage.Vector.Behaviour behaviour (supabase_storage v0.6.1)

Copy Markdown

Defines the behaviour interface for vector bucket operations.

This behaviour specifies the contract that implementations of vector storage management must follow. It includes operations for creating, retrieving, listing, and deleting vector buckets.

Summary

Types

Vector client instance

Supabase client instance

Options for listing vector buckets.

Vector bucket metadata

Types

bucket()

@type bucket() :: Supabase.Storage.Vector.t()

Vector client instance

client()

@type client() :: Supabase.Client.t()

Supabase client instance

create_index_opt()

@type create_index_opt() ::
  {:vector_bucket_name, String.t()}
  | {:index_name, String.t()}
  | {:data_type, Supabase.Storage.Vector.Index.data_type()}
  | {:distance_metric, Supabase.Storage.Vector.Index.distance_metric()}
  | {:metadata_configuration,
     %{non_filterable_metadata_keys: [String.t()]} | nil}

list_opt()

@type list_opt() ::
  {:prefix, String.t() | nil}
  | {:max_results, integer() | nil}
  | {:next_token, String.t() | nil}

Options for listing vector buckets.

Options

  • {:prefix, String.t() | nil} - Filter buckets by name prefix

  • {:max_results, integer | nil} - Maximum number of results to return (default: 100)

  • {:next_token, String.t() | nil} - Pagination token from previous response

metadata()

@type metadata() :: Supabase.Storage.Vector.Metadata.t()

Vector bucket metadata

Callbacks

create_bucket(bucket, name)

@callback create_bucket(bucket(), name :: String.t()) :: Supabase.result(:created)

create_index(bucket, t)

@callback create_index(bucket(), Enumerable.t(create_index_opt())) ::
  Supabase.result(:created)

delete_bucket(bucket, name)

@callback delete_bucket(bucket(), name :: String.t()) :: Supabase.result(:deleted)

delete_index(bucket, name)

@callback delete_index(bucket(), name :: String.t()) :: Supabase.result(:deleted)

from(client)

@callback from(client()) :: bucket()

from(client, t)

@callback from(client(), Enumerable.t(opt)) :: bucket()
when opt:
       {:vector_bucket_name, String.t() | nil}
       | {:vector_index_name, String.t() | nil}

get_bucket(bucket, name)

@callback get_bucket(bucket(), name :: String.t()) :: Supabase.result(metadata() | nil)

get_index(bucket, name)

@callback get_index(bucket(), name :: String.t()) ::
  Supabase.result(Supabase.Storage.Vector.Index.t())

list_buckets(bucket, t)

@callback list_buckets(bucket(), Enumerable.t(list_opt())) ::
  Supabase.result(%{
    vector_buckets: [
      %{vector_bucket_name: String.t(), next_token: String.t() | nil}
    ]
  })

list_indexes(bucket, t)

@callback list_indexes(
  bucket(),
  Enumerable.t(list_opt() | {:vector_bucket_name, String.t()})
) ::
  Supabase.result(%{
    indexes: [%{index_name: String.t(), next_token: String.t() | nil}]
  })