An integration package connecting AnthropicMessages and GigaChain
Project description
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 here.
To use, you should have an Anthropic API key configured. Initialize the model as:
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.
LLMs (Legacy)
You can use the Claude 2 models for text completions.
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: ")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gigachain_anthropic-0.1.22.tar.gz
(19.2 kB
view hashes)
Built Distribution
Close
Hashes for gigachain_anthropic-0.1.22.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 237ad6d817bf65785cf8b7ab94670a8eb4ee768cc58396eb2f0336ad08f23065 |
|
MD5 | 62e008f9012a9264c3ba43be163233ee |
|
BLAKE2b-256 | 7bb95c6646e7fb13afe3519bc7e8470c47556a7a4be88983c0e4eab842ac0a45 |
Close
Hashes for gigachain_anthropic-0.1.22-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e089249edc4c03118dc014ade6f5544e6929d8ddac0b521d83fd4dcd15cd5510 |
|
MD5 | a86c937ff64a9437cddbb5e9bd75e4b3 |
|
BLAKE2b-256 | e0bcb3ff9ac16b290dae888791617c248331f9b536f97de45fa7856550cc7d14 |