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:
Max Jakob
2024-03-07 00:09:12 +01:00
committed by GitHub
parent 6041ec3dd1
commit cca0167917
15 changed files with 72 additions and 34 deletions

View File

@@ -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.