litellm/tests/local_testing/test_disk_cache_unit_tests.py
jaideeppyne ab78459097 fix(cohere): handle multimodal inputs in token counting and guardrails
Response transformation crashed with TypeError when counting tokens for
multimodal (dict-shaped) embedding inputs, since encoding.encode() was
called directly on the dict instead of its text parts. Also removed a
dead, equally-buggy duplicate of the same loop in _transform_response.

Separately, the embeddings guardrail handler silently skipped multimodal
dict inputs instead of scanning them, letting prohibited text/image
content bypass the configured guardrail. It now extracts and scans the
text parts while leaving image parts untouched.
2026-08-13 09:01:47 +05:30

11 lines
307 B
Python

from cache_unit_tests import LLMCachingUnitTests
from litellm.caching import LiteLLMCacheType
class TestDiskCacheUnitTests(LLMCachingUnitTests):
def get_cache_type(self) -> LiteLLMCacheType:
return LiteLLMCacheType.DISK
# if __name__ == "__main__":
# pytest.main([__file__, "-v", "-s"])