MCPcopy
hub / github.com/langroid/langroid / _normalize_gemini_model_name

Function _normalize_gemini_model_name

langroid/language_models/model_info.py:821–835  ·  view source on GitHub ↗
(model: str)

Source from the content-addressed store, hash-verified

819
820
821def _normalize_gemini_model_name(model: str) -> str | None:
822 base_model = model.rsplit("/", 1)[-1]
823 if base_model in GEMINI_CANONICAL_MODEL_NAMES:
824 return base_model
825 if not base_model.startswith("gemini-"):
826 return None
827
828 # Try stripping known suffixes to find a canonical name.
829 # Use split (not endswith) for "-preview" so dated variants like
830 # "gemini-2.5-flash-lite-preview-06-17" are handled correctly.
831 for suffix in ("-preview", "-exp", "-experimental", "-latest"):
832 stripped = base_model.split(suffix, maxsplit=1)[0]
833 if stripped != base_model and stripped in GEMINI_CANONICAL_MODEL_NAMES:
834 return stripped
835 return None
836
837
838def _warn_unknown_model(models: List[str | ModelName]) -> None:

Callers 1

_normalize_model_namesFunction · 0.85

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…