aws-samples / aws-samples/amazon-bedrock-samples

Issues with: inference/cross-region-inference/Getting_started_with_Cross-region_Inference.ipynb

Open
#297 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
1.5k
Forks
734
Avg merge
1d 6h
Merged PRs (30d)
4

Description

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))
```

Contributor guide

Open the contributing guide

Research direction

Open inference/cross-region-inference/Getting_started_with_Cross-region_Inference.ipynb and inspect the installation and ChatBedrockConverse import cells. Reproduce the ImportError after installing langchain_aws and langchain_community, then compare the notebook example with the installed package. Done when the cross-region inference example runs past the import without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, jupyter-notebook, python
Domain
ai, documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.