mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 03:26:17 +00:00
community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463)
Moved the following modules to new package langchain-community in a backwards compatible fashion: ``` mv langchain/langchain/adapters community/langchain_community mv langchain/langchain/callbacks community/langchain_community/callbacks mv langchain/langchain/chat_loaders community/langchain_community mv langchain/langchain/chat_models community/langchain_community mv langchain/langchain/document_loaders community/langchain_community mv langchain/langchain/docstore community/langchain_community mv langchain/langchain/document_transformers community/langchain_community mv langchain/langchain/embeddings community/langchain_community mv langchain/langchain/graphs community/langchain_community mv langchain/langchain/llms community/langchain_community mv langchain/langchain/memory/chat_message_histories community/langchain_community mv langchain/langchain/retrievers community/langchain_community mv langchain/langchain/storage community/langchain_community mv langchain/langchain/tools community/langchain_community mv langchain/langchain/utilities community/langchain_community mv langchain/langchain/vectorstores community/langchain_community mv langchain/langchain/agents/agent_toolkits community/langchain_community mv langchain/langchain/cache.py community/langchain_community mv langchain/langchain/adapters community/langchain_community mv langchain/langchain/callbacks community/langchain_community/callbacks mv langchain/langchain/chat_loaders community/langchain_community mv langchain/langchain/chat_models community/langchain_community mv langchain/langchain/document_loaders community/langchain_community mv langchain/langchain/docstore community/langchain_community mv langchain/langchain/document_transformers community/langchain_community mv langchain/langchain/embeddings community/langchain_community mv langchain/langchain/graphs community/langchain_community mv langchain/langchain/llms community/langchain_community mv langchain/langchain/memory/chat_message_histories community/langchain_community mv langchain/langchain/retrievers community/langchain_community mv langchain/langchain/storage community/langchain_community mv langchain/langchain/tools community/langchain_community mv langchain/langchain/utilities community/langchain_community mv langchain/langchain/vectorstores community/langchain_community mv langchain/langchain/agents/agent_toolkits community/langchain_community mv langchain/langchain/cache.py community/langchain_community ``` Moved the following to core ``` mv langchain/langchain/utils/json_schema.py core/langchain_core/utils mv langchain/langchain/utils/html.py core/langchain_core/utils mv langchain/langchain/utils/strings.py core/langchain_core/utils cat langchain/langchain/utils/env.py >> core/langchain_core/utils/env.py rm langchain/langchain/utils/env.py ``` See .scripts/community_split/script_integrations.sh for all changes
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from langchain_community.document_loaders.readthedocs import ReadTheDocsLoader
|
||||
|
||||
PARENT_DIR = Path(__file__).parent / "test_docs" / "readthedocs"
|
||||
|
||||
|
||||
@pytest.mark.requires("bs4")
|
||||
def test_main_id_main_content() -> None:
|
||||
loader = ReadTheDocsLoader(PARENT_DIR / "main_id_main_content")
|
||||
documents = loader.load()
|
||||
assert len(documents[0].page_content) != 0
|
||||
|
||||
|
||||
@pytest.mark.requires("bs4")
|
||||
def test_div_role_main() -> None:
|
||||
loader = ReadTheDocsLoader(PARENT_DIR / "div_role_main")
|
||||
documents = loader.load()
|
||||
assert len(documents[0].page_content) != 0
|
||||
|
||||
|
||||
@pytest.mark.requires("bs4")
|
||||
def test_custom() -> None:
|
||||
loader = ReadTheDocsLoader(
|
||||
PARENT_DIR / "custom",
|
||||
custom_html_tag=("article", {"role": "main"}),
|
||||
)
|
||||
documents = loader.load()
|
||||
assert len(documents[0].page_content) != 0
|
||||
|
||||
|
||||
@pytest.mark.requires("bs4")
|
||||
def test_nested_html_structure() -> None:
|
||||
loader = ReadTheDocsLoader(PARENT_DIR / "nested_html_structure")
|
||||
documents = loader.load()
|
||||
assert documents[0].page_content == "Hello World!"
|
||||
|
||||
|
||||
@pytest.mark.requires("bs4")
|
||||
def test_index_page() -> None:
|
||||
loader = ReadTheDocsLoader(PARENT_DIR / "index_page", exclude_links_ratio=0.5)
|
||||
documents = loader.load()
|
||||
assert len(documents[0].page_content) == 0
|
||||
|
||||
|
||||
@pytest.mark.requires("bs4")
|
||||
def test_empty() -> None:
|
||||
loader = ReadTheDocsLoader(
|
||||
PARENT_DIR / "custom",
|
||||
)
|
||||
documents = loader.load()
|
||||
assert len(documents[0].page_content) == 0
|
Reference in New Issue
Block a user