Skip to content

Commit 49b3d6c

Browse files
hwchase17rubensmau
andauthored
Harrison/wiki update (#622)
Co-authored-by: Rubens Mau <[email protected]>
1 parent 1ac3319 commit 49b3d6c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

langchain/docstore/wikipedia.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def search(self, search: str) -> Union[str, Document]:
3030

3131
try:
3232
page_content = wikipedia.page(search).content
33-
result: Union[str, Document] = Document(page_content=page_content)
33+
url = wikipedia.page(search).url
34+
result: Union[str, Document] = Document(
35+
page_content=page_content, metadata={"page": url}
36+
)
3437
except wikipedia.PageError:
3538
result = f"Could not find [{search}]. Similar: {wikipedia.search(search)}"
3639
except wikipedia.DisambiguationError:

0 commit comments

Comments
 (0)