mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix(utils.py): return received args for invalid model response object error
Addresses https://github.com/BerriAI/litellm/issues/3381
This commit is contained in:
parent
a24f32fb5a
commit
e96ccb8edf
1 changed files with 5 additions and 1 deletions
|
@ -7171,6 +7171,7 @@ def convert_to_model_response_object(
|
||||||
end_time=None,
|
end_time=None,
|
||||||
hidden_params: Optional[dict] = None,
|
hidden_params: Optional[dict] = None,
|
||||||
):
|
):
|
||||||
|
received_args = locals()
|
||||||
try:
|
try:
|
||||||
if response_type == "completion" and (
|
if response_type == "completion" and (
|
||||||
model_response_object is None
|
model_response_object is None
|
||||||
|
@ -7182,6 +7183,7 @@ def convert_to_model_response_object(
|
||||||
# for returning cached responses, we need to yield a generator
|
# for returning cached responses, we need to yield a generator
|
||||||
return convert_to_streaming_response(response_object=response_object)
|
return convert_to_streaming_response(response_object=response_object)
|
||||||
choice_list = []
|
choice_list = []
|
||||||
|
|
||||||
for idx, choice in enumerate(response_object["choices"]):
|
for idx, choice in enumerate(response_object["choices"]):
|
||||||
message = Message(
|
message = Message(
|
||||||
content=choice["message"].get("content", None),
|
content=choice["message"].get("content", None),
|
||||||
|
@ -7303,7 +7305,9 @@ def convert_to_model_response_object(
|
||||||
model_response_object._hidden_params = hidden_params
|
model_response_object._hidden_params = hidden_params
|
||||||
return model_response_object
|
return model_response_object
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(f"Invalid response object {traceback.format_exc()}")
|
raise Exception(
|
||||||
|
f"Invalid response object {traceback.format_exc()}\n\nreceived_args={received_args}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def acreate(*args, **kwargs): ## Thin client to handle the acreate langchain call
|
def acreate(*args, **kwargs): ## Thin client to handle the acreate langchain call
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue