{"record":{"id":"76851fa690b2a072","repo":"ScrapeGraphAI/Scrapegraph-ai","slug":"the-langchain-together-module-is-not-installed","errorCode":null,"errorMessage":"The langchain_together module is not installed.\n              Please install it using `pip install langchain-together`.","messagePattern":"The langchain_together module is not installed\\.\n              Please install it using `pip install langchain-together`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"scrapegraphai/graphs/abstract_graph.py","lineNumber":281,"sourceCode":"                if model_provider == \"minimax\":\n                    return MiniMax(**llm_params)\n\n                if model_provider == \"ernie\":\n                    from langchain_community.chat_models import ErnieBotChat\n\n                    return ErnieBotChat(**llm_params)\n\n                elif model_provider == \"oneapi\":\n                    return OneApi(**llm_params)\n\n                elif model_provider == \"xai\":\n                    return XAI(**llm_params)\n\n                elif model_provider == \"togetherai\":\n                    try:\n                        from langchain_together import ChatTogether\n                    except ImportError:\n                        raise ImportError(\n                            \"\"\"The langchain_together module is not installed.\n                                          Please install it using `pip install langchain-together`.\"\"\"\n                        )\n                    return ChatTogether(**llm_params)\n\n                elif model_provider == \"nvidia\":\n                    return Nvidia(**llm_params)\n\n        except Exception as e:\n            raise Exception(f\"Error instancing model: {e}\")\n\n    def get_state(self, key=None) -> dict:\n        \"\"\" \"\"\n        Get the final state of the graph.\n\n        Args:\n            key (str, optional): The key of the final state to retrieve.\n","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/ScrapeGraphAI/Scrapegraph-ai/blob/532dfffbf6ee823a6c9cf8cfedc24a93bf026780/scrapegraphai/graphs/abstract_graph.py#L263-L299","documentation":"ImportError raised when model_provider is 'togetherai' but the langchain_together package is not installed in the environment. ScrapeGraphAI does not bundle every LangChain integration; Together AI support is an optional extra resolved lazily at LLM-creation time.","triggerScenarios":"config = {'llm': {'model_provider': 'togetherai', 'model': 'mixtral-8x7B-instruct-v0.1', 'api_key': ...}} on an environment where langchain-together is absent. Raised during graph __init__ -> _create_llm.","commonSituations":"Base install (pip install scrapegraphai) without extras; fresh CI environments; dependency pruning tools removing 'unused' optional packages; version mismatches after upgrading langchain.","solutions":["Install the package: pip install langchain-together (or uv add langchain-together / pip install 'scrapegraphai[togetherai]' if the extra exists).","Pin a langchain-together version compatible with your installed langchain-core.","Recreate/refresh the virtual environment and verify with 'python -c \"from langchain_together import ChatTogether\"'."],"exampleFix":"# before (missing dep)\nconfig = {'llm': {'model_provider': 'togetherai', 'api_key': key}}\n\n# after\n# shell: pip install langchain-together\nconfig = {'llm': {'model_provider': 'togetherai', 'api_key': key}}","handlingStrategy":"validation","validationCode":"if config['llm'].get('model_provider') == 'togetherai':\n    import importlib.util\n    if importlib.util.find_spec('langchain_together') is None:\n        raise SystemExit('Run: pip install langchain-together')","typeGuard":"def together_available() -> bool:\n    import importlib.util\n    return importlib.util.find_spec('langchain_together') is not None","tryCatchPattern":"try:\n    graph = SmartScraperGraph(prompt=p, config=config)\nexcept ImportError as e:\n    if 'langchain_together' in str(e):\n        subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'langchain-together'])\n        graph = SmartScraperGraph(prompt=p, config=config)\n    else:\n        raise","preventionTips":["Declare optional provider extras in requirements (langchain-together for togetherai).","Probe packages with importlib.util.find_spec before graph construction.","Use the same pinned dependency set in CI as locally."],"tags":["missing-dependency","togetherai","llm","import-error"],"backgroundTag":"optional-dependency-not-installed","analyzedSha":"532dfffbf6ee823a6c9cf8cfedc24a93bf026780","analyzedAt":"2026-08-28T15:19:38.821Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}