This commit is contained in:
Bagatur
2024-06-06 14:45:05 -07:00
parent 2e1dc2c660
commit 8616e1c44a
3 changed files with 4 additions and 3 deletions

View File

@@ -199,7 +199,8 @@ class RecursiveUrlLoader(BaseLoader):
if depth + 1 < self.max_depth:
for link in self._extract_sub_links(text, url):
if link not in visited:
yield from self._lazy_load_recursive(link, visited, depth=depth + 1)
for doc in self._lazy_load_recursive(link, visited, depth=depth + 1):
yield doc
if link not in visited:
raise ValueError

View File

@@ -32,7 +32,7 @@ def test_async_recursive_url_loader_deterministic() -> None:
def test_sync_recursive_url_loader() -> None:
url = "https://docs.python.org/3.9/"
url = "https://python.langchain.com/"
loader = RecursiveUrlLoader(
url,
extractor=lambda _: "placeholder",

View File

@@ -121,4 +121,4 @@ def extract_sub_links(
continue
results.append(path)
return results
return sorted(results)