langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

[Prisma] How can i add extra columns?

Open erictt opened this issue 1 year ago • 0 comments

I'm very new to typescript, I don't quite understand the type is defined here:

https://github.com/hwchase17/langchainjs/blob/44b1ded0267445e1cbc54abe067fe820eb84840a/langchain/src/vectorstores/prisma.ts#L49-L51

In the same file, it specifies

type ColumnSymbol = typeof IdColumnSymbol | typeof ContentColumnSymbol;

To me, it seems like, i can't add any other columns except id and content.

But I want to add a metadata, how should i do it? Bellow is the example code i found in the doc:

    const store  = PrismaVectorStore.withModel<Document>(this.db).create(new OpenAIEmbeddings(), {
      prisma: Prisma,
      tableName: 'Document',
      vectorColumnName: 'vector',
      columns: {
        id: PrismaVectorStore.IdColumn,
        content: PrismaVectorStore.ContentColumn,
        metadata: WHAT SHOULD GOES HERE,
      },
    });

erictt avatar Apr 13 '23 21:04 erictt