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

Ouverte
#210 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
python
Domaine
api, backend

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
HTML
Étoiles
3
Forks
1
Merge moyen
1 j 20 h
PR mergées (30 j)
53

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de PolicyEngine/macro

Toutes les issues de PolicyEngine/macro

Issues similaires

Plus d'issues Backend & API Design

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.