About this project
SQLiteVecData provides Swift integration between SQLiteData and sqlite-vec, allowing developers to create vec0 virtual tables and perform vector similarity queries entirely in Swift. It supports Apple platforms via `loadSQLiteVecExtension` and non-Apple platforms via `registerSQLiteVecAutoExtension`. Key features include:
- **vec0 table creation**: Define virtual tables with vector columns (e.g., `FLOAT[1536]`) and model them in Swift using the `Vec0` protocol.
- **Match queries**: Filter rows by vector similarity using `match`, and order by the `distance` column for nearest-neighbor results.
- **Distance functions**: Compute cosine or other distances directly in select clauses.
- **Vector iteration**: Use `vecEach()` to iterate over vector elements, enabling correlated subqueries, filtering, and aggregation.
- **EmbeddingVector**: A fixed-length, Hashable, Codable array type for modern Apple platforms (iOS 26+, macOS 26+, etc.) that can be stored in vec0 tables or used as query bindings.
- **Test support**: Includes `SQLiteVecDataTestSupport` with Swift Testing traits for Linux and Apple platforms.
- **Performance**: Ships with NEON (ARM) and AVX (x86) SIMD traits for optimized vector operations.
The package also exports `StructuredQueriesSQLiteVecCore`, a standalone set of query helpers for those not using SQLiteData directly. Installation is via Swift Package Manager or Xcode, and the library is MIT licensed.
Comments
0 people shared their preference · Deer Point appears after 10 participants
Sign in to join the discussion.