From f3429a15b1242b2aa4d9d075004d5aebadb29ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nielson=20Jann=C3=A9?= Date: Fri, 28 Mar 2025 18:19:55 +0100 Subject: [PATCH] small refacter in ret_gen.py - improve readability - reduce chance for potential mistake in future --- generic_rag/graphs/ret_gen.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/generic_rag/graphs/ret_gen.py b/generic_rag/graphs/ret_gen.py index c6f58d3..b3c97f4 100644 --- a/generic_rag/graphs/ret_gen.py +++ b/generic_rag/graphs/ret_gen.py @@ -48,10 +48,11 @@ class RetGenLangGraph: """ Method that retrieves the PDF sources used during the last invoke. """ - if self.last_invoke is None: - return [] - pdf_sources = {} + + if self.last_invoke is None: + return pdf_sources + for context in self.last_invoke["context"]: try: Path(context.metadata["source"]).suffix == ".pdf" @@ -84,10 +85,11 @@ class RetGenLangGraph: """ Method that retrieves the web sources used during the last invoke. """ - if self.last_invoke is None: - return set() - web_sources = set() + + if self.last_invoke is None: + return web_sources + for context in self.last_invoke["context"]: try: context.metadata["filetype"] == "web"