You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using astream_events() with ChatBedrockConverse, the on_chat_model_stream events do not have the format I was expecting. The field data.chunk.content is a list rather then a string.
This is not aligned with the behaviour presented here for chat models. This is also not aligned with the behaviour of the ChatBedrock model, which gives a string. Its also not aligned with the behaviour of ChatBedrockConverse described in the table below here.
Is this intentional ?
Code:
fromlangchain_awsimportChatBedrockConverseimportosasyncdefchat_langchain_astream_events():
llm=ChatBedrockConverse(
model="anthropic.claude-3-5-sonnet-20240620-v1:0",
region_name="eu-central-1",
aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"],
)
message= [("user", "Hey, how are you?")]
events= []
asyncforeventinllm.astream_events(message, version="v2"):
events.append(event)
print(events[1:3])
in particular ...'data': {'chunk': AIMessageChunk(content=[{'type': 'text', 'text': 'Hello', 'index': 0}], ...
Where I would expect ...'data': {'chunk': AIMessageChunk(content='Hello', ... as
The text was updated successfully, but these errors were encountered:
When using astream_events() with ChatBedrockConverse, the on_chat_model_stream events do not have the format I was expecting. The field
data.chunk.content
is a list rather then a string.This is not aligned with the behaviour presented here for chat models. This is also not aligned with the behaviour of the ChatBedrock model, which gives a string. Its also not aligned with the behaviour of ChatBedrockConverse described in the table below here.
Is this intentional ?
Code:
Output:
in particular
...'data': {'chunk': AIMessageChunk(content=[{'type': 'text', 'text': 'Hello', 'index': 0}], ...
Where I would expect
...'data': {'chunk': AIMessageChunk(content='Hello', ...
asThe text was updated successfully, but these errors were encountered: