diff --git a/litellm/llms/huggingface_restapi.py b/litellm/llms/huggingface_restapi.py index c347910f8..2f9485963 100644 --- a/litellm/llms/huggingface_restapi.py +++ b/litellm/llms/huggingface_restapi.py @@ -584,6 +584,14 @@ class Huggingface(BaseLLM): "embedding": embedding # flatten list returned from hf } ) + elif isinstance(embedding, list) and isinstance(embedding[0], float): + output_data.append( + { + "object": "embedding", + "index": idx, + "embedding": embedding # flatten list returned from hf + } + ) else: output_data.append( { diff --git a/litellm/main.py b/litellm/main.py index 16ce2850c..31613a67a 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -1748,8 +1748,7 @@ async def aembedding(*args, **kwargs): or custom_llm_provider == "anyscale" or custom_llm_provider == "openrouter" or custom_llm_provider == "deepinfra" - or custom_llm_provider == "perplexity" - or custom_llm_provider == "huggingface"): # currently implemented aiohttp calls for just azure and openai, soon all. + or custom_llm_provider == "perplexity"): # currently implemented aiohttp calls for just azure and openai, soon all. # Await normally init_response = await loop.run_in_executor(None, func_with_context) if isinstance(init_response, dict) or isinstance(init_response, ModelResponse): ## CACHING SCENARIO