Find answers from the community

Updated 3 months ago

Supabase

At a glance

The community members are discussing the connectivity between LlamaIndex TS and Supabase. One community member is unsure if this integration is implemented yet, but notes that there is a Postgres vector store in LlamaIndex TS that may be compatible with Supabase. Another community member confirms that the PGVectorStore in LlamaIndex TS is compatible with Supabase vector stores and provides sample code to demonstrate how to use it.

Useful resources
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