From 17d9e485270026c25a9b9fae4ce45e692739524f Mon Sep 17 00:00:00 2001 From: Luca Ronca Date: Fri, 13 Sep 2024 02:28:09 +0200 Subject: [PATCH] bedrock: Fix unchecked error when stream channel is closed (#998) fix(bedrock): Handle unchecked error when stream channel is closed --- llms/bedrock/internal/bedrockclient/provider_anthropic.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llms/bedrock/internal/bedrockclient/provider_anthropic.go b/llms/bedrock/internal/bedrockclient/provider_anthropic.go index 55f64210f..5258da760 100644 --- a/llms/bedrock/internal/bedrockclient/provider_anthropic.go +++ b/llms/bedrock/internal/bedrockclient/provider_anthropic.go @@ -267,6 +267,9 @@ func parseStreamingCompletionResponse(ctx context.Context, client *bedrockruntim } } } + if err = stream.Err(); err != nil { + return nil, err + } return &llms.ContentResponse{ Choices: contentchoices,