Skip to content

Can not use ParentDocumentRetriever with Prisma #8833

@justin-rwazi

Description

@justin-rwazi

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

File: node_modules\@langchain\community\dist\vectorstores\prisma.cjs
Function: addVectors
Line: 159
Error code:

await this.db.$transaction(vectors.map((vector, idx) => this.db.$executeRaw(this.Prisma.sql `UPDATE ${tableNameRaw}
            SET ${vectorColumnRaw} = ${`[${vector.join(",")}]`}::vector
            WHERE ${idColumnRaw} = ${documents[idx].metadata[this.idColumn]}
          `)));

Error Message and Stack Trace (if applicable)

No response

Description

Why it's a bug:

When integrate with ParentDocumentRetriever follow this doc: https://js.langchain.com/docs/how_to/parent_document_retriever/

  • ParentDocumentRetriever create child vector record automatically but prisma use UPDATE statement, it must be create or update
  • It doesn't throw any error cause SQL statement is successful but no record is created

System Info

Node 22
Windows/Mac
"@langchain/community": "^0.3.41",
"@langchain/core": "^0.3.49",

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions