Skip to content

Surface underlying error on bedrock integration instead of assuming connection issue #1672

@bglearning

Description

@bglearning

In the bedrock components, document_embeder.py#L219, generator.py#L236, there is an exception catch on run which then produces a message about it being a connection error regardless of the underlying issue.

except ClientError as exception:
    msg = (
        f"Could not connect to Amazon Bedrock model {self.model}. "
        f"Make sure your AWS environment is configured correctly, "
        f"the model is available in the configured AWS region, and you have access."
    )
    raise AmazonBedrockInferenceError(msg) from exception

This assumes it's always the connection issue and is misleading in cases there is another underlying issue (e.g. the token count being too high).

Desired behavior

It should either surface the underlying error directly or configure the message to be specific to possible / common issues.

In this sense, the ranker handling seems to be better:

ranker.py#L254

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions