From 2a681c18740664d23ae1db0c78d6e65efe6431c1 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 21 Nov 2023 07:10:04 -0800 Subject: [PATCH] fix(utils.py): fix pre call rules --- litellm/tests/test_completion.py | 2 +- litellm/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index beef7407c..306f0b2f6 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -139,7 +139,7 @@ def test_completion_gpt4_vision(): pass except Exception as e: pytest.fail(f"Error occurred: {e}") -# test_completion_gpt4_vision() +test_completion_gpt4_vision() def test_completion_perplexity_api(): try: diff --git a/litellm/utils.py b/litellm/utils.py index 0268bf99a..ac8c9d8d2 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1154,7 +1154,7 @@ def client(original_function): elif kwargs.get("messages", None): messages = kwargs["messages"] ### PRE-CALL RULES ### - rules_obj.pre_call_rules(input="".join(m["content"] for m in messages), model=model) + rules_obj.pre_call_rules(input="".join(m["content"] for m in messages if isinstance(m["content"], str)), model=model) elif call_type == CallTypes.embedding.value: messages = args[1] if len(args) > 1 else kwargs["input"] stream = True if "stream" in kwargs and kwargs["stream"] == True else False