MCPcopy Create free account
hub / github.com/cocoindex-io/cocoindex-code / _st_model_rejection_reason

Function _st_model_rejection_reason

src/cocoindex_code/cli.py:326–340  ·  view source on GitHub ↗

Why ``model`` can't be a sentence-transformers model, or None if it's fine. sentence-transformers loads HuggingFace model ids. An ``ollama/`` prefix is a LiteLLM/Ollama route that ST tries (and fails) to resolve as a HuggingFace repo — the user wants the litellm provider instead (issue

(model: str)

Source from the content-addressed store, hash-verified

324
325
326def _st_model_rejection_reason(model: str) -> str | None:
327 """Why ``model`` can't be a sentence-transformers model, or None if it's fine.
328
329 sentence-transformers loads HuggingFace model ids. An ``ollama/`` prefix is a
330 LiteLLM/Ollama route that ST tries (and fails) to resolve as a HuggingFace
331 repo — the user wants the litellm provider instead (issue #181). Real
332 HuggingFace ids that contain an ``org/`` slash (``Snowflake/...``,
333 ``openai/...``) are left alone.
334 """
335 if model.strip().lower().startswith("ollama/"):
336 return (
337 "ollama/… models run via litellm, not sentence-transformers — "
338 "go back and pick the litellm provider instead."
339 )
340 return None
341
342
343def _resolve_embedding_choice(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected