From 6463d2d0bdb883d36f0e46936b36a0002ff571a4 Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 29 Nov 2023 11:42:29 +0800 Subject: [PATCH] small fix matching engine AttributeError - object has no attribute (#13763) This PR is fixing an attributeError: object endpoint has no attribute "_public_match_client" when using gcp matching engine with private VPC network. @baskaryan, @eyurtsev, @hwchase17. --------- Co-authored-by: Harrison Chase --- libs/langchain/langchain/vectorstores/matching_engine.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/langchain/langchain/vectorstores/matching_engine.py b/libs/langchain/langchain/vectorstores/matching_engine.py index a480580a760..39f27094f1f 100644 --- a/libs/langchain/langchain/vectorstores/matching_engine.py +++ b/libs/langchain/langchain/vectorstores/matching_engine.py @@ -233,7 +233,9 @@ class MatchingEngine(VectorStore): filter = filter or [] # If the endpoint is public we use the find_neighbors function. - if self.endpoint._public_match_client: + if hasattr(self.endpoint, "_public_match_client") and ( + self.endpoint._public_match_client + ): response = self.endpoint.find_neighbors( deployed_index_id=self._get_index_id(), queries=[embedding],