mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
fix(utils.py): handle key error in msg validation (#8325)
* fix(utils.py): handle key error in msg validation * Support running Aim Guard during LLM call (#7918) * support running Aim Guard during LLM call * Rename header * adjust docs and fix type annotations * fix(timeout.md): doc fix for openai example on dynamic timeouts --------- Co-authored-by: Tomer Bin <117278227+hxtomer@users.noreply.github.com>
This commit is contained in:
parent
fac1d2ccef
commit
f031926b82
6 changed files with 56 additions and 21 deletions
|
@ -1850,3 +1850,15 @@ def test_dict_to_response_format_helper():
|
|||
"ref_template": "/$defs/{model}",
|
||||
}
|
||||
_dict_to_response_format_helper(**args)
|
||||
|
||||
|
||||
def test_validate_user_messages_invalid_content_type():
|
||||
from litellm.utils import validate_chat_completion_user_messages
|
||||
|
||||
messages = [{"content": [{"type": "invalid_type", "text": "Hello"}]}]
|
||||
|
||||
with pytest.raises(Exception) as e:
|
||||
validate_chat_completion_user_messages(messages)
|
||||
|
||||
assert "Invalid message" in str(e)
|
||||
print(e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue