mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-29 04:20:42 +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,
|
"textGenerationConfig": inference_params,
|
||||||
})
|
})
|
||||||
|
|
||||||
## LOGGING
|
|
||||||
logging_obj.pre_call(
|
|
||||||
input=prompt,
|
|
||||||
api_key="",
|
|
||||||
additional_args={"complete_input_dict": data},
|
|
||||||
)
|
|
||||||
|
|
||||||
## COMPLETION CALL
|
## COMPLETION CALL
|
||||||
accept = 'application/json'
|
accept = 'application/json'
|
||||||
contentType = 'application/json'
|
contentType = 'application/json'
|
||||||
if stream == True:
|
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(
|
response = client.invoke_model_with_response_stream(
|
||||||
body=data,
|
body=data,
|
||||||
modelId=model,
|
modelId=model,
|
||||||
@@ -410,6 +417,20 @@ def completion(
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
try:
|
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(
|
response = client.invoke_model(
|
||||||
body=data,
|
body=data,
|
||||||
modelId=model,
|
modelId=model,
|
||||||
|
|||||||
@@ -920,7 +920,7 @@ def test_completion_sagemaker():
|
|||||||
print(response)
|
print(response)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
test_completion_sagemaker()
|
# test_completion_sagemaker()
|
||||||
|
|
||||||
def test_completion_chat_sagemaker():
|
def test_completion_chat_sagemaker():
|
||||||
try:
|
try:
|
||||||
@@ -934,7 +934,7 @@ def test_completion_chat_sagemaker():
|
|||||||
print(response)
|
print(response)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
test_completion_chat_sagemaker()
|
# test_completion_chat_sagemaker()
|
||||||
|
|
||||||
def test_completion_bedrock_titan():
|
def test_completion_bedrock_titan():
|
||||||
try:
|
try:
|
||||||
@@ -991,7 +991,7 @@ def test_completion_bedrock_cohere():
|
|||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
# test_completion_bedrock_cohere()
|
test_completion_bedrock_cohere()
|
||||||
|
|
||||||
|
|
||||||
def test_completion_bedrock_claude_completion_auth():
|
def test_completion_bedrock_claude_completion_auth():
|
||||||
@@ -1028,7 +1028,7 @@ def test_completion_bedrock_claude_completion_auth():
|
|||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {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():
|
# def test_completion_bedrock_claude_external_client_auth():
|
||||||
# print("calling bedrock claude external client auth")
|
# print("calling bedrock claude external client auth")
|
||||||
|
|||||||
Reference in New Issue
Block a user