We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--------------------------------------------------------------------------- ValidationError Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py in convert_to_model_response_object(response_object, model_response_object, response_type, stream, start_time, end_time, hidden_params, _response_headers, convert_tool_call_to_json_mode) 336 if message is None: --> 337 message = Message( 338 content=choice["message"].get("content", None), 30 frames ValidationError: 1 validation error for Message role Input should be 'assistant', 'user', 'system', 'tool' or 'function' [type=literal_error, input_value='model', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/literal_error During handling of the above exception, another exception occurred: Exception Traceback (most recent call last) Exception: Invalid response object Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py", line 337, in convert_to_model_response_object message = Message( File "/usr/local/lib/python3.10/dist-packages/litellm/types/utils.py", line 432, in __init__ super(Message, self).__init__( File "/usr/local/lib/python3.10/dist-packages/pydantic/main.py", line 212, in __init__ validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for Message role Input should be 'assistant', 'user', 'system', 'tool' or 'function' [type=literal_error, input_value='model', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/literal_error received_args={'response_object': {'id': None, 'choices': [{'finish_reason': 'stop', 'index': 0, 'logprobs': None, 'message': {'content': "Okay, I understand. I'm ready for your test. Please proceed.\n", 'refusal': None, 'role': 'model', 'audio': None, 'function_call': None, 'tool_calls': []}}], 'created': 1731996695, 'model': 'gemini-1.5-flash', 'object': 'chat.completion', 'service_tier': None, 'system_fingerprint': None, 'usage': None}, 'model_response_object': ModelResponse(id='chatcmpl-5ae28dd1-2f77-4035-b967-d498e48c70fa', choices=[Choices(finish_reason='stop', index=0, message=Message(content=None, role='assistant', tool_calls=None, function_call=None))], created=1731996681, model=None, object='chat.completion', system_fingerprint=None, usage=Usage(completion_tokens=0, prompt_tokens=0, total_tokens=0, completion_tokens_details=None, prompt_tokens_details=None)), 'response_type': 'completion', 'stream': False, 'start_time': None, 'end_time': None, 'hidden_params': None, '_response_headers': {'content-type': 'application/json', 'vary': 'Origin, X-Origin, Referer', 'content-encoding': 'gzip', 'date': 'Tue, 19 Nov 2024 06:11:35 GMT', 'server': 'scaffolding on HTTPServer2', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'server-timing': 'gfet4t7; dur=13701', 'transfer-encoding': 'chunked'}, 'convert_tool_call_to_json_mode': None} During handling of the above exception, another exception occurred: OpenAIError Traceback (most recent call last) OpenAIError: Invalid response object Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py", line 337, in convert_to_model_response_object message = Message( File "/usr/local/lib/python3.10/dist-packages/litellm/types/utils.py", line 432, in __init__ super(Message, self).__init__( File "/usr/local/lib/python3.10/dist-packages/pydantic/main.py", line 212, in __init__ validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for Message role Input should be 'assistant', 'user', 'system', 'tool' or 'function' [type=literal_error, input_value='model', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/literal_error received_args={'response_object': {'id': None, 'choices': [{'finish_reason': 'stop', 'index': 0, 'logprobs': None, 'message': {'content': "Okay, I understand. I'm ready for your test. Please proceed.\n", 'refusal': None, 'role': 'model', 'audio': None, 'function_call': None, 'tool_calls': []}}], 'created': 1731996695, 'model': 'gemini-1.5-flash', 'object': 'chat.completion', 'service_tier': None, 'system_fingerprint': None, 'usage': None}, 'model_response_object': ModelResponse(id='chatcmpl-5ae28dd1-2f77-4035-b967-d498e48c70fa', choices=[Choices(finish_reason='stop', index=0, message=Message(content=None, role='assistant', tool_calls=None, function_call=None))], created=1731996681, model=None, object='chat.completion', system_fingerprint=None, usage=Usage(completion_tokens=0, prompt_tokens=0, total_tokens=0, completion_tokens_details=None, prompt_tokens_details=None)), 'response_type': 'completion', 'stream': False, 'start_time': None, 'end_time': None, 'hidden_params': None, '_response_headers': {'content-type': 'application/json', 'vary': 'Origin, X-Origin, Referer', 'content-encoding': 'gzip', 'date': 'Tue, 19 Nov 2024 06:11:35 GMT', 'server': 'scaffolding on HTTPServer2', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'server-timing': 'gfet4t7; dur=13701', 'transfer-encoding': 'chunked'}, 'convert_tool_call_to_json_mode': None} During handling of the above exception, another exception occurred: APIError Traceback (most recent call last) APIError: litellm.APIError: APIError: OpenAIException - Invalid response object Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py", line 337, in convert_to_model_response_object message = Message( File "/usr/local/lib/python3.10/dist-packages/litellm/types/utils.py", line 432, in __init__ super(Message, self).__init__( File "/usr/local/lib/python3.10/dist-packages/pydantic/main.py", line 212, in __init__ validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for Message role Input should be 'assistant', 'user', 'system', 'tool' or 'function' [type=literal_error, input_value='model', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/literal_error received_args={'response_object': {'id': None, 'choices': [{'finish_reason': 'stop', 'index': 0, 'logprobs': None, 'message': {'content': "Okay, I understand. I'm ready for your test. Please proceed.\n", 'refusal': None, 'role': 'model', 'audio': None, 'function_call': None, 'tool_calls': []}}], 'created': 1731996695, 'model': 'gemini-1.5-flash', 'object': 'chat.completion', 'service_tier': None, 'system_fingerprint': None, 'usage': None}, 'model_response_object': ModelResponse(id='chatcmpl-5ae28dd1-2f77-4035-b967-d498e48c70fa', choices=[Choices(finish_reason='stop', index=0, message=Message(content=None, role='assistant', tool_calls=None, function_call=None))], created=1731996681, model=None, object='chat.completion', system_fingerprint=None, usage=Usage(completion_tokens=0, prompt_tokens=0, total_tokens=0, completion_tokens_details=None, prompt_tokens_details=None)), 'response_type': 'completion', 'stream': False, 'start_time': None, 'end_time': None, 'hidden_params': None, '_response_headers': {'content-type': 'application/json', 'vary': 'Origin, X-Origin, Referer', 'content-encoding': 'gzip', 'date': 'Tue, 19 Nov 2024 06:11:35 GMT', 'server': 'scaffolding on HTTPServer2', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'server-timing': 'gfet4t7; dur=13701', 'transfer-encoding': 'chunked'}, 'convert_tool_call_to_json_mode': None} During handling of the above exception, another exception occurred: APIError Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/litellm/litellm_core_utils/exception_mapping_utils.py in exception_type(model, original_exception, custom_llm_provider, completion_kwargs, extra_kwargs) 402 else: 403 exception_mapping_worked = True --> 404 raise APIError( 405 status_code=original_exception.status_code, 406 message=f"APIError: {exception_provider} - {message}", APIError: litellm.APIError: APIError: OpenAIException - Invalid response object Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py", line 337, in convert_to_model_response_object message = Message( File "/usr/local/lib/python3.10/dist-packages/litellm/types/utils.py", line 432, in __init__ super(Message, self).__init__( File "/usr/local/lib/python3.10/dist-packages/pydantic/main.py", line 212, in __init__ validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for Message role Input should be 'assistant', 'user', 'system', 'tool' or 'function' [type=literal_error, input_value='model', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/literal_error received_args={'response_object': {'id': None, 'choices': [{'finish_reason': 'stop', 'index': 0, 'logprobs': None, 'message': {'content': "Okay, I understand. I'm ready for your test. Please proceed.\n", 'refusal': None, 'role': 'model', 'audio': None, 'function_call': None, 'tool_calls': []}}], 'created': 1731996703, 'model': 'gemini-1.5-flash', 'object': 'chat.completion', 'service_tier': None, 'system_fingerprint': None, 'usage': None}, 'model_response_object': ModelResponse(id='chatcmpl-729c7c47-c6b2-4500-840f-863bf29e645b', choices=[Choices(finish_reason='stop', index=0, message=Message(content=None, role='assistant', tool_calls=None, function_call=None))], created=1731996696, model=None, object='chat.completion', system_fingerprint=None, usage=Usage(completion_tokens=0, prompt_tokens=0, total_tokens=0, completion_tokens_details=None, prompt_tokens_details=None)), 'response_type': 'completion', 'stream': False, 'start_time': None, 'end_time': None, 'hidden_params': None, '_response_headers': {'content-type': 'application/json', 'vary': 'Origin, X-Origin, Referer', 'content-encoding': 'gzip', 'date': 'Tue, 19 Nov 2024 06:11:43 GMT', 'server': 'scaffolding on HTTPServer2', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'server-timing': 'gfet4t7; dur=6978', 'transfer-encoding': 'chunked'}, 'convert_tool_call_to_json_mode': None}
The text was updated successfully, but these errors were encountered:
Thanks @Yukendiran2002 ! What is the minimal example of code that causes the error?
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: