From a89b8f55e36468fedd3023f6af1afd99ed6f213f Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 21 Nov 2023 09:15:13 -0800 Subject: [PATCH] fix(huggingface_restapi.py): handle generate text output --- litellm/llms/huggingface_restapi.py | 2 ++ 1 file changed, 2 insertions(+) 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(