story: DGR-043 Expose GGUF compatibility and measured cost inputs to existing routing
This commit is contained in:
@@ -193,6 +193,11 @@ class CapabilityState:
|
||||
memory_capacity_bytes: int | None = None
|
||||
kv_capacity_tokens: int | None = None
|
||||
max_concurrent_sessions: int | None = None
|
||||
measured_tokens_per_second: float | None = None
|
||||
reported_queue_depth: int | None = None
|
||||
seam_latency_ms: float | None = None
|
||||
healthy: bool | None = None
|
||||
reliability: float | None = None
|
||||
|
||||
@property
|
||||
def proven(self) -> bool:
|
||||
@@ -239,6 +244,11 @@ class CapabilityState:
|
||||
"memory_capacity_bytes": self.memory_capacity_bytes,
|
||||
"kv_capacity_tokens": self.kv_capacity_tokens,
|
||||
"max_concurrent_sessions": self.max_concurrent_sessions,
|
||||
"measured_tokens_per_second": self.measured_tokens_per_second,
|
||||
"reported_queue_depth": self.reported_queue_depth,
|
||||
"seam_latency_ms": self.seam_latency_ms,
|
||||
"healthy": self.healthy,
|
||||
"reliability": self.reliability,
|
||||
}
|
||||
|
||||
|
||||
@@ -500,6 +510,9 @@ def _parse_report(doc: Mapping[str, Any]) -> dict:
|
||||
capacity = doc.get("capacity")
|
||||
if capacity is not None:
|
||||
capacity = _object(capacity, "capacity")
|
||||
routing = doc.get("routing")
|
||||
if routing is not None:
|
||||
routing = _object(routing, "routing")
|
||||
|
||||
return {
|
||||
"model_id": _text(model.get("model_id"), "model.model_id"),
|
||||
@@ -530,6 +543,24 @@ def _parse_report(doc: Mapping[str, Any]) -> dict:
|
||||
None if capacity is None else capacity.get("max_concurrent_sessions"),
|
||||
"capacity.max_concurrent_sessions",
|
||||
),
|
||||
"measured_tokens_per_second": _optional_positive_float(
|
||||
None if routing is None else routing.get("tokens_per_second"),
|
||||
"routing.tokens_per_second",
|
||||
),
|
||||
"reported_queue_depth": _optional_nonnegative_int(
|
||||
None if routing is None else routing.get("queue_depth"),
|
||||
"routing.queue_depth",
|
||||
),
|
||||
"seam_latency_ms": _optional_nonnegative_float(
|
||||
None if routing is None else routing.get("seam_latency_ms"),
|
||||
"routing.seam_latency_ms",
|
||||
),
|
||||
"healthy": _optional_bool(
|
||||
None if routing is None else routing.get("healthy"), "routing.healthy"
|
||||
),
|
||||
"reliability": _optional_unit_float(
|
||||
None if routing is None else routing.get("reliability"), "routing.reliability"
|
||||
),
|
||||
"_status": _text(doc.get("status"), "status"),
|
||||
}
|
||||
|
||||
@@ -566,6 +597,45 @@ def _optional_positive_int(value: Any, field_name: str) -> int | None:
|
||||
return value
|
||||
|
||||
|
||||
def _optional_nonnegative_int(value: Any, field_name: str) -> int | None:
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, bool) or not isinstance(value, int) or value < 0:
|
||||
raise _ReportError(f"{field_name!r} must be a non-negative integer")
|
||||
return value
|
||||
|
||||
|
||||
def _optional_positive_float(value: Any, field_name: str) -> float | None:
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, bool) or not isinstance(value, (int, float)) or value <= 0:
|
||||
raise _ReportError(f"{field_name!r} must be a positive number")
|
||||
return float(value)
|
||||
|
||||
|
||||
def _optional_nonnegative_float(value: Any, field_name: str) -> float | None:
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, bool) or not isinstance(value, (int, float)) or value < 0:
|
||||
raise _ReportError(f"{field_name!r} must be a non-negative number")
|
||||
return float(value)
|
||||
|
||||
|
||||
def _optional_bool(value: Any, field_name: str) -> bool | None:
|
||||
if value is None:
|
||||
return None
|
||||
if not isinstance(value, bool):
|
||||
raise _ReportError(f"{field_name!r} must be a boolean")
|
||||
return value
|
||||
|
||||
|
||||
def _optional_unit_float(value: Any, field_name: str) -> float | None:
|
||||
parsed = _optional_nonnegative_float(value, field_name)
|
||||
if parsed is not None and parsed > 1:
|
||||
raise _ReportError(f"{field_name!r} must be a number from 0 to 1")
|
||||
return parsed
|
||||
|
||||
|
||||
def _maybe_int(value: Any) -> int | None:
|
||||
if isinstance(value, bool) or not isinstance(value, int):
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user