forked from AI_team/Philosophy-RAG-demo
Add logging warning when no page number is found
This commit is contained in:
parent
f3429a15b1
commit
5d86ad6961
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Union
|
from typing import Any, Union
|
||||||
|
|
||||||
@ -7,6 +8,9 @@ from langgraph.checkpoint.memory import MemorySaver
|
|||||||
from langgraph.graph import END, START, StateGraph
|
from langgraph.graph import END, START, StateGraph
|
||||||
from typing_extensions import List, TypedDict
|
from typing_extensions import List, TypedDict
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class State(TypedDict):
|
class State(TypedDict):
|
||||||
question: str
|
question: str
|
||||||
@ -79,6 +83,9 @@ class RetGenLangGraph:
|
|||||||
else:
|
else:
|
||||||
pdf_sources[source].add(page_number)
|
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
|
return pdf_sources
|
||||||
|
|
||||||
def get_last_web_sources(self) -> set:
|
def get_last_web_sources(self) -> set:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user