diff --git a/packages/@n8n/nodes-langchain/utils/helpers.ts b/packages/@n8n/nodes-langchain/utils/helpers.ts index 2ae4754e76..b67fa7bdcd 100644 --- a/packages/@n8n/nodes-langchain/utils/helpers.ts +++ b/packages/@n8n/nodes-langchain/utils/helpers.ts @@ -22,7 +22,7 @@ export function getMetadataFiltersValues( } export function isChatInstance(model: unknown): model is BaseChatModel { - const namespace = (model as BaseLLM | BaseChatModel).lc_namespace; + const namespace = (model as BaseLLM | BaseChatModel)?.lc_namespace ?? []; return namespace.includes('chat_models'); }