{"id":5285,"library":"langchain-deepseek","title":"DeepSeek Integration for LangChain","description":"langchain-deepseek is an official LangChain partner package that integrates DeepSeek's large language models (LLMs) and embeddings into the LangChain ecosystem. It allows developers to easily use DeepSeek models for chat completions and text embeddings within their LangChain applications. The current version is 1.0.1, and it follows the rapid development and release cadence typical of LangChain's partner libraries, often aligning with `langchain-core` updates.","status":"active","version":"1.0.1","language":"en","source_language":"en","source_url":"https://github.com/langchain-ai/langchain/tree/master/libs/partners/deepseek","tags":["LLM","DeepSeek","LangChain","AI","Generative AI","Chatbot"],"install":[{"cmd":"pip install langchain-deepseek","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Provides the core abstractions and interfaces for all LangChain integrations. Specific version constraints (e.g., `>=0.1.0,<0.2.0`) are defined by `langchain-deepseek`.","package":"langchain-core"}],"imports":[{"symbol":"ChatDeepSeek","correct":"from langchain_deepseek import ChatDeepSeek"},{"symbol":"DeepSeekEmbeddings","correct":"from langchain_deepseek import DeepSeekEmbeddings"}],"quickstart":{"code":"import os\nfrom langchain_deepseek import ChatDeepSeek\nfrom langchain_core.messages import HumanMessage\n\n# Ensure your DeepSeek API key is set as an environment variable\n# or passed directly to the ChatDeepSeek constructor.\n# os.environ[\"DEEPSEEK_API_KEY\"] = \"your-deepseek-api-key\"\n\ndeepseek_api_key = os.environ.get(\"DEEPSEEK_API_KEY\")\n\nif not deepseek_api_key:\n    raise ValueError(\"DEEPSEEK_API_KEY environment variable not set.\")\n\nchat_model = ChatDeepSeek(deepseek_api_key=deepseek_api_key)\n\nmessages = [\n    HumanMessage(content=\"Tell me a short story about a brave knight.\")\n]\n\nresponse = chat_model.invoke(messages)\nprint(response.content)\n","lang":"python","description":"This quickstart demonstrates how to initialize the `ChatDeepSeek` model and use it to invoke a simple chat completion. It assumes the `DEEPSEEK_API_KEY` is set as an environment variable, which is the recommended secure practice. The model processes a list of `HumanMessage` objects and returns a response."},"warnings":[{"fix":"Set `os.environ[\"DEEPSEEK_API_KEY\"] = \"your_key\"` or pass `deepseek_api_key=\"your_key\"` to the constructor.","message":"The DeepSeek API key is required for authentication. It can be provided either as an environment variable `DEEPSEEK_API_KEY` or directly as a `deepseek_api_key` argument to the `ChatDeepSeek` or `DeepSeekEmbeddings` constructors. The argument takes precedence.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your development environment uses a Python version within the specified range, e.g., Python 3.10, 3.11, or 3.12.","message":"This library has strict Python version requirements: `>=3.10.0` and `<4.0.0`. Using incompatible Python versions will lead to installation or runtime errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use a dedicated virtual environment. If issues arise, consider pinning `langchain-core` to the version specified in `langchain-deepseek`'s `install_requires`.","message":"`langchain-deepseek` depends on `langchain-core` with specific version constraints (e.g., `langchain-core>=0.1.0,<0.2.0`). Mismatches between `langchain-deepseek`'s declared `langchain-core` dependency and other `langchain` packages in your environment can cause runtime issues or unexpected behavior. Use `pip install` with care in mixed LangChain environments.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}