forked from AI_team/Philosophy-RAG-demo
small refacter in ret_gen.py
- improve readability - reduce chance for potential mistake in future
This commit is contained in:
parent
cd14c8add2
commit
f3429a15b1
@ -48,10 +48,11 @@ class RetGenLangGraph:
|
|||||||
"""
|
"""
|
||||||
Method that retrieves the PDF sources used during the last invoke.
|
Method that retrieves the PDF sources used during the last invoke.
|
||||||
"""
|
"""
|
||||||
if self.last_invoke is None:
|
|
||||||
return []
|
|
||||||
|
|
||||||
pdf_sources = {}
|
pdf_sources = {}
|
||||||
|
|
||||||
|
if self.last_invoke is None:
|
||||||
|
return pdf_sources
|
||||||
|
|
||||||
for context in self.last_invoke["context"]:
|
for context in self.last_invoke["context"]:
|
||||||
try:
|
try:
|
||||||
Path(context.metadata["source"]).suffix == ".pdf"
|
Path(context.metadata["source"]).suffix == ".pdf"
|
||||||
@ -84,10 +85,11 @@ class RetGenLangGraph:
|
|||||||
"""
|
"""
|
||||||
Method that retrieves the web sources used during the last invoke.
|
Method that retrieves the web sources used during the last invoke.
|
||||||
"""
|
"""
|
||||||
if self.last_invoke is None:
|
|
||||||
return set()
|
|
||||||
|
|
||||||
web_sources = set()
|
web_sources = set()
|
||||||
|
|
||||||
|
if self.last_invoke is None:
|
||||||
|
return web_sources
|
||||||
|
|
||||||
for context in self.last_invoke["context"]:
|
for context in self.last_invoke["context"]:
|
||||||
try:
|
try:
|
||||||
context.metadata["filetype"] == "web"
|
context.metadata["filetype"] == "web"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user