No extensions needed.
TripToJapan
"Forget vector databases. It's just a column type.
It's great being able to index and query Vector distances alongside other data in the same table as opposed to dealing with sync and drift between databases."
import { createClient } from '@libsql/client';
const db = createClient({
url: 'file:local.db',
});
await db.batch([
"CREATE TABLE movies (title, year, emb F32_BLOB(3))",
"CREATE INDEX movies_idx ON movies (
libsql_vector_idx(emb, 'metric=cosine')
)",
"INSERT INTO movies
VALUES ('Napoleon', 2023, vector('[1,2,3]'))"
]);
await db.execute(
"SELECT title, year
FROM vector_top_k('movies_idx', vector('[4,5,6]'), 3)
JOIN movies
ON movies.rowid = id;"
);
Are you ready?
Sign up and start building your next SQLite app in production with Turso.
Get Started