diff --git a/generic_rag/graphs/ret_gen.py b/generic_rag/graphs/ret_gen.py index b3c97f4..c30d6e2 100644 --- a/generic_rag/graphs/ret_gen.py +++ b/generic_rag/graphs/ret_gen.py @@ -1,3 +1,4 @@ +import logging from pathlib import Path from typing import Any, Union @@ -7,6 +8,9 @@ from langgraph.checkpoint.memory import MemorySaver from langgraph.graph import END, START, StateGraph from typing_extensions import List, TypedDict +logging.basicConfig(level=logging.INFO) +logger = logging.getLogger(__name__) + class State(TypedDict): question: str @@ -79,6 +83,9 @@ class RetGenLangGraph: else: pdf_sources[source].add(page_number) + if len(pdf_sources[source]) == 0: + logging.warning(f"PDF source {source} has no page number. Please check the metadata of the document.") + return pdf_sources def get_last_web_sources(self) -> set: