For anyone who comes across this thread, Logan's suggestion is correct. PGVectorStore is compatible with Supabase vector stores
import { VectorStoreIndex } from "llamaindex";
import { PGVectorStore } from "llamaindex/vector-store/PGVectorStore";
let vectorStoreIndexInstance: VectorStoreIndex | undefined;
export async function getIndex() {
if (vectorStoreIndexInstance) {
return vectorStoreIndexInstance;
}
initSettings();
const pgvs = new PGVectorStore({
schemaName: PGVECTOR_SCHEMA,
tableName: PGVECTOR_TABLE,
clientConfig: {
user: PG_USER,
password: PG_PASSWORD,
host: PG_HOST,
port: PG_PORT,
database: PG_DATABASE,
},
});
// Optional - set your collection name, default is no filter on this field.
pgvs.setCollection(PGVECTOR_COLLECTION || "");
try {
vectorStoreIndexInstance = await VectorStoreIndex.fromVectorStore(pgvs);
return vectorStoreIndexInstance;
} catch (err) {
console.error(`Error getting VectorStoreIndex: ${err}`);
process.exit(1);
}
}