SqliteVec

Hex PackageHex DocsBuild Status

A wrapper to use sqlite-vec, a SQLite extension for working with vectors, in Elixir. The configured version of the precompiled loadable library will be downloaded from the GitHub releases. Moreover, this package provides structs and custom Ecto types for working with Float32, Int8, and Bit vectors.

Limitations

Installation

The package can be installed by adding sqlite_vec to your list of dependencies in mix.exs:

def deps do
  [
    {:sqlite_vec, "~> 0.1.0"}
  ]
end

Getting Started

SqliteVec.path/0 returns the path of the downloaded library. Therefore, you can load the extension using this path.

For instance with Exqlite:

{:ok, conn} = Basic.open(":memory:")
:ok = Basic.enable_load_extension(conn)

Basic.load_extension(conn, SqliteVec.path())

Or, with SQLite configured as Ecto.Repo:

defmodule MyApp.Repo do
  use Ecto.Repo,
    otp_app: :my_app,
    adapter: Ecto.Adapters.SQLite3
end

config :my_app, MyApp.Repo, load_extensions: [SqliteVec.path()]

You can check out the Getting Started and Usage with Ecto notebooks.

Attribution

Special thanks to these projects that helped to make this package: