MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / RoutingConstraints

Class RoutingConstraints

uncommon_route/router/types.py:73–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72@dataclass(frozen=True, slots=True)
73class RoutingConstraints:
74 free_only: bool = False
75 local_only: bool = False
76 allowed_models: tuple[str, ...] = ()
77 allowed_providers: tuple[str, ...] = ()
78 max_cost: float | None = None
79
80 def tags(self) -> tuple[str, ...]:
81 labels: list[str] = []
82 if self.free_only:
83 labels.append("free-only")
84 if self.local_only:
85 labels.append("local-only")
86 if self.allowed_models:
87 labels.append("model-subset")
88 if self.allowed_providers:
89 labels.append("provider-subset")
90 if self.max_cost is not None:
91 labels.append("budget-cap")
92 return tuple(labels)
93
94
95@dataclass(frozen=True, slots=True)

Callers 4

select_modelFunction · 0.90
select_from_poolFunction · 0.90
routeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected