diff --git a/litellm/llms/huggingface_restapi.py b/litellm/llms/huggingface_restapi.py index a1216456351..501667d0712 100644 --- a/litellm/llms/huggingface_restapi.py +++ b/litellm/llms/huggingface_restapi.py @@ -405,6 +405,8 @@ class Huggingface(BaseLLM): ## RESPONSE OBJECT try: completion_response = response.json() + if isinstance(completion_response, dict): + completion_response: List[Dict[str, Any]] = [{"generated_text": content}] except: import traceback raise HuggingfaceError(