diff --git a/litellm/llms/bedrock.py b/litellm/llms/bedrock.py index ee655174c0..86fba83662 100644 --- a/litellm/llms/bedrock.py +++ b/litellm/llms/bedrock.py @@ -389,17 +389,24 @@ def completion( "textGenerationConfig": inference_params, }) - ## LOGGING - logging_obj.pre_call( - input=prompt, - api_key="", - additional_args={"complete_input_dict": data}, - ) - ## COMPLETION CALL accept = 'application/json' contentType = 'application/json' if stream == True: + ## LOGGING + request_str = f""" + response = client.invoke_model_with_response_stream( + body={data}, + modelId={model}, + accept=accept, + contentType=contentType + ) + """ + logging_obj.pre_call( + input=prompt, + api_key="", + additional_args={"complete_input_dict": data, "request_str": request_str}, + ) response = client.invoke_model_with_response_stream( body=data, modelId=model, @@ -410,6 +417,20 @@ def completion( return response try: + ## LOGGING + request_str = f""" + response = client.invoke_model( + body={data}, + modelId={model}, + accept=accept, + contentType=contentType + ) + """ + logging_obj.pre_call( + input=prompt, + api_key="", + additional_args={"complete_input_dict": data, "request_str": request_str}, + ) response = client.invoke_model( body=data, modelId=model, diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 710c589178..996c903e14 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -920,7 +920,7 @@ def test_completion_sagemaker(): print(response) except Exception as e: pytest.fail(f"Error occurred: {e}") -test_completion_sagemaker() +# test_completion_sagemaker() def test_completion_chat_sagemaker(): try: @@ -934,7 +934,7 @@ def test_completion_chat_sagemaker(): print(response) except Exception as e: pytest.fail(f"Error occurred: {e}") -test_completion_chat_sagemaker() +# test_completion_chat_sagemaker() def test_completion_bedrock_titan(): try: @@ -991,7 +991,7 @@ def test_completion_bedrock_cohere(): pass except Exception as e: pytest.fail(f"Error occurred: {e}") -# test_completion_bedrock_cohere() +test_completion_bedrock_cohere() def test_completion_bedrock_claude_completion_auth(): @@ -1028,7 +1028,7 @@ def test_completion_bedrock_claude_completion_auth(): pass except Exception as e: pytest.fail(f"Error occurred: {e}") -# test_completion_bedrock_claude_completion_auth() +test_completion_bedrock_claude_completion_auth() # def test_completion_bedrock_claude_external_client_auth(): # print("calling bedrock claude external client auth")