From 49650af444a5861d91f4ab8825550ec37b2d8978 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Fri, 3 Nov 2023 18:06:23 -0700 Subject: [PATCH] (fix) bedrock: remove check for - if "error" in outputText --- litellm/llms/bedrock.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/litellm/llms/bedrock.py b/litellm/llms/bedrock.py index 28d15de42a9..0b61f6bba89 100644 --- a/litellm/llms/bedrock.py +++ b/litellm/llms/bedrock.py @@ -391,17 +391,11 @@ def completion( outputText = response_body["generations"][0]["text"] else: # amazon titan outputText = response_body.get('results')[0].get('outputText') - if "error" in outputText: - raise BedrockError( - message=outputText, - status_code=response.status_code, - ) - else: - try: - if len(outputText) > 0: - model_response["choices"][0]["message"]["content"] = outputText - except: - raise BedrockError(message=json.dumps(outputText), status_code=response.status_code) + try: + if len(outputText) > 0: + model_response["choices"][0]["message"]["content"] = outputText + except: + raise BedrockError(message=json.dumps(outputText), status_code=response.status_code) ## CALCULATING USAGE - baseten charges on time, not tokens - have some mapping of cost here. prompt_tokens = len(