Files
langchain/docs/extras/integrations/chat/bedrock.ipynb
T
Benjamin MatsonandBagatur 58d7d86e51 feat: add bedrock chat model (#8017)
Replace this comment with:
  - Description: Add Bedrock implementation of Anthropic Claude for Chat
  - Tag maintainer: @hwchase17, @baskaryan
  - Twitter handle: @bwmatson

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-09-01 13:16:57 -07:00

3.3 KiB

Bedrock Chat

Amazon Bedrock is a fully managed service that makes FMs from leading AI startups and Amazon available via an API, so you can choose from a wide range of FMs to find the model that is best suited for your use case

In [ ]:
%pip install boto3
In [1]:
from langchain.chat_models import BedrockChat
from langchain.schema import HumanMessage
In [2]:
chat = BedrockChat(model_id="anthropic.claude-v2", model_kwargs={"temperature":0.1})
In [3]:
messages = [
    HumanMessage(
        content="Translate this sentence from English to French. I love programming."
    )
]
chat(messages)
Out [3]:
AIMessage(content=" Voici la traduction en français : J'adore programmer.", additional_kwargs={}, example=False)
In [ ]: