@@ -226,6 +226,75 @@ def test_route_adapts_to_model_experience() -> None:
226226 selector ._rng .setstate (rng_state )
227227
228228
229+ def test_select_from_pool_uses_local_feedback_prior_strength (monkeypatch ) -> None :
230+ import uncommon_route .benchmark as benchmark
231+
232+ class DummyBenchmarkCache :
233+ def get_all_qualities (self , models ):
234+ return {
235+ "alpha/model" : 0.90 ,
236+ "beta/model" : 0.70 ,
237+ }
238+
239+ monkeypatch .setattr (benchmark , "get_benchmark_cache" , lambda : DummyBenchmarkCache ())
240+
241+ store = ModelExperienceStore (storage = InMemoryModelExperienceStorage (), alpha = 0.25 )
242+ for _ in range (5 ):
243+ store .record_feedback ("alpha/model" , RoutingMode .AUTO , Tier .SIMPLE , "weak" )
244+
245+ common_kwargs = dict (
246+ complexity = 0.15 ,
247+ mode = RoutingMode .AUTO ,
248+ confidence = 0.8 ,
249+ reasoning_text = "test" ,
250+ available_models = ["alpha/model" , "beta/model" ],
251+ estimated_input_tokens = 100 ,
252+ max_output_tokens = 100 ,
253+ prompt = "hello" ,
254+ pricing = {
255+ "alpha/model" : ModelPricing (1.0 , 1.0 ),
256+ "beta/model" : ModelPricing (1.0 , 1.0 ),
257+ },
258+ capabilities = {
259+ "alpha/model" : infer_capabilities ("alpha/model" , ModelPricing (1.0 , 1.0 ), has_explicit_pricing = True ),
260+ "beta/model" : infer_capabilities ("beta/model" , ModelPricing (1.0 , 1.0 ), has_explicit_pricing = True ),
261+ },
262+ requirements = RequestRequirements (),
263+ selection_weights = SelectionWeights (
264+ editorial = 0.0 ,
265+ cost = 0.0 ,
266+ latency = 0.0 ,
267+ reliability = 0.0 ,
268+ feedback = 0.0 ,
269+ cache_affinity = 0.0 ,
270+ byok = 0.0 ,
271+ free_bias = 0.0 ,
272+ local_bias = 0.0 ,
273+ reasoning_bias = 0.0 ,
274+ quality_alignment = 0.0 ,
275+ continuity = 0.0 ,
276+ ),
277+ model_experience = store ,
278+ )
279+
280+ high_prior = select_from_pool (
281+ ** common_kwargs ,
282+ bandit_config = BanditConfig (enabled = False , prior_n = 20.0 ),
283+ )
284+ low_prior = select_from_pool (
285+ ** common_kwargs ,
286+ bandit_config = BanditConfig (enabled = False , prior_n = 5.0 ),
287+ )
288+
289+ assert high_prior .model == "alpha/model"
290+ assert low_prior .model == "beta/model"
291+
292+ high_alpha = next (score for score in high_prior .candidate_scores if score .model == "alpha/model" )
293+ low_alpha = next (score for score in low_prior .candidate_scores if score .model == "alpha/model" )
294+ assert high_alpha .predicted_quality > 0.70
295+ assert low_alpha .predicted_quality < 0.70
296+
297+
229298def test_best_mode_uses_higher_quality_threshold () -> None :
230299 """BEST mode's higher threshold excludes lower-quality models."""
231300 pricing = {
0 commit comments