arijeetmukherjee3108-droid opened a new pull request, #41625: URL: https://github.com/apache/beam/pull/41625
fixes #41623 `LangChainChunker` currently only imports `TextSplitter` from `langchain.text_splitter`, which raises an `ImportError` when using standalone `langchain-text-splitters` and silently skips `langchain_test.py`. `_LangChainTextSplitter.process` also passes the same `metadata` dict reference to every `Chunk` yielded from a document, so mutating `chunk.metadata` downstream affects all sibling chunks. - Import `TextSplitter` (and test splitters) from `langchain_text_splitters` first, falling back to `langchain.text_splitter`. - Pass `metadata.copy()` for each yielded `Chunk` and add a test verifying metadata independence in `langchain_test.py`. Tested locally with `pytest sdks/python/apache_beam/ml/rag/chunking/langchain_test.py -v`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
