diff --git a/litellm/llms/huggingface_restapi.py b/litellm/llms/huggingface_restapi.py index a121645635..501667d071 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(