From eefb49680ff27bf488021e36ae8525c9d13c1314 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Thu, 29 Feb 2024 16:58:33 -0800 Subject: [PATCH] multiple[patch]: fix deprecation versions (#18349) --- .../embeddings/azure_openai.py | 3 ++- .../langchain_community/embeddings/openai.py | 2 +- .../langchain_community/llms/google_palm.py | 2 +- .../storage/upstash_redis.py | 2 +- .../vectorstores/elastic_vector_search.py | 18 +++++++++++------- .../vectorstores/redis/base.py | 2 +- libs/core/langchain_core/prompts/chat.py | 4 ++-- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/libs/community/langchain_community/embeddings/azure_openai.py b/libs/community/langchain_community/embeddings/azure_openai.py index ec90c767148b7..db23dfc827150 100644 --- a/libs/community/langchain_community/embeddings/azure_openai.py +++ b/libs/community/langchain_community/embeddings/azure_openai.py @@ -1,4 +1,5 @@ """Azure OpenAI embeddings wrapper.""" + from __future__ import annotations import os @@ -14,7 +15,7 @@ @deprecated( - since="0.1.0", + since="0.0.9", removal="0.2.0", alternative_import="langchain_openai.AzureOpenAIEmbeddings", ) diff --git a/libs/community/langchain_community/embeddings/openai.py b/libs/community/langchain_community/embeddings/openai.py index a459a872c0742..5611f9d698914 100644 --- a/libs/community/langchain_community/embeddings/openai.py +++ b/libs/community/langchain_community/embeddings/openai.py @@ -139,7 +139,7 @@ async def _async_embed_with_retry(**kwargs: Any) -> Any: @deprecated( - since="0.1.0", + since="0.0.9", removal="0.2.0", alternative_import="langchain_openai.OpenAIEmbeddings", ) diff --git a/libs/community/langchain_community/llms/google_palm.py b/libs/community/langchain_community/llms/google_palm.py index 08946bbbfba63..b0e7e22c0947b 100644 --- a/libs/community/langchain_community/llms/google_palm.py +++ b/libs/community/langchain_community/llms/google_palm.py @@ -59,7 +59,7 @@ def _strip_erroneous_leading_spaces(text: str) -> str: return text -@deprecated("0.0.351", alternative_import="langchain_google_genai.GoogleGenerativeAI") +@deprecated("0.0.12", alternative_import="langchain_google_genai.GoogleGenerativeAI") class GooglePalm(BaseLLM, BaseModel): """ DEPRECATED: Use `langchain_google_genai.GoogleGenerativeAI` instead. diff --git a/libs/community/langchain_community/storage/upstash_redis.py b/libs/community/langchain_community/storage/upstash_redis.py index 7fc49b49c768c..ebe69c4dfb7fa 100644 --- a/libs/community/langchain_community/storage/upstash_redis.py +++ b/libs/community/langchain_community/storage/upstash_redis.py @@ -120,7 +120,7 @@ def yield_keys(self, *, prefix: Optional[str] = None) -> Iterator[str]: yield key -@deprecated("0.0.335", alternative="UpstashRedisByteStore") +@deprecated("0.0.1", alternative="UpstashRedisByteStore") class UpstashRedisStore(_UpstashRedisStore): """ BaseStore implementation using Upstash Redis diff --git a/libs/community/langchain_community/vectorstores/elastic_vector_search.py b/libs/community/langchain_community/vectorstores/elastic_vector_search.py index 058bde90d8bdf..a72ccc55e9b5c 100644 --- a/libs/community/langchain_community/vectorstores/elastic_vector_search.py +++ b/libs/community/langchain_community/vectorstores/elastic_vector_search.py @@ -358,7 +358,7 @@ def delete(self, ids: Optional[List[str]] = None, **kwargs: Any) -> None: self.client.delete(index=self.index_name, id=id) -@deprecated("0.0.265", alternative="ElasticsearchStore class.", pending=True) +@deprecated("0.0.1", alternative="ElasticsearchStore class.", pending=True) class ElasticKnnSearch(VectorStore): """[DEPRECATED] `Elasticsearch` with k-nearest neighbor search (`k-NN`) vector store. @@ -564,9 +564,11 @@ def knn_search( docs_and_scores = [ ( Document( - page_content=hit["_source"][page_content] - if source - else hit["fields"][page_content][0], + page_content=( + hit["_source"][page_content] + if source + else hit["fields"][page_content][0] + ), metadata=hit["fields"] if fields else {}, ), hit["_score"], @@ -647,9 +649,11 @@ def knn_hybrid_search( docs_and_scores = [ ( Document( - page_content=hit["_source"][page_content] - if source - else hit["fields"][page_content][0], + page_content=( + hit["_source"][page_content] + if source + else hit["fields"][page_content][0] + ), metadata=hit["fields"] if fields else {}, ), hit["_score"], diff --git a/libs/community/langchain_community/vectorstores/redis/base.py b/libs/community/langchain_community/vectorstores/redis/base.py index 78cbffcbc7d1e..814e8ee917e37 100644 --- a/libs/community/langchain_community/vectorstores/redis/base.py +++ b/libs/community/langchain_community/vectorstores/redis/base.py @@ -742,7 +742,7 @@ def as_retriever(self, **kwargs: Any) -> RedisVectorStoreRetriever: tags.extend(self._get_retriever_tags()) return RedisVectorStoreRetriever(vectorstore=self, **kwargs, tags=tags) - @deprecated("0.0.272", alternative="similarity_search(distance_threshold=0.1)") + @deprecated("0.0.1", alternative="similarity_search(distance_threshold=0.1)") def similarity_search_limit_score( self, query: str, k: int = 4, score_threshold: float = 0.2, **kwargs: Any ) -> List[Document]: diff --git a/libs/core/langchain_core/prompts/chat.py b/libs/core/langchain_core/prompts/chat.py index 86f261b51fd30..e4a2fdc4cc1bc 100644 --- a/libs/core/langchain_core/prompts/chat.py +++ b/libs/core/langchain_core/prompts/chat.py @@ -672,7 +672,7 @@ def from_template(cls, template: str, **kwargs: Any) -> ChatPromptTemplate: return cls.from_messages([message]) @classmethod - @deprecated("0.0.260", alternative="from_messages classmethod", pending=True) + @deprecated("0.0.1", alternative="from_messages classmethod", pending=True) def from_role_strings( cls, string_messages: List[Tuple[str, str]] ) -> ChatPromptTemplate: @@ -692,7 +692,7 @@ def from_role_strings( ) @classmethod - @deprecated("0.0.260", alternative="from_messages classmethod", pending=True) + @deprecated("0.0.1", alternative="from_messages classmethod", pending=True) def from_strings( cls, string_messages: List[Tuple[Type[BaseMessagePromptTemplate], str]] ) -> ChatPromptTemplate: