mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-12 12:59:07 +00:00
community[patch]: cross_encoders
flatten namespaces (#20183)
Issue `langchain_community.cross_encoders` didn't have flattening namespace code in the __init__.py file. Changes: - added code to flattening namespaces (used #20050 as a template) - added ut for a change - added missed `test_imports` for `chat_loaders` and `chat_message_histories` modules
This commit is contained in:
18
libs/community/tests/unit_tests/chat_loaders/test_imports.py
Normal file
18
libs/community/tests/unit_tests/chat_loaders/test_imports.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from langchain_community.chat_loaders import _module_lookup
|
||||
|
||||
EXPECTED_ALL = [
|
||||
"BaseChatLoader",
|
||||
"FolderFacebookMessengerChatLoader",
|
||||
"GMailLoader",
|
||||
"IMessageChatLoader",
|
||||
"LangSmithDatasetChatLoader",
|
||||
"LangSmithRunChatLoader",
|
||||
"SingleFileFacebookMessengerChatLoader",
|
||||
"SlackChatLoader",
|
||||
"TelegramChatLoader",
|
||||
"WhatsAppChatLoader",
|
||||
]
|
||||
|
||||
|
||||
def test_all_imports() -> None:
|
||||
assert set(_module_lookup.keys()) == set(EXPECTED_ALL)
|
@@ -0,0 +1,29 @@
|
||||
from langchain_community.chat_message_histories import _module_lookup
|
||||
|
||||
EXPECTED_ALL = [
|
||||
"AstraDBChatMessageHistory",
|
||||
"CassandraChatMessageHistory",
|
||||
"ChatMessageHistory",
|
||||
"CosmosDBChatMessageHistory",
|
||||
"DynamoDBChatMessageHistory",
|
||||
"ElasticsearchChatMessageHistory",
|
||||
"FileChatMessageHistory",
|
||||
"FirestoreChatMessageHistory",
|
||||
"MomentoChatMessageHistory",
|
||||
"MongoDBChatMessageHistory",
|
||||
"Neo4jChatMessageHistory",
|
||||
"PostgresChatMessageHistory",
|
||||
"RedisChatMessageHistory",
|
||||
"RocksetChatMessageHistory",
|
||||
"SQLChatMessageHistory",
|
||||
"SingleStoreDBChatMessageHistory",
|
||||
"StreamlitChatMessageHistory",
|
||||
"TiDBChatMessageHistory",
|
||||
"UpstashRedisChatMessageHistory",
|
||||
"XataChatMessageHistory",
|
||||
"ZepChatMessageHistory",
|
||||
]
|
||||
|
||||
|
||||
def test_all_imports() -> None:
|
||||
assert set(_module_lookup.keys()) == set(EXPECTED_ALL)
|
@@ -0,0 +1,14 @@
|
||||
from langchain_community.cross_encoders import __all__, _module_lookup
|
||||
|
||||
EXPECTED_ALL = [
|
||||
"BaseCrossEncoder",
|
||||
"FakeCrossEncoder",
|
||||
"HuggingFaceCrossEncoder",
|
||||
"SagemakerEndpointCrossEncoder",
|
||||
]
|
||||
|
||||
|
||||
def test_all_imports() -> None:
|
||||
"""Test that __all__ is correctly set."""
|
||||
assert set(__all__) == set(EXPECTED_ALL)
|
||||
assert set(__all__) == set(_module_lookup.keys())
|
Reference in New Issue
Block a user