MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / normalize_model_name

Function normalize_model_name

src/harness/llms/client.py:58–78  ·  view source on GitHub ↗

Normalize model name to LiteLLM format (provider/model).

(model: str)

Source from the content-addressed store, hash-verified

56
57
58def normalize_model_name(model: str) -> str:
59 """Normalize model name to LiteLLM format (provider/model)."""
60 if "/" in model:
61 return model
62
63 model_lower = model.lower()
64
65 if model_lower.startswith(
66 ("gpt-", "o1-", "o3-", "text-", "davinci", "curie", "babbage", "ada")
67 ):
68 return f"openai/{model}"
69 if model_lower.startswith("claude"):
70 return f"anthropic/{model}"
71 if model_lower.startswith(("gemini", "palm")):
72 return f"google/{model}"
73 if model_lower.startswith(("mistral", "mixtral", "codestral")):
74 return f"mistral/{model}"
75 if model_lower.startswith(("command", "cohere")):
76 return f"cohere/{model}"
77
78 return f"openai/{model}"
79
80
81def get_provider_from_model(model: str) -> str:

Callers 2

get_provider_from_modelFunction · 0.85
completionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected