From 08c466c6033807241328fd83c2a0f878822d7335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=2E=20Lance=20E=20Sloan=20=C2=ABUMich=C2=BB?= Date: Wed, 12 Jun 2024 12:29:34 -0400 Subject: [PATCH] community[patch]: bugfix for `YoutubeLoader`'s `LINES` format (#22815) - **Description:** A change I submitted recently introduced a bug in `YoutubeLoader`'s `LINES` output format. In those conditions, curly braces ("`{}`") creates a set, not a dictionary. This bugfix explicitly specifies that a dictionary is created. - **Issue:** N/A - **Dependencies:** N/A - **Twitter:** lsloan_umich - **Mastodon:** [lsloan@mastodon.social](https://mastodon.social/@lsloan) --- .../community/langchain_community/document_loaders/youtube.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/community/langchain_community/document_loaders/youtube.py b/libs/community/langchain_community/document_loaders/youtube.py index 8f19471040c..c0eba554c12 100644 --- a/libs/community/langchain_community/document_loaders/youtube.py +++ b/libs/community/langchain_community/document_loaders/youtube.py @@ -282,11 +282,11 @@ class YoutubeLoader(BaseLoader): map( lambda transcript_piece: Document( page_content=transcript_piece["text"].strip(" "), - metadata={ + metadata=dict( filter( lambda item: item[0] != "text", transcript_piece.items() ) - }, + ), ), transcript_pieces, )