amazon-bedrock-samples
amazon-bedrock-samples copied to clipboard
Issues with: inference/cross-region-inference/Getting_started_with_Cross-region_Inference.ipynb
After installing:
!pip install --quiet langchain_aws langchain_community
Then, running:
from langchain_aws import ChatBedrockConverse
messages = [
(
"system",
"You are a helpful assistant that shapes sentences into poetic form. Translate the user sentence.",
),
("human", "I love programming."),
]
llm = ChatBedrockConverse(
model='us.anthropic.claude-3-sonnet-20240229-v1:0',
temperature=0,
max_tokens=None,
client=bedrock_runtime,
)
print(llm.invoke(messages).content)
I am getting the error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[5], line 1
----> 1 from langchain_aws import ChatBedrockConverse
3 messages = [
4 (
5 "system",
(...)
8 ("human", "I love programming."),
9 ]
11 llm = ChatBedrockConverse(
12 model='us.anthropic.claude-3-sonnet-20240229-v1:0',
13 temperature=0,
14 max_tokens=None,
15 client=bedrock_runtime,
16 )
ImportError: cannot import name 'ChatBedrockConverse' from 'langchain_aws' ([/opt/conda/lib/python3.10/site-packages/langchain_aws/__init__.py](https://x4kaivqtuvti2g3.studio.us-east-1.sagemaker.aws/opt/conda/lib/python3.10/site-packages/langchain_aws/__init__.py))
https://github.com/aws-samples/amazon-bedrock-samples/blob/main/inference/cross-region-inference/Getting_started_with_Cross-region_Inference.ipynb
This file was linked from the AWS Blog post https://aws.amazon.com/blogs/machine-learning/getting-started-with-cross-region-inference-in-amazon-bedrock/, but now it gives 404 error.