mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-13 14:50:00 +00:00
Harrison/backwards compat (#740)
This commit is contained in:
parent
f9ddcb5705
commit
2ba1128095
@ -1,12 +1,39 @@
|
|||||||
"""Wrappers around embedding modules."""
|
"""Wrappers around embedding modules."""
|
||||||
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from langchain.embeddings.cohere import CohereEmbeddings
|
from langchain.embeddings.cohere import CohereEmbeddings
|
||||||
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
||||||
from langchain.embeddings.huggingface_hub import HuggingFaceHubEmbeddings
|
from langchain.embeddings.huggingface_hub import HuggingFaceHubEmbeddings
|
||||||
from langchain.embeddings.openai import OpenAIEmbeddings
|
from langchain.embeddings.openai import OpenAIEmbeddings
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"OpenAIEmbeddings",
|
"OpenAIEmbeddings",
|
||||||
"HuggingFaceEmbeddings",
|
"HuggingFaceEmbeddings",
|
||||||
"CohereEmbeddings",
|
"CohereEmbeddings",
|
||||||
"HuggingFaceHubEmbeddings",
|
"HuggingFaceHubEmbeddings",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: this is in here to maintain backwards compatibility
|
||||||
|
class HypotheticalDocumentEmbedder:
|
||||||
|
def __init__(self, *args: Any, **kwargs: Any):
|
||||||
|
logger.warning(
|
||||||
|
"Using a deprecated class. Please use "
|
||||||
|
"`from langchain.chains import HypotheticalDocumentEmbedder` instead"
|
||||||
|
)
|
||||||
|
from langchain.chains.hyde.base import HypotheticalDocumentEmbedder as H
|
||||||
|
|
||||||
|
return H(*args, **kwargs) # type: ignore
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_llm(cls, *args: Any, **kwargs: Any) -> Any:
|
||||||
|
logger.warning(
|
||||||
|
"Using a deprecated class. Please use "
|
||||||
|
"`from langchain.chains import HypotheticalDocumentEmbedder` instead"
|
||||||
|
)
|
||||||
|
from langchain.chains.hyde.base import HypotheticalDocumentEmbedder as H
|
||||||
|
|
||||||
|
return H.from_llm(*args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user