Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vectorstores/typeorm.ts - TypeORMVectorStore.addDocuments() does NOT support options?: { ids?: string[] } param #7739

Open
5 tasks done
dkindlund opened this issue Feb 22, 2025 · 0 comments
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@dkindlund
Copy link

Checked other resources

  • 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

Currently, an upstream open-source project (Flowise) has encountered a bug when using the TypeORMVectorStore.addDocuments() function as described here:

FlowiseAI/Flowise#3570 (comment)

Essentially, Flowise performs this call when adding documents:

await vectorStore.addDocuments(docsToIndex, { ids: uids }) 

Ref: https://github.com/FlowiseAI/Flowise/blob/c0a74782d8f1dbe118d2ed3aa40dd292d25d9119/packages/components/src/indexing.ts#L300

Flowise ASSUMES that the second parameter {ids: uids} is getting passed correctly to the TypeORMVectorStore.addDocuments() function -- HOWEVER, that it seems the current implementation in typeorm does not support processing that second parameter at all:

async addDocuments(documents: Document[]): Promise<void> {

This causes the underlying RecordManager implementation in LangChain to fail, because there are no matching ids between the vector store and the record manager tables -- therefore, ANY cleanup modes (e.g., FULL, INCREMENTAL) will not work correctly.

In comparison, the vectorstores/pgvector.ts implementation does not suffer from this issue, as it correctly supports the second parameter:

async addDocuments(
documents: Document[],
options?: { ids?: string[] }
): Promise<void> {

So, while a workaround exists, this bug is to request that equivalent support be added to the typeorm implementation so that this bug does not exist.

Error Message and Stack Trace (if applicable)

No response

Description

When using the typeorm vector stores driver in Flowise, FULL and INCREMENTAL cleanup modes in the underlying LangChain RecordManager will fail due to this error.

System Info

"@langchain/core": "0.3.37"
platform: linux

@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant