Skip to content

fix(community): Add INSERT support to PrismaVectorStore for ParentDocumentRetriever compatibility (#8833)#8948

Merged
Hunter Lovell (hntrl) merged 4 commits into
mainfrom
cb/fix-prisma-issue-with-doc-retriever-v0.x
Dec 12, 2025
Merged

fix(community): Add INSERT support to PrismaVectorStore for ParentDocumentRetriever compatibility (#8833)#8948
Hunter Lovell (hntrl) merged 4 commits into
mainfrom
cb/fix-prisma-issue-with-doc-retriever-v0.x

Conversation

@christian-bromann

Copy link
Copy Markdown
Member

Previously, PrismaVectorStore only used UPDATE statements when adding vectors, which caused silent failures when used with ParentDocumentRetriever. The retriever creates new child documents that don't exist in the database, so UPDATE statements would succeed but not create any records.

Changes:

  • Add new addDocumentsWithVectors method that uses INSERT statements to create records
  • Modify addDocuments to use addDocumentsWithVectors instead of addVectors
  • Maintain backward compatibility by keeping the original addVectors method unchanged
  • Add tests to verify the new behavior and ensure no regression

This fix ensures PrismaVectorStore works correctly with ParentDocumentRetriever while maintaining compatibility with existing code.

Fixes #8833

@changeset-bot

changeset-bot Bot commented Sep 12, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5543a9b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@langchain/community Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Sep 12, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
langchainjs-docs Ready Ready Preview Comment Sep 12, 2025 8:52pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
langchainjs-api-refs Ignored Ignored Sep 12, 2025 8:52pm

@vercel vercel Bot temporarily deployed to Preview – langchainjs-docs September 12, 2025 20:52 Inactive
@ivaaaan

Ivan (ivaaaan) commented Sep 20, 2025

Copy link
Copy Markdown

I've faced this issue. Basically, PrismaVectorStore is not usable if you're trying to store multiple chunks per document. Are there plans to merge this?

@christian-bromann

Copy link
Copy Markdown
Member Author

Hunter Lovell (@hntrl) is this good to go?

Comment thread libs/langchain-community/src/vectorstores/prisma.ts Outdated
…umentRetriever compatibility (#8833)

Previously, PrismaVectorStore only used UPDATE statements when adding vectors, which caused
silent failures when used with ParentDocumentRetriever. The retriever creates new child
documents that don't exist in the database, so UPDATE statements would succeed but not
create any records.

Changes:
- Add new `addDocumentsWithVectors` method that uses INSERT statements to create records
- Modify `addDocuments` to use `addDocumentsWithVectors` instead of `addVectors`
- Maintain backward compatibility by keeping the original `addVectors` method unchanged
- Add tests to verify the new behavior and ensure no regression

This fix ensures PrismaVectorStore works correctly with ParentDocumentRetriever while
maintaining compatibility with existing code.

Fixes #8833
Add INSERT support to PrismaVectorStore for compatibility with ParentDocumentRetriever.
@christian-bromann

Copy link
Copy Markdown
Member Author

Hunter Lovell (@hntrl) put the change behind a flag

@hntrl Hunter Lovell (hntrl) merged commit 6af735d into main Dec 12, 2025
32 checks passed
@hntrl Hunter Lovell (hntrl) deleted the cb/fix-prisma-issue-with-doc-retriever-v0.x branch December 12, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Issues related to `@langchain/community` pkg:@langchain/community ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can not use ParentDocumentRetriever with Prisma

3 participants