mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
72ef69d1ba
iFixit is a wikipedia-like site that has a huge amount of open content on how to fix things, questions/answers for common troubleshooting and "things" related content that is more technical in nature. All content is licensed under CC-BY-SA-NC 3.0 Adding docs from iFixit as context for user questions like "I dropped my phone in water, what do I do?" or "My macbook pro is making a whining noise, what's wrong with it?" can yield significantly better responses than context free response from LLMs.
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from langchain.document_loaders.ifixit import IFixitLoader
|
|
|
|
|
|
def test_ifixit_loader() -> None:
|
|
"""Test iFixit loader."""
|
|
web_path = "https://www.ifixit.com/Guide/iPad+9+Battery+Replacement/151279"
|
|
loader = IFixitLoader(web_path)
|
|
assert loader.page_type == "Guide"
|
|
assert loader.id == "151279"
|
|
assert loader.web_path == web_path
|
|
|
|
|
|
def test_ifixit_loader_teardown() -> None:
|
|
web_path = "https://www.ifixit.com/Teardown/Banana+Teardown/811"
|
|
loader = IFixitLoader(web_path)
|
|
""" Teardowns are just guides by a different name """
|
|
assert loader.page_type == "Guide"
|
|
assert loader.id == "811"
|
|
|
|
|
|
def test_ifixit_loader_device() -> None:
|
|
web_path = "https://www.ifixit.com/Device/Standard_iPad"
|
|
loader = IFixitLoader(web_path)
|
|
""" Teardowns are just guides by a different name """
|
|
assert loader.page_type == "Device"
|
|
assert loader.id == "Standard_iPad"
|
|
|
|
|
|
def test_ifixit_loader_answers() -> None:
|
|
web_path = (
|
|
"https://www.ifixit.com/Answers/View/318583/My+iPhone+6+is+typing+and+"
|
|
"opening+apps+by+itself"
|
|
)
|
|
loader = IFixitLoader(web_path)
|
|
|
|
assert loader.page_type == "Answers"
|
|
assert loader.id == "318583"
|