{"record":{"id":"41db7a6b6815d9b3","repo":"mem0ai/mem0","slug":"model-parameter-is-required-41db7a","errorCode":null,"errorMessage":"`model` parameter is required","messagePattern":"`model` parameter is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/llms/langchain.py","lineNumber":18,"sourceCode":"from typing import Dict, List, Optional\n\nfrom mem0.configs.llms.base import BaseLlmConfig\nfrom mem0.llms.base import LLMBase\n\ntry:\n    from langchain.chat_models.base import BaseChatModel\n    from langchain_core.messages import AIMessage\nexcept ImportError:\n    raise ImportError(\"langchain is not installed. Please install it using `pip install langchain`\")\n\n\nclass LangchainLLM(LLMBase):\n    def __init__(self, config: Optional[BaseLlmConfig] = None):\n        super().__init__(config)\n\n        if self.config.model is None:\n            raise ValueError(\"`model` parameter is required\")\n\n        if not isinstance(self.config.model, BaseChatModel):\n            raise ValueError(\"`model` must be an instance of BaseChatModel\")\n\n        self.langchain_model = self.config.model\n\n    def _parse_response(self, response: AIMessage, tools: Optional[List[Dict]]):\n        \"\"\"\n        Process the response based on whether tools are used or not.\n\n        Args:\n            response: AI Message.\n            tools: The list of tools provided in the request.\n\n        Returns:\n            str or dict: The processed response.\n        \"\"\"\n        if not tools:","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/llms/langchain.py#L1-L36","documentation":"Error \"`model` parameter is required\" thrown in mem0ai/mem0.","triggerScenarios":"Thrown at mem0/llms/langchain.py:18 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an initialized Langchain chat model via the 'model' field in the LLM config."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}