Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions litellm/litellm_core_utils/health_check_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def get_mode_handlers(
"responses",
"anthropic_messages",
"ocr",
"evaluation",
"decisions",
],
Callable,
]:
Expand Down Expand Up @@ -296,7 +296,7 @@ def get_mode_handlers(
**_filter_model_params(model_params=model_params),
document=_ocr_health_check_document(model=model, custom_llm_provider=custom_llm_provider),
),
"evaluation": lambda: litellm.adecisions(
"decisions": lambda: litellm.adecisions(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Live proof is missing

Real-provider proof is still pending. Repository rules require live-proxy checks of inferred modes, legacy configs, and Lens selection. Add that proof before merging

Rule Used: Flag if the PR has no proof of e2e testing (if e2e testing is applicable here. If it's like an AGENTS.md change or something then probably no need to have e2e test proof) that either doesn't exist, claims that the box that it was trying to run in doe... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added live proof to the PR description: a real proxy against the TypeSafe API with no mocks, at merge base 1a42c5a and at c0bbbdb. It covers a cost-map decision model with no mode, an explicit mode: decisions deployment and a legacy mode: evaluation deployment, through /model_group/info, /health and a real /v1/systemone call

**DECISIONS_CALL_PARAMS.validate_python(
{
"state": prompt or "health check",
Expand Down
2 changes: 2 additions & 0 deletions litellm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
ModelResponseStream,
RawRequestTypedDict,
StreamingChoices,
canonical_model_mode,
)
from litellm.types.workload_identity import ANTHROPIC_WIF_KWARGS_KEYS, OPENAI_WIF_KWARGS_KEYS
from litellm.utils import (
Expand Down Expand Up @@ -8822,6 +8823,7 @@ async def ahealth_check(
mode = mode or default_health_check_mode(
requested_model=requested_model, model=model, custom_llm_provider=custom_llm_provider
)
mode = canonical_model_mode(mode)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Parameter rebinding breaks repository rules

This reassigns the mode parameter, which AGENTS.md forbids. Use a separate final value for the normalized mode before merging

Context Used: AGENTS.md (source)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cb75948: canonical_model_mode now wraps the existing mode or default_health_check_mode(...) expression, so the parameter is not rebound a second time

if "*" in model:
return await HealthCheckHelpers.ahealth_check_wildcard_models(
model=model,
Expand Down
32 changes: 16 additions & 16 deletions litellm/model_prices_and_context_window_backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -15984,31 +15984,31 @@
"input_cost_per_token": 2.4e-07,
"litellm_provider": "cloudflare",
"max_input_tokens": 65536,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://developers.cloudflare.com/workers-ai/platform/pricing/"
},
"cloudflare/clef-flash": {
"input_cost_per_token": 9e-08,
"litellm_provider": "cloudflare",
"max_input_tokens": 65536,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://developers.cloudflare.com/workers-ai/platform/pricing/"
},
"cloudflare/@cf/cloudflare/clef": {
"input_cost_per_token": 2.4e-07,
"litellm_provider": "cloudflare",
"max_input_tokens": 65536,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://developers.cloudflare.com/workers-ai/platform/pricing/"
},
"cloudflare/@cf/cloudflare/clef-flash": {
"input_cost_per_token": 9e-08,
"litellm_provider": "cloudflare",
"max_input_tokens": 65536,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://developers.cloudflare.com/workers-ai/platform/pricing/"
},
Expand Down Expand Up @@ -45061,7 +45061,7 @@
"input_cost_per_token": 4e-08,
"litellm_provider": "perplexity",
"max_input_tokens": 262144,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://docs.perplexity.ai/api-reference/decisions-post"
},
Expand Down Expand Up @@ -73571,7 +73571,7 @@
"max_input_tokens": 32000,
"max_output_tokens": 28800,
"max_tokens": 28800,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://openrouter.ai/typesafe/jev-1.13"
},
Expand All @@ -73596,7 +73596,7 @@
"input_cost_per_token": 0.0,
"litellm_provider": "bespoke",
"max_input_tokens": 8192,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/bespokelabsai/nimble",
"supported_endpoints": [
Expand All @@ -73610,7 +73610,7 @@
"input_cost_per_token": 0.0,
"litellm_provider": "bespoke",
"max_input_tokens": 8192,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://ollama.com/library/nimble",
"supported_endpoints": [
Expand All @@ -73624,7 +73624,7 @@
"input_cost_per_token": 0.0,
"litellm_provider": "bespoke",
"max_input_tokens": 8192,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/bespokelabsai/nimble",
"supported_endpoints": [
Expand All @@ -73637,7 +73637,7 @@
"laya/english": {
"input_cost_per_token": 0.0,
"litellm_provider": "laya",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/NandhaKishorM/laya",
"supported_endpoints": [
Expand All @@ -73650,7 +73650,7 @@
"laya/multilingual": {
"input_cost_per_token": 0.0,
"litellm_provider": "laya",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/NandhaKishorM/laya",
"supported_endpoints": [
Expand All @@ -73663,7 +73663,7 @@
"laya/typed-decisions": {
"input_cost_per_token": 0.0,
"litellm_provider": "laya",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/NandhaKishorM/laya",
"supported_endpoints": [
Expand All @@ -73676,7 +73676,7 @@
"strands_decider/strands-decider-2B-hobson-v19": {
"input_cost_per_token": 0.0,
"litellm_provider": "strands_decider",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://huggingface.co/StrandsAgents/strands-decider-2B-hobson-v19",
"metadata": {
Expand All @@ -73686,21 +73686,21 @@
"typesafe/jev-1.13.0": {
"input_cost_per_token": 4.2e-08,
"litellm_provider": "typesafe",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://docs.typesafe.ai/models"
},
"typesafe/jev-latest": {
"input_cost_per_token": 4.2e-08,
"litellm_provider": "typesafe",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://docs.typesafe.ai/models"
},
"typesafe/jev-preview": {
"input_cost_per_token": 4.2e-08,
"litellm_provider": "typesafe",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://docs.typesafe.ai/models"
},
Expand Down
4 changes: 2 additions & 2 deletions litellm/proxy/lens/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ def user_scope(auth: UserAPIKeyAuth, write: bool = False) -> Scope:
def validate_signal_model(config: SignalConfig, llm_router: Router | None) -> None:
if not config.model:
return
message: Final = "Choose a System 1 model (evaluation mode) configured on this proxy"
message: Final = "Choose a System 1 model (decisions mode) configured on this proxy"
if llm_router is None:
raise HTTPException(400, message)
try:
model_group: Final = llm_router.get_model_group_info(model_group=config.model)
except Exception as error:
raise HTTPException(400, message) from error
if model_group is None or model_group.mode != "evaluation":
if model_group is None or model_group.mode != "decisions":
raise HTTPException(400, message)


Expand Down
14 changes: 12 additions & 2 deletions litellm/types/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
ModelResponse,
StandardLoggingRoutingDecision,
)
from .utils import (
canonical_model_mode as _canonical_model_mode,
)
from .utils import (
# private alias: `from .types.router import *` would rebind a public Final in litellm/__init__.py
server_owned_wif_litellm_params as _server_owned_wif_litellm_params,
Expand Down Expand Up @@ -294,12 +297,14 @@ class ModelInfo(MirroredPricingParams):
# in the spend log row's metadata. Set it on every deployment of the group.
internal_router_model: bool | None = None

def __init__(self, id: str | int | None = None, **params) -> None:
def __init__(self, id: str | int | None = None, **params: object) -> None:
if id is None:
id = str(uuid.uuid4()) # Generate a UUID if id is None or not provided
elif isinstance(id, int):
id = str(id)
super().__init__(id=id, **params)
mode: Final = params.get("mode")
model_params: Final = {**params, "mode": _canonical_model_mode(mode)} if isinstance(mode, str) else params
super().__init__(id=id, **model_params)

@model_validator(mode="after")
def _validate_ptu_bounds(self) -> "ModelInfo":
Expand Down Expand Up @@ -898,6 +903,11 @@ class ModelGroupInfo(LiteLLMBaseModel):
supported_openai_params: list[str] | None = Field(default=[])
configurable_clientside_auth_params: CONFIGURABLE_CLIENTSIDE_AUTH_PARAMS = None

@field_validator("mode", mode="before")
@classmethod
def _canonicalize_mode(cls, mode: object) -> object:
return _canonical_model_mode(mode) if isinstance(mode, str) else mode

def __init__(self, **data) -> None:
for field_name, field_type in _resolved_annotations(self.__class__).items():
if field_type is bool and data.get(field_name) is None:
Expand Down
9 changes: 8 additions & 1 deletion litellm/types/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ class LiteLLMCommonStrings(Enum):
llm_provider_not_provided = "Unmapped LLM provider for this endpoint. You passed model={model}, custom_llm_provider={custom_llm_provider}. Check supported provider and route: https://docs.litellm.ai/docs/providers"


LEGACY_DECISIONS_MODE: Final = "evaluation"


def canonical_model_mode(mode: str) -> str:
return "decisions" if mode == LEGACY_DECISIONS_MODE else mode


SupportedCacheControls: Final = ["ttl", "s-maxage", "no-cache", "no-store"]


Expand Down Expand Up @@ -430,7 +437,7 @@ class ModelInfoBase(ProviderSpecificModelInfo, total=False):
"audio_transcription",
"audio_speech",
"responses",
"evaluation",
"decisions",
"ocr",
"realtime",
]
Expand Down
32 changes: 16 additions & 16 deletions model_prices_and_context_window.json
Original file line number Diff line number Diff line change
Expand Up @@ -15984,31 +15984,31 @@
"input_cost_per_token": 2.4e-07,
"litellm_provider": "cloudflare",
"max_input_tokens": 65536,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://developers.cloudflare.com/workers-ai/platform/pricing/"
},
"cloudflare/clef-flash": {
"input_cost_per_token": 9e-08,
"litellm_provider": "cloudflare",
"max_input_tokens": 65536,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://developers.cloudflare.com/workers-ai/platform/pricing/"
},
"cloudflare/@cf/cloudflare/clef": {
"input_cost_per_token": 2.4e-07,
"litellm_provider": "cloudflare",
"max_input_tokens": 65536,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://developers.cloudflare.com/workers-ai/platform/pricing/"
},
"cloudflare/@cf/cloudflare/clef-flash": {
"input_cost_per_token": 9e-08,
"litellm_provider": "cloudflare",
"max_input_tokens": 65536,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://developers.cloudflare.com/workers-ai/platform/pricing/"
},
Expand Down Expand Up @@ -45061,7 +45061,7 @@
"input_cost_per_token": 4e-08,
"litellm_provider": "perplexity",
"max_input_tokens": 262144,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://docs.perplexity.ai/api-reference/decisions-post"
},
Expand Down Expand Up @@ -73571,7 +73571,7 @@
"max_input_tokens": 32000,
"max_output_tokens": 28800,
"max_tokens": 28800,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://openrouter.ai/typesafe/jev-1.13"
},
Expand All @@ -73596,7 +73596,7 @@
"input_cost_per_token": 0.0,
"litellm_provider": "bespoke",
"max_input_tokens": 8192,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/bespokelabsai/nimble",
"supported_endpoints": [
Expand All @@ -73610,7 +73610,7 @@
"input_cost_per_token": 0.0,
"litellm_provider": "bespoke",
"max_input_tokens": 8192,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://ollama.com/library/nimble",
"supported_endpoints": [
Expand All @@ -73624,7 +73624,7 @@
"input_cost_per_token": 0.0,
"litellm_provider": "bespoke",
"max_input_tokens": 8192,
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/bespokelabsai/nimble",
"supported_endpoints": [
Expand All @@ -73637,7 +73637,7 @@
"laya/english": {
"input_cost_per_token": 0.0,
"litellm_provider": "laya",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/NandhaKishorM/laya",
"supported_endpoints": [
Expand All @@ -73650,7 +73650,7 @@
"laya/multilingual": {
"input_cost_per_token": 0.0,
"litellm_provider": "laya",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/NandhaKishorM/laya",
"supported_endpoints": [
Expand All @@ -73663,7 +73663,7 @@
"laya/typed-decisions": {
"input_cost_per_token": 0.0,
"litellm_provider": "laya",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://github.com/NandhaKishorM/laya",
"supported_endpoints": [
Expand All @@ -73676,7 +73676,7 @@
"strands_decider/strands-decider-2B-hobson-v19": {
"input_cost_per_token": 0.0,
"litellm_provider": "strands_decider",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://huggingface.co/StrandsAgents/strands-decider-2B-hobson-v19",
"metadata": {
Expand All @@ -73686,21 +73686,21 @@
"typesafe/jev-1.13.0": {
"input_cost_per_token": 4.2e-08,
"litellm_provider": "typesafe",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://docs.typesafe.ai/models"
},
"typesafe/jev-latest": {
"input_cost_per_token": 4.2e-08,
"litellm_provider": "typesafe",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://docs.typesafe.ai/models"
},
"typesafe/jev-preview": {
"input_cost_per_token": 4.2e-08,
"litellm_provider": "typesafe",
"mode": "evaluation",
"mode": "decisions",
"output_cost_per_token": 0.0,
"source": "https://docs.typesafe.ai/models"
},
Expand Down
Loading
Loading