langchain-anthropic


Namelangchain-anthropic JSON
Version 0.3.19 PyPI version JSON
download
home_pageNone
SummaryAn integration package connecting Anthropic and LangChain
upload_time2025-08-18 18:33:36
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # langchain-anthropic

This package contains the LangChain integration for Anthropic's generative models.

## Installation

`pip install -U langchain-anthropic`

## Chat Models

Anthropic recommends using their chat models over text completions.

You can see their recommended models [in the Anthropic docs](https://docs.anthropic.com/claude/docs/models-overview#model-recommendations).

To use, you should have an Anthropic API key configured. Initialize the model as:

```python
from langchain_anthropic import ChatAnthropic
from langchain_core.messages import AIMessage, HumanMessage

model = ChatAnthropic(model="claude-3-opus-20240229", temperature=0, max_tokens=1024)
```

### Define the input message

`message = HumanMessage(content="What is the capital of France?")`

### Generate a response using the model

`response = model.invoke([message])`

For a more detailed walkthrough see [here](https://python.langchain.com/docs/integrations/chat/anthropic).

## LLMs (Legacy)

You can use the Claude 2 models for text completions.

```python
from langchain_anthropic import AnthropicLLM

model = AnthropicLLM(model="claude-2.1", temperature=0, max_tokens=1024)
response = model.invoke("The best restaurant in San Francisco is: ")
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "langchain-anthropic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/1f/ab/bdaefa42fdab238efff45eb28c6cd74c011979092408decdae22c0bf7e66/langchain_anthropic-0.3.19.tar.gz",
    "platform": null,
    "description": "# langchain-anthropic\n\nThis package contains the LangChain integration for Anthropic's generative models.\n\n## Installation\n\n`pip install -U langchain-anthropic`\n\n## Chat Models\n\nAnthropic recommends using their chat models over text completions.\n\nYou can see their recommended models [in the Anthropic docs](https://docs.anthropic.com/claude/docs/models-overview#model-recommendations).\n\nTo use, you should have an Anthropic API key configured. Initialize the model as:\n\n```python\nfrom langchain_anthropic import ChatAnthropic\nfrom langchain_core.messages import AIMessage, HumanMessage\n\nmodel = ChatAnthropic(model=\"claude-3-opus-20240229\", temperature=0, max_tokens=1024)\n```\n\n### Define the input message\n\n`message = HumanMessage(content=\"What is the capital of France?\")`\n\n### Generate a response using the model\n\n`response = model.invoke([message])`\n\nFor a more detailed walkthrough see [here](https://python.langchain.com/docs/integrations/chat/anthropic).\n\n## LLMs (Legacy)\n\nYou can use the Claude 2 models for text completions.\n\n```python\nfrom langchain_anthropic import AnthropicLLM\n\nmodel = AnthropicLLM(model=\"claude-2.1\", temperature=0, max_tokens=1024)\nresponse = model.invoke(\"The best restaurant in San Francisco is: \")\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An integration package connecting Anthropic and LangChain",
    "version": "0.3.19",
    "project_urls": {
        "Release Notes": "https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-anthropic%3D%3D0%22&expanded=true",
        "Source Code": "https://github.com/langchain-ai/langchain/tree/master/libs/partners/anthropic",
        "repository": "https://github.com/langchain-ai/langchain"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a26964473db52d02715f3815df3b25c9816b5801a58762a5ae62a3e5b84169a0",
                "md5": "ebefad30fcc140e402028b6af37bcd7d",
                "sha256": "5b5372ef7e10ee32b4308b4d9e1ed623c360b7d0a233c017e5209ad8118d5ab7"
            },
            "downloads": -1,
            "filename": "langchain_anthropic-0.3.19-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ebefad30fcc140e402028b6af37bcd7d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 31775,
            "upload_time": "2025-08-18T18:33:35",
            "upload_time_iso_8601": "2025-08-18T18:33:35.596287Z",
            "url": "https://files.pythonhosted.org/packages/a2/69/64473db52d02715f3815df3b25c9816b5801a58762a5ae62a3e5b84169a0/langchain_anthropic-0.3.19-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1fabbdaefa42fdab238efff45eb28c6cd74c011979092408decdae22c0bf7e66",
                "md5": "6fa7863a646ab54828311f0d97e520e4",
                "sha256": "e62259382586ee5c44e9a9459d00b74a7e191550e5fadfad28f0daa5d143d745"
            },
            "downloads": -1,
            "filename": "langchain_anthropic-0.3.19.tar.gz",
            "has_sig": false,
            "md5_digest": "6fa7863a646ab54828311f0d97e520e4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 281502,
            "upload_time": "2025-08-18T18:33:36",
            "upload_time_iso_8601": "2025-08-18T18:33:36.811678Z",
            "url": "https://files.pythonhosted.org/packages/1f/ab/bdaefa42fdab238efff45eb28c6cd74c011979092408decdae22c0bf7e66/langchain_anthropic-0.3.19.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-18 18:33:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "langchain-ai",
    "github_project": "langchain",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "langchain-anthropic"
}
        
Elapsed time: 0.48629s