BerriAI/litellm · error · HuggingFaceError
sentence transformers requires 2+ sentences
Error message
sentence transformers requires 2+ sentences
What it means
Error "sentence transformers requires 2+ sentences" thrown in BerriAI/litellm.
Solutions
- Pass at least two sentences in the input list; this task compares pairs of sentences.
When it happens
Trigger: Thrown at litellm/llms/huggingface/embedding/handler.py:148 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/c4113a0b2e25c95a.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/huggingface/embedding/handler.py:148
else:
data[k] = v
return data
def _transform_input(
self,
input: list,
model: str,
call_type: Literal["sync", "async"],
optional_params: dict,
embed_url: str,
) -> dict:
data: dict = {}
## TRANSFORMATION ##
if "sentence-transformers" in model:
if len(input) == 0:
raise HuggingFaceError(
status_code=400,
message="sentence transformers requires 2+ sentences",
)
data = {"inputs": {"source_sentence": input[0], "sentences": input[1:]}}
else:
data = {"inputs": input}
task_type: Final = optional_params.pop("input_type", None)
if call_type == "sync":
hf_task: Final = get_hf_task_embedding_for_model(model=model, task_type=task_type, api_base=HF_HUB_URL)
elif call_type == "async":
return self._async_transform_input(model=model, task_type=task_type, embed_url=embed_url, input=input)
data = self._transform_input_on_pipeline_tag(input=input, pipeline_tag=hf_task)
if len(optional_params.keys()) > 0:
data = self._process_optional_params(data=data, optional_params=optional_params)View on GitHub (pinned to 77b7c6c40c)