recommend_model: needs_distribution drops every macro model, and horizon is ignored

Abierto
#210 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
api, backend

Línea de trabajo

Start in integration/src/policyengine_macro/capabilities.py at recommend, then trace the registered model capabilities and the MCP tool definition that exposes horizon. Check how incidence tools are registered and tested before choosing an approach. Done means distribution requests return useful guidance for macro candidates and the unused horizon argument is removed or given defined routing behavior, with tests covering both.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

question

Problem

recommend_model (integration/src/policyengine_macro/capabilities.py, recommend) routes on question_type and country only. Two of its inputs do less than a caller expects:

  1. needs_distribution=True drops every macro model. The filter keeps only pe-microsim and og+microsim. So recommend("economic_shock", "us", needs_distribution=True) returns no model, with the "no registered model supports this request" warning. But the suite does answer that question: frbus_shock_incidence, hank_shock_incidence (and hank_shock(include_distribution=True)), svar_inflation_incidence and define_scenario_incidence all produce household distributions. The same is true for forecast/economic_diagnosis (UK, via svar_inflation_incidence) and climate_policy_scenario (via define_scenario_incidence).
  2. horizon is ignored. It is echoed back but never used, so "long run" and "next four quarters" route the same way. (The MCP docstring now says so, on branch vahid/r5-api-scenarios.)

Evidence

Matrix run on 6 Nov 2026 (all 10 question types × uk/us/fr × needs_distribution):

  • economic_shock uk/us, forecast uk, economic_diagnosis uk, climate_policy_scenario uk, structural_change uk, translated_policy_scenario uk: a candidate with needs_distribution=False, none with True.

Options

  1. Register the incidence pairs as capability entries (frb-us+microsim, us-hank+microsim, boe-svar+microsim, define-uk+microsim). Each needs its own quality block, so this is the honest route, but it is more work.
  2. Keep the registry and add an incidence_tools hint to the response when needs_distribution filters out a macro candidate: "frb-us has no distribution itself; frbus_shock_incidence overlays its labour-market path on the US microsim".
  3. Leave it as it is and document that needs_distribution means "the model itself is distributional".

For horizon: either drop the argument, or define a small vocabulary (short_run, medium_term, long_run) and match it against each model's horizon field.

Recommendation

Option 2 now (small, no new quality claims). Drop horizon from the tool until there is a vocabulary, so no caller thinks it is doing something.

🤖 Generated with Claude Code

Lenguaje dominante
HTML
Estrellas
3
Forks
1
Merge medio
1 d 20 h
PR fusionados (30 d)
53

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PolicyEngine/macro

Todos los issues de PolicyEngine/macro

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.