Find answers from the community

Updated 2 weeks ago

Supabase

do we have connectivity of LlamaIndex ts with Supabase? Please provide tutorial
L
D
2 comments
I don't think this is implemented yet.

I do see a postgres vector store, maybe it's compatible? Not sure tbh
https://github.com/run-llama/LlamaIndexTS/blob/main/packages/llamaindex/src/storage/vectorStore/PGVectorStore.ts
For anyone who comes across this thread, Logan's suggestion is correct. PGVectorStore is compatible with Supabase vector stores

Plain Text
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);
  }
}
Add a reply
Sign up and join the conversation on Discord