@@ -191,23 +191,14 @@ def _initialize_client(self, config: Optional[Dict] = None) -> Any:
191191 logger .debug ("Using Mem0 Platform backend (MemoryClient)" )
192192 return MemoryClient ()
193193
194+
195+
196+ # Vector search providers
194197 if os .environ .get ("NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER_VECTOR" ) and os .environ .get ("OPENSEARCH_HOST" ):
195198 raise RuntimeError ("""Conflicting backend configurations:
196199 Both NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER_VECTOR and OPENSEARCH_HOST environment variables are set.
197200 Please specify only one backend.""" )
198- if os .environ .get ("NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER" ) and os .environ .get ("NEPTUNE_DATABASE_ENDPOINT" ):
199- raise RuntimeError ("""Conflicting backend configurations:
200- Both NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER and NEPTUNE_DATABASE_ENDPOINT environment variables are set.
201- Please specify only one graph backend.""" )
202-
203- if os .environ .get ("NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER" ):
204- logger .debug ("Using Neptune Analytics graph backend (Mem0Memory with Neptune Analytics)" )
205- config = self ._configure_neptune_analytics_backend (config )
206- elif os .environ .get ("NEPTUNE_DATABASE_ENDPOINT" ):
207- logger .debug ("Using Neptune Database graph backend (Mem0Memory with Neptune Database)" )
208- config = self ._configure_neptune_backend (config )
209201
210- # Vector search providers
211202 if os .environ .get ("OPENSEARCH_HOST" ):
212203 logger .debug ("Using OpenSearch backend (Mem0Memory with OpenSearch)" )
213204 merged_config = self ._initialize_opensearch_client (config )
@@ -220,10 +211,21 @@ def _initialize_client(self, config: Optional[Dict] = None) -> Any:
220211 logger .debug ("Using FAISS backend (Mem0Memory with FAISS)" )
221212 merged_config = self ._initialize_faiss_client (config )
222213
214+
215+
223216 # Graph backend providers
217+ if os .environ .get ("NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER" ) and os .environ .get ("NEPTUNE_DATABASE_ENDPOINT" ):
218+ raise RuntimeError ("""Conflicting backend configurations:
219+ Both NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER and NEPTUNE_DATABASE_ENDPOINT environment variables are set.
220+ Please specify only one graph backend.""" )
221+
224222 if os .environ .get ("NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER" ):
225223 logger .debug ("Using Neptune Analytics graph backend (Mem0Memory with Neptune Analytics)" )
226- merged_config = self ._configure_neptune_analytics_graph_backend (merged_config )
224+ config = self ._configure_neptune_analytics_backend (config )
225+ elif os .environ .get ("NEPTUNE_DATABASE_ENDPOINT" ):
226+ logger .debug ("Using Neptune Database graph backend (Mem0Memory with Neptune Database)" )
227+ config = self ._configure_neptune_backend (config )
228+
227229
228230 return Mem0Memory .from_config (config_dict = merged_config )
229231
0 commit comments