mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-29 02:21:04 +00:00
(feat) completion:debugging - show raw POST request
This commit is contained in:
+28
-7
@@ -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,
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user