mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-03 19:57:51 +00:00
Fix Bedrock broad error catching (#14398)
Fixes #14347 <!-- Thank you for contributing to LangChain! Replace this entire comment with: - **Description:** Added the traceback of the previous error to keep the initial error type, - **Issue:** #14347 , - **Dependencies:** None, - **Tag maintainer:** Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally. See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md If you're adding a new integration, please include: 1. a test for the integration, preferably unit tests that do not rely on network access, 2. an example notebook showing its use. It lives in `docs/extras` directory. If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17. --> --------- Co-authored-by: Julien Raffy <julien.raffy@emeria.eu> Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
413a56b8f1
commit
4dab37741a
@ -277,7 +277,9 @@ class BedrockBase(BaseModel, ABC):
|
|||||||
text = LLMInputOutputAdapter.prepare_output(provider, response)
|
text = LLMInputOutputAdapter.prepare_output(provider, response)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ValueError(f"Error raised by bedrock service: {e}")
|
raise ValueError(f"Error raised by bedrock service: {e}").with_traceback(
|
||||||
|
e.__traceback__
|
||||||
|
)
|
||||||
|
|
||||||
if stop is not None:
|
if stop is not None:
|
||||||
text = enforce_stop_tokens(text, stop)
|
text = enforce_stop_tokens(text, stop)
|
||||||
|
Loading…
Reference in New Issue
Block a user