We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7cc001 commit 4ad551bCopy full SHA for 4ad551b
src/neo4j_graphrag/generation/graphrag.py
@@ -225,9 +225,16 @@ def _build_query(
225
226
def is_langchain_compatible(self) -> bool:
227
"""Checks if the LLM is compatible with LangChain."""
228
- return isinstance(self.llm, LLMInterfaceV2) or self.llm.__module__.startswith(
229
- "langchain"
230
- )
+ if isinstance(self.llm, LLMInterfaceV2):
+ return True
+
231
+ try:
232
+ # langchain-core is an optional dependency
233
+ from langchain_core.language_models import BaseChatModel
234
235
+ return isinstance(self.llm, BaseChatModel)
236
+ except ImportError:
237
+ return False
238
239
def _chat_summary_prompt(self, message_history: List[LLMMessage]) -> str:
240
message_list = [
0 commit comments