mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 21:37:20 +00:00
elasticsearch[patch], community[patch]: update references, deprecate community classes (#18506)
Follow up on https://github.com/langchain-ai/langchain/pull/17467. - Update all references to the Elasticsearch classes to use the partners package. - Deprecate community classes. --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import logging
|
||||
from time import time
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Optional
|
||||
|
||||
from langchain_core._api import deprecated
|
||||
from langchain_core.chat_history import BaseChatMessageHistory
|
||||
from langchain_core.messages import (
|
||||
BaseMessage,
|
||||
@@ -16,6 +17,7 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@deprecated("0.0.27", alternative="Use langchain-elasticsearch package", pending=True)
|
||||
class ElasticsearchChatMessageHistory(BaseChatMessageHistory):
|
||||
"""Chat message history that stores history in Elasticsearch.
|
||||
|
||||
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, List, Optional
|
||||
|
||||
from langchain_core._api import deprecated
|
||||
from langchain_core.utils import get_from_env
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -11,6 +12,9 @@ if TYPE_CHECKING:
|
||||
from langchain_core.embeddings import Embeddings
|
||||
|
||||
|
||||
@deprecated(
|
||||
"0.1.11", alternative="Use class in langchain-elasticsearch package", pending=True
|
||||
)
|
||||
class ElasticsearchEmbeddings(Embeddings):
|
||||
"""Elasticsearch embedding models.
|
||||
|
||||
|
@@ -50,6 +50,11 @@ def _default_script_query(query_vector: List[float], filter: Optional[dict]) ->
|
||||
}
|
||||
|
||||
|
||||
@deprecated(
|
||||
"0.0.27",
|
||||
alternative="Use ElasticsearchStore class in langchain-elasticsearch package",
|
||||
pending=True,
|
||||
)
|
||||
class ElasticVectorSearch(VectorStore):
|
||||
"""
|
||||
|
||||
@@ -358,7 +363,11 @@ class ElasticVectorSearch(VectorStore):
|
||||
self.client.delete(index=self.index_name, id=id)
|
||||
|
||||
|
||||
@deprecated("0.0.1", alternative="ElasticsearchStore class.", pending=True)
|
||||
@deprecated(
|
||||
"0.0.1",
|
||||
alternative="Use ElasticsearchStore class in langchain-elasticsearch package",
|
||||
pending=True,
|
||||
)
|
||||
class ElasticKnnSearch(VectorStore):
|
||||
"""[DEPRECATED] `Elasticsearch` with k-nearest neighbor search
|
||||
(`k-NN`) vector store.
|
||||
|
@@ -15,6 +15,7 @@ from typing import (
|
||||
)
|
||||
|
||||
import numpy as np
|
||||
from langchain_core._api import deprecated
|
||||
from langchain_core.documents import Document
|
||||
from langchain_core.embeddings import Embeddings
|
||||
from langchain_core.vectorstores import VectorStore
|
||||
@@ -113,6 +114,9 @@ class BaseRetrievalStrategy(ABC):
|
||||
return True
|
||||
|
||||
|
||||
@deprecated(
|
||||
"0.0.27", alternative="Use class in langchain-elasticsearch package", pending=True
|
||||
)
|
||||
class ApproxRetrievalStrategy(BaseRetrievalStrategy):
|
||||
"""Approximate retrieval strategy using the `HNSW` algorithm."""
|
||||
|
||||
@@ -233,6 +237,9 @@ class ApproxRetrievalStrategy(BaseRetrievalStrategy):
|
||||
}
|
||||
|
||||
|
||||
@deprecated(
|
||||
"0.0.27", alternative="Use class in langchain-elasticsearch package", pending=True
|
||||
)
|
||||
class ExactRetrievalStrategy(BaseRetrievalStrategy):
|
||||
"""Exact retrieval strategy using the `script_score` query."""
|
||||
|
||||
@@ -300,6 +307,9 @@ class ExactRetrievalStrategy(BaseRetrievalStrategy):
|
||||
}
|
||||
|
||||
|
||||
@deprecated(
|
||||
"0.0.27", alternative="Use class in langchain-elasticsearch package", pending=True
|
||||
)
|
||||
class SparseRetrievalStrategy(BaseRetrievalStrategy):
|
||||
"""Sparse retrieval strategy using the `text_expansion` processor."""
|
||||
|
||||
@@ -381,6 +391,9 @@ class SparseRetrievalStrategy(BaseRetrievalStrategy):
|
||||
return False
|
||||
|
||||
|
||||
@deprecated(
|
||||
"0.0.27", alternative="Use class in langchain-elasticsearch package", pending=True
|
||||
)
|
||||
class ElasticsearchStore(VectorStore):
|
||||
"""`Elasticsearch` vector store.
|
||||
|
||||
|
Reference in New Issue
Block a user