mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-12 12:59:07 +00:00
Add new iFixit document loader (#1333)
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.
This commit is contained in:
1
tests/integration_tests/document_loaders/__init__.py
Normal file
1
tests/integration_tests/document_loaders/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Test document loader integrations."""
|
37
tests/integration_tests/document_loaders/test_ifixit.py
Normal file
37
tests/integration_tests/document_loaders/test_ifixit.py
Normal file
@@ -0,0 +1,37 @@
|
||||
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"
|
Reference in New Issue
Block a user