The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: langchain_community.vectorstores.azuresearch Raise LangChainException instead of bare Exception (#23935)
Marc Gibbonscc451effd17f
diff --git a/libs/community/langchain_community/vectorstores/azuresearch.py b/libs/community/langchain_community/vectorstores/azuresearch.pyindex 65bdae78c1..7d2142a1fb 100644--- a/libs/community/langchain_community/vectorstores/azuresearch.py+++ b/libs/community/langchain_community/vectorstores/azuresearch.py@@ -29,6 +29,7 @@ from langchain_core.callbacks import ()from langchain_core.documents import Documentfrom langchain_core.embeddings import Embeddings+from langchain_core.exceptions import LangChainExceptionfrom langchain_core.pydantic_v1 import root_validatorfrom langchain_core.retrievers import BaseRetrieverfrom langchain_core.utils import get_from_env@@ -463,7 +464,7 @@ class AzureSearch(VectorStore):response = self.client.upload_documents(documents=data)# Check if all documents were successfully uploadedif not all(r.succeeded for r in response):- raise Exception(response)+ raise LangChainException(response)# Reset datadata = []@@ -477,7 +478,7 @@ class AzureSearch(VectorStore):if all(r.succeeded for r in response):return idselse:- raise Exception(response)+ raise LangChainException(response)async def aadd_embeddings(self,@@ -521,7 +522,7 @@ class AzureSearch(VectorStore):response = await async_client.upload_documents(documents=data)# Check if all documents were successfully uploadedif not all(r.succeeded for r in response):- raise Exception(response)+ raise LangChainException(response)# Reset datadata = []@@ -536,7 +537,7 @@ class AzureSearch(VectorStore):if all(r.succeeded for r in response):return idselse:- raise Exception(response)+ raise LangChainException(response)def delete(self, ids: Optional[List[str]] = None, **kwargs: Any) -> bool:"""Delete by vector ID.@@ -1495,7 +1496,7 @@ class AzureSearchVectorStoreRetriever(BaseRetriever):"""Azure Search instance used to find similar documents."""search_type: str = "hybrid""""Type of search to perform. Options are "similarity", "hybrid",- "semantic_hybrid", "similarity_score_threshold", "hybrid_score_threshold",+ "semantic_hybrid", "similarity_score_threshold", "hybrid_score_threshold",or "semantic_hybrid_score_threshold"."""k: int = 4"""Number of documents to return."""