Add logging warning when no page number is found

This commit is contained in:
Nielson Janné 2025-03-28 18:56:01 +01:00
parent f3429a15b1
commit 5d86ad6961

View File

@ -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: