mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-28 10:39:23 +00:00
langchain[patch]: chat histories to handle optional community dependence (#21194)
This commit is contained in:
parent
c9119b0e75
commit
b5c3a04e4b
@ -1,32 +1,69 @@
|
||||
import warnings
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_core._api import LangChainDeprecationWarning
|
||||
from langchain._api import create_importer
|
||||
|
||||
from langchain._api.interactive_env import is_interactive_env
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import (
|
||||
AstraDBChatMessageHistory,
|
||||
CassandraChatMessageHistory,
|
||||
ChatMessageHistory,
|
||||
CosmosDBChatMessageHistory,
|
||||
DynamoDBChatMessageHistory,
|
||||
ElasticsearchChatMessageHistory,
|
||||
FileChatMessageHistory,
|
||||
FirestoreChatMessageHistory,
|
||||
MomentoChatMessageHistory,
|
||||
MongoDBChatMessageHistory,
|
||||
Neo4jChatMessageHistory,
|
||||
PostgresChatMessageHistory,
|
||||
RedisChatMessageHistory,
|
||||
RocksetChatMessageHistory,
|
||||
SingleStoreDBChatMessageHistory,
|
||||
SQLChatMessageHistory,
|
||||
StreamlitChatMessageHistory,
|
||||
UpstashRedisChatMessageHistory,
|
||||
XataChatMessageHistory,
|
||||
ZepChatMessageHistory,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"AstraDBChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"CassandraChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"ChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"CosmosDBChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"DynamoDBChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"ElasticsearchChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"FileChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"FirestoreChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"MomentoChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"MongoDBChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"Neo4jChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"PostgresChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"RedisChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"RocksetChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"SQLChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"SingleStoreDBChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"StreamlitChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"UpstashRedisChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"XataChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
"ZepChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
from langchain_community import chat_message_histories
|
||||
|
||||
# If not in interactive env, raise warning.
|
||||
if not is_interactive_env():
|
||||
warnings.warn(
|
||||
"Importing chat message histories from langchain is deprecated. Importing "
|
||||
"from langchain will no longer be supported as of langchain==0.2.0. "
|
||||
"Please import from langchain-community instead:\n\n"
|
||||
f"`from langchain_community.chat_message_histories import {name}`.\n\n"
|
||||
"To install langchain-community run `pip install -U langchain-community`.",
|
||||
category=LangChainDeprecationWarning,
|
||||
)
|
||||
|
||||
return getattr(chat_message_histories, name)
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"AstraDBChatMessageHistory",
|
||||
"ChatMessageHistory",
|
||||
"CassandraChatMessageHistory",
|
||||
"ChatMessageHistory",
|
||||
"CosmosDBChatMessageHistory",
|
||||
"DynamoDBChatMessageHistory",
|
||||
"ElasticsearchChatMessageHistory",
|
||||
@ -34,14 +71,14 @@ __all__ = [
|
||||
"FirestoreChatMessageHistory",
|
||||
"MomentoChatMessageHistory",
|
||||
"MongoDBChatMessageHistory",
|
||||
"Neo4jChatMessageHistory",
|
||||
"PostgresChatMessageHistory",
|
||||
"RedisChatMessageHistory",
|
||||
"RocksetChatMessageHistory",
|
||||
"SingleStoreDBChatMessageHistory",
|
||||
"SQLChatMessageHistory",
|
||||
"StreamlitChatMessageHistory",
|
||||
"SingleStoreDBChatMessageHistory",
|
||||
"UpstashRedisChatMessageHistory",
|
||||
"XataChatMessageHistory",
|
||||
"ZepChatMessageHistory",
|
||||
"UpstashRedisChatMessageHistory",
|
||||
"Neo4jChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.astradb import (
|
||||
AstraDBChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["AstraDBChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import AstraDBChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"AstraDBChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"AstraDBChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.cassandra import (
|
||||
CassandraChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["CassandraChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import CassandraChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"CassandraChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"CassandraChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.cosmos_db import (
|
||||
CosmosDBChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["CosmosDBChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import CosmosDBChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"CosmosDBChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"CosmosDBChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.dynamodb import (
|
||||
DynamoDBChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["DynamoDBChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import DynamoDBChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"DynamoDBChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"DynamoDBChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,27 @@
|
||||
from langchain_community.chat_message_histories.elasticsearch import (
|
||||
ElasticsearchChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["ElasticsearchChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import (
|
||||
ElasticsearchChatMessageHistory,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"ElasticsearchChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ElasticsearchChatMessageHistory",
|
||||
]
|
||||
|
@ -1,3 +1,25 @@
|
||||
from langchain_community.chat_message_histories.file import FileChatMessageHistory
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["FileChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import FileChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"FileChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"FileChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.firestore import (
|
||||
FirestoreChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["FirestoreChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import FirestoreChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"FirestoreChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"FirestoreChatMessageHistory",
|
||||
]
|
||||
|
@ -1,3 +1,21 @@
|
||||
from langchain_community.chat_message_histories.in_memory import ChatMessageHistory
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories.in_memory import ChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"ChatMessageHistory": "langchain_community.chat_message_histories"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = ["ChatMessageHistory"]
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.momento import (
|
||||
MomentoChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["MomentoChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import MomentoChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"MomentoChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"MomentoChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.mongodb import (
|
||||
MongoDBChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["MongoDBChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import MongoDBChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"MongoDBChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"MongoDBChatMessageHistory",
|
||||
]
|
||||
|
@ -1,3 +1,25 @@
|
||||
from langchain_community.chat_message_histories.neo4j import Neo4jChatMessageHistory
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["Neo4jChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import Neo4jChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"Neo4jChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"Neo4jChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.postgres import (
|
||||
PostgresChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["PostgresChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import PostgresChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"PostgresChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"PostgresChatMessageHistory",
|
||||
]
|
||||
|
@ -1,3 +1,25 @@
|
||||
from langchain_community.chat_message_histories.redis import RedisChatMessageHistory
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["RedisChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import RedisChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"RedisChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"RedisChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.rocksetdb import (
|
||||
RocksetChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["RocksetChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import RocksetChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"RocksetChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"RocksetChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,27 @@
|
||||
from langchain_community.chat_message_histories.singlestoredb import (
|
||||
SingleStoreDBChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["SingleStoreDBChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import (
|
||||
SingleStoreDBChatMessageHistory,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"SingleStoreDBChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"SingleStoreDBChatMessageHistory",
|
||||
]
|
||||
|
@ -1,8 +1,30 @@
|
||||
from langchain_community.chat_message_histories.sql import (
|
||||
BaseMessageConverter,
|
||||
DefaultMessageConverter,
|
||||
SQLChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import SQLChatMessageHistory
|
||||
from langchain_community.chat_message_histories.sql import (
|
||||
BaseMessageConverter,
|
||||
DefaultMessageConverter,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"BaseMessageConverter": "langchain_community.chat_message_histories.sql",
|
||||
"DefaultMessageConverter": "langchain_community.chat_message_histories.sql",
|
||||
"SQLChatMessageHistory": "langchain_community.chat_message_histories",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"BaseMessageConverter",
|
||||
|
@ -1,5 +1,25 @@
|
||||
from langchain_community.chat_message_histories.streamlit import (
|
||||
StreamlitChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["StreamlitChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import StreamlitChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"StreamlitChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"StreamlitChatMessageHistory",
|
||||
]
|
||||
|
@ -1,5 +1,27 @@
|
||||
from langchain_community.chat_message_histories.upstash_redis import (
|
||||
UpstashRedisChatMessageHistory,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["UpstashRedisChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import (
|
||||
UpstashRedisChatMessageHistory,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"UpstashRedisChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"UpstashRedisChatMessageHistory",
|
||||
]
|
||||
|
@ -1,3 +1,25 @@
|
||||
from langchain_community.chat_message_histories.xata import XataChatMessageHistory
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["XataChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import XataChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"XataChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"XataChatMessageHistory",
|
||||
]
|
||||
|
@ -1,3 +1,25 @@
|
||||
from langchain_community.chat_message_histories.zep import ZepChatMessageHistory
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["ZepChatMessageHistory"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.chat_message_histories import ZepChatMessageHistory
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"ZepChatMessageHistory": "langchain_community.chat_message_histories"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ZepChatMessageHistory",
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user