Repository navigation
Conversation
|
The templates docs preview for this pull request has been deployed to Vercel!
|
There was a problem hiding this comment.
🟡 Changes recommended
The walkthrough exceeds the six-step sidecar limit, and the starter Quickstart directs contributors to download a ZIP that is not published.
2 open issues
What changed in this PR
Builds on #110’s RelationalAI 2.1.1 upgrade by moving 35 templates to deployed-model execution, aligning their layout with the documentation site’s deployed-template pages.
Changes:
- Moves model declarations, reasoning, and solver configuration into
model/, with separate reports underqueries/. - Publishes solve status and objectives, moves result checks into reports, and makes Streamlit apps read deployed results and edges.
- Updates deployment instructions, runbooks, documentation metadata, and contributor guidance.
| File | Description |
|---|---|
| wildlife-conservation-network/runbook.md | Updates model, report, and app paths. |
| wildlife-conservation-network/queries/community_report.py | Reads deployed community metrics. |
| wildlife-conservation-network/model/__init__.py | Packages network declarations and graph metrics. |
| wildlife-conservation-network/model_setup.py | Removes the model factory. |
| wildlife-conservation-network/app.py | Queries deployed metrics and partnerships. |
| water_allocation/runbook.md | Documents refresh-driven solving and report paths. |
| water_allocation/queries/flow_allocations.py | Checks solve status and reports flows. |
| water_allocation/model/__init__.py | Configures deployed solving and publishes results. |
| warehouse_allocation/runbook.md | Documents deployed graph-to-solve execution. |
| warehouse_allocation/queries/allocation_report.py | Reports graph analysis and checked allocations. |
| warehouse_allocation/model/__init__.py | Packages graph analysis and allocation solving. |
| traveling_salesman/runbook.md | Updates solve workflow and paths. |
| traveling_salesman/queries/tour.py | Checks model size, status, and tour coverage. |
| traveling_salesman/model/__init__.py | Publishes entity counts and solve results. |
| transaction_screening_local/transaction_screening_local.py | Explicitly deploys to DuckDB before reporting. |
| transaction_screening_local/README.md | Documents explicit local deployment. |
| tests/test_refactored_template_contracts.py | Points the evaluation check at the report module. |
| test_data_generation/queries/test_data_plan.py | Reads deployed row counts and generates samples. |
| synthetic_order_lifecycle/queries/order_trace.py | Checks status and prints deployed event traces. |
| synthetic_order_lifecycle/model/__init__.py | Configures deployed trace generation. |
| synthetic_eligibility_records/queries/eligibility_records.py | Reports generated records with status handling. |
| synthetic_eligibility_records/model/__init__.py | Configures deployed multi-solution generation. |
| supply_chain_transport/runbook.md | Updates model and report paths. |
| supply_chain_transport/queries/transport_plan.py | Reports checked transport and inventory results. |
| supply_chain_transport/model/__init__.py | Configures solving and publishes transport cost. |
| simple-start/README.md | Documents notebook deployment and source permissions. |
| shipment_compliance/runbook.md | Updates the model path. |
| shipment_compliance/queries/compliance_report.py | Queries deployed compliance classifications. |
| shipment_compliance/model/__init__.py | Separates compliance declarations from reporting. |
| shift_assignment/runbook.md | Documents refresh-driven solving and new paths. |
| shift_assignment/queries/shift_assignments.py | Checks status and reports scenario assignments. |
| shift_assignment/model/__init__.py | Configures deployed assignment solving. |
| sample-template/template.py | Removes the starter runner. |
| sample-template/template-docs.yaml | Adds deployment metadata and query references. |
| sample-template/README.md | Introduces the deployed-template Quickstart. |
| sample-template/queries/item_report.py | Adds the starter’s deployed-model report. |
| sample-template/model/__init__.py | Documents package deployment. |
| retail_markdown/runbook.md | Updates model and report paths. |
| retail_markdown/queries/markdown_plan.py | Reports checked discounts, sales, and revenue. |
| retail_markdown/model/__init__.py | Configures deployed markdown optimization. |
| README.md | Describes model packages and query workflows. |
| production_planning/runbook.md | Updates scenario, model, and report paths. |
| production_planning/queries/production_plan.py | Reports checked production quantities. |
| production_planning/model/__init__.py | Configures solving and publishes profit. |
| product_configurator/runbook.md | Documents deployed multi-solution execution. |
| product_configurator/queries/feasible_builds.py | Reports feasible builds and no-result cases. |
| product_configurator/model/__init__.py | Configures deployed build enumeration. |
| pod_placement/runbook.md | Updates deployment and verification descriptions. |
| pod_placement/queries/placement_report.py | Reports checked placements and resource usage. |
| pod_placement/model/__init__.py | Configures solving and publishes placement totals. |
| planogram_optimization/runbook.md | Documents deployed solving and report paths. |
| planogram_optimization/queries/facings_plan.py | Checks demand lookups against deployed data. |
| planogram_optimization/model/__init__.py | Configures solving and publishes total demand. |
| patient_cohort_recruitment/runbook.md | Updates model and report paths. |
| patient_cohort_recruitment/queries/cohort_report.py | Reports checked cohort and coverage results. |
| patient_cohort_recruitment/model/__init__.py | Packages cohort reasoning and solver configuration. |
| network_flow_planning/runbook.md | Updates model and report paths. |
| network_flow_planning/queries/network_plan.py | Reports checked facility and flow decisions. |
| network_flow_planning/model/__init__.py | Configures solving and publishes network cost. |
| it-dependency-mapping/model/__init__.py | Declares paths and downstream-depth rules. |
| humanitarian-aid-supply-chain/runbook.md | Corrects documented centrality values and paths. |
| humanitarian-aid-supply-chain/queries/distribution_point_ranking.py | Reads deployed rankings and network metrics. |
| humanitarian-aid-supply-chain/model/__init__.py | Packages the weighted network and graph metrics. |
| humanitarian-aid-supply-chain/model_setup.py | Removes the model factory. |
| humanitarian-aid-supply-chain/app.py | Queries deployed rankings and supply routes. |
| financial_index_replication/template-docs.yaml | Adds deployment metadata and updates walkthrough references. |
| financial_index_replication/runbook.md | Documents reasoning and report responsibilities. |
| financial_index_replication/README.md | Documents deployment, refresh, and accepted statuses. |
| financial_index_replication/model/reasoning.py | Declares portfolio optimization and published results. |
| financial_index_replication/model/__init__.py | Loads reasoning and exports report symbols. |
| factory_production/runbook.md | Updates model and report paths. |
| entity_resolution/template-docs.yaml | Updates deployment metadata and reasoning references. |
| entity_resolution/runbook.md | Aligns prompts with deployed-model responsibilities. |
| entity_resolution/README.md | Documents deployment setup and report execution. |
| entity_resolution/model/source.py | Loads candidate counts into the model. |
| entity_resolution/model/schema.py | Declares the candidate-count relationship. |
| entity_resolution/model/reasoning.py | Packages clustering, exposure rules, and cession solving. |
| entity_resolution/model/__init__.py | Exports deployed reasoning and report symbols. |
| disease-outbreak-prevention/runbook.md | Corrects documented centrality values and paths. |
| disease-outbreak-prevention/queries/facility_ranking.py | Reads deployed facility metrics. |
| disease-outbreak-prevention/model/__init__.py | Packages the risk-weighted network and metrics. |
| disease-outbreak-prevention/model_setup.py | Removes the model factory. |
| disease-outbreak-prevention/app.py | Queries deployed metrics and facility connections. |
| diet/runbook.md | Documents refresh-driven solving and new paths. |
| diet/queries/diet_plan.py | Checks status and reports scenario diets. |
| diet/model/__init__.py | Configures solving and publishes diet cost. |
| defect_root_cause/runbook.md | Updates deployment and report entry points. |
| cybersecurity-attack-paths/model/__init__.py | Packages attack paths and derived asset flags. |
| CONTRIBUTING.md | Defines model-package and query responsibilities. |
| commercial_underwriting/runbook.md | Updates the model path. |
| cell_tower_coverage/runbook.md | Documents deployed solving and report paths. |
| campaign_roi/runbook.md | Updates model and report paths. |
| campaign_roi/queries/budget_reallocation.py | Reports checked budgets using deployed campaign data. |
| campaign_roi/model/__init__.py | Configures solving and publishes conversion totals. |
| book_slate_recommendation/runbook.md | Documents time-limited results and new paths. |
| bom-reachability/model/__init__.py | Packages graph analysis and assembly-depth rules. |
| ad_spend_allocation/runbook.md | Updates model and report paths. |
| ad_spend_allocation/queries/spend_allocation.py | Checks status and reports scenario spending. |
| ad_spend_allocation/model/__init__.py | Configures solving and publishes conversion totals. |
| .github/prompts/review-template.prompt.md | Updates review guidance for query modules. |
| .github/prompts/create-template-readme.prompt.md | Updates README guidance to name queries. |
| .github/prompts/cleanup-template-code.prompt.md | Separates model reasoning from report queries. |
| .agents/skills/template-authoring/SKILL.md | Updates authoring guidance for deployed templates. |
| .agents/skills/template-authoring/resources/template-docs.md | Defines deployment metadata and seven-step Quickstarts. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Snowflake permissions, refresh execution, and solver publication require connected validation unavailable here, while the inaccessible docs contract leaves deployment-sidecar compatibility unverified.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
chriscoey
marked this pull request as draft
November 14, 2026 19:35
…n report Move the model into model/ (deployed with `rai models deploy --path model`), training into train.py, which trains over the deployed splits and registers the version that `reasoners.predictive.gnns.churn_risk` names, and the report into queries/churn_report.py (`python -m queries.churn_report`). The GNN takes its experiment and registry location from the deployment, and its device from the predictive reasoner's size. A deployed GNN needs concrete types on its task relationships, so the Train and Val relationships carry a Float risk. Rewrite the README Quickstart as the deployment steps with a train step: download, environment, install, configure, deploy, train (then refresh), query, tear down. The data summary now reads from the deployed model, and the expected output is from a deployed run.
…reasoning modules The model package declares the facility concepts, loads the sample data, and states the risk weight and graph metrics in separate modules. The app still imports the same names from the package.
… modules The report reads the solve status and objective from the SolveStatus and TotalProfit relationships the model defines, and no longer prints the formulation or checks the termination status.
…asoning modules The report reads the solve status from the SolveStatus relationship the model defines, and no longer prints the formulation or the solver details.
…d reasoning modules The model package declares the distribution point concepts, loads the sample data, and states the flow weight and graph metrics in separate modules. The app still imports the same names from the package.
…modules The report no longer checks the termination status before printing the diagnosis.
…d reasoning modules The report and the app output are unchanged.
… into coey/templates-deploy-mode-2.1 # Conflicts: # financial_index_replication/financial_index_replication.py # financial_index_replication/template-docs.yaml
…asoning modules The report no longer prints the formulation or checks the termination status before printing the slate.
… order The report prints the solve status and objective from the SolveStatus and TotalResidual relationships the model defines, as the non-deployed template did, and the model package no longer needs an import-order exception.
…modules The report no longer checks the termination status before printing the cession plan. The package imports are in sorted order.
…emplates-deploy-mode-2.1
…emplates-deploy-mode-2.1 # Conflicts: # financial_index_replication/README.md
…emplates-deploy-mode-2.1
…plates-deploy-mode-2.1
… into coey/templates-deploy-mode-2.1
Move the model into model/ (deployed with `rai models deploy --path model`) and the report into queries/energy_grid_report.py (`python -m queries.energy_grid_report`). The model is split into schema, source, and reasoning modules. The Problem is named and configured with HiGHS, and its status and objective are published through relationships the report reads. The report no longer prints the formulation, and its marginal analysis and knee point are computed from the InvestmentPortfolio rows it reads. Stage 1 reads the bundled demand_forecasts.csv. The optional GNN block did not feed any later stage (it only printed a line when a model loaded and otherwise fell back to the CSV), so it is removed together with the `gnn` extra, and the template no longer lists predictive reasoning. Rewrite the README Quickstart as the deployment steps: download, environment, install, configure, deploy, query, tear down. Update the runbook and the README references to the single script.
Move the model into model/ (deployed with `rai models deploy --path model`), training into train.py, which trains over the deployed splits and registers the version that `reasoners.predictive.gnns.equipment_failure` names, and the report into queries/recovery_report.py (`python -m queries.recovery_report`). The GNN takes its experiment and registry location from the deployment, and its device from the predictive reasoner's size. The equipment predictions now feed the rest of the chain inside the model: per-tower failure intensity is a rule over the predictions (a TowerFailureScore concept, since the GNN reads the tower table), the critical-tower rule and the upgrade problem read it, and the upgrade problem runs on HiGHS as part of each refresh. The plan summary is derived from the selected upgrades and published with the solve status and objective. The call-path enumeration moves into the model as well, since a deployed model only has the path tables its own rules ask for, and the report prints the path and tower counts with the hub's highest influence load. Task relationships get concrete types and every GNN column a feature type. Rewrite the README Quickstart as the deployment steps with a train step: download, environment, install, configure, deploy, train (then refresh), query, tear down.
Move the reasoning into model/reasoning.py (deployed with `rai models deploy --path model`), training into train.py, which trains over the deployed splits and registers the version that `reasoners.predictive.gnns.fraud_classifier` names, and the report into queries/fraud_report.py (`python -m queries.fraud_report`). The GNN takes its experiment and registry location from the deployment, and its device from the predictive reasoner's size. The alert score is a rule over the GNN predictions and the audit problem runs on HiGHS as part of each refresh, so one refresh scores the test transfers and selects the audits; the solve status and objective are published by the model. The score and the audit decision belong to a separate AuditCandidate concept, one per scored transfer: the GNN reads the Transaction table, so properties of Transaction derived from its predictions made the predictions depend on themselves and the deploy failed in planning. The GNN's property transformer also drops the sender and receiver relationship columns. The model package calls the bundled-CSV loader on import; the Snowflake-table loader stays in model/source.py, and the runbook and README describe swapping it in. Task relationships get concrete types and every GNN column a feature type. Rewrite the README Quickstart as the deployment steps with a train step: download, environment, install, configure, deploy, train (then refresh), query, tear down. The docs sidecar points at the new files.
- The allocation report exits with the termination status when the solve publishes no total holding cost, instead of printing a plan without one. - README: the description says cross-region route flags, the outputs include the SiteComponent relationship, and the runbook bullet refers to the code in model/.
- README: for Snowflake-backed runs, replace each model.data(...) source in model/source.py with model.Table(...) and rewrite the input checks there, which read the CSVs with pandas. - README: the flow report lists only connections carrying more than 0.001 units, which is why some connections are missing from it.
A benchmark month with no stock returns is written with a blank replica return again, instead of stopping the report.
The sample generator needs a solved row count for every bundled table; a missing one is an error again rather than a successful exit.
The data-flow diagram shows one MIP over all budget levels, and the amortization note includes the reported marginal value per step.
The skill floor applies when a shift has an availability row for a skilled nurse; if all such rows are unavailable the solve is infeasible. The report's no-knee message names the actual condition.
Only solves with a return floor publish a shadow price; the anchors do not.
Shift capacities can also make the joint solve infeasible, and a shift with no available workers gets no coverage requirement.
…rt direction The Logic engine's rank refuses mixed ascending and descending keys, so the deploy failed. Ties now go to the largest subscriber id and path id.
…ties go to the largest id
…es in the README sample
…own concept so the model deploys
…gain Rank by the negated score with the id ascending, which keeps one sort direction for the Logic engine and restores the documented tie-break.
The docs site builds the template page from the README Quickstart and rejects angle brackets inside inline code, so the train step's refresh call names the database as DB again, as it did before.
chriscoey
added a commit
that referenced
this pull request
Nov 25, 2026
…ough The docs site requires a walkthrough step to mention its code references in source order. The report's model.select() call comes before the marginal_risk_per_return column it selects, so the prose now names them in that order.
chriscoey
added a commit
that referenced
this pull request
Nov 25, 2026
An unsuccessful status such as LOCALLY_INFEASIBLE passed the guard, so the report printed an empty flow table and exited 0. It now raises, as diet does for a status other than OPTIMAL.
Ipopt reports LOCALLY_INFEASIBLE, and the report now stops with the termination status before printing its Status line.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Runs every template as a deployed model on relationalai 2.3.0, in the layout the docs site's deployed-template pages expect. Stacked on #110 (the move to 2.1.1); review that first.
All 53 templates pin relationalai 2.3.0. 51 deploy with
rai models deploy; simple-start, transaction_screening_local and fraud-detection's fraud_detection_rules.ipynb calldeploy()from Python. Each ran in its new form on Snowflake (transaction_screening_local on DuckDB): every deploy,train.py, query and notebook. Results compares the outputs with #110's runs.To read the diff, start with diet for the layout, subscriber_retention for
train.py, and any template's README Quickstart for the steps a user follows.What changed
model/package thatrai models deploy --path modeldeploys:schema.pydeclares the concepts,source.pyloads the data, and the rules, graph relations and Problems follow, inreasoning.pyfor most templates.problem.solve(<solver>, **opts)becomesproblem.configure(<solver>, **opts). Each report becomesqueries/<name>.py, run aspython -m queries.<name>; it imports frommodeland reads the deployed results.train.py, run between the deploy and the query. It trains the GNN over the deployed splits and registers the version thatraiconfig.yamlnames, and a refresh then predicts with it. Where a template feeds predictions into a Problem, the values it derived from them in pandas are rules over the predictions, so the Problem reads them in the same refresh.SolveStatusandTotalCostin diet, defined fromproblem.termination_status()andproblem.objective_value(). The queries print them. A report stops, or skips a scenario, with a message when a solve it needs returned no solution.raise SystemExit(...)in the query (neverassert). Input-data checks insource.pycan stoprai models deploy.train.pystep and PAT-user access for the GNN jobs. The fivetemplate-docs.yamlfiles setpage.deployment: true. The contributor docs describe themodel/andqueries/layout.A review of each template against its #110 script also fixed energy_grid_planning's low-carbon check, which scaled generation by 100, and corrected README statements to match the code.
Results
OPTIMAL1,562,600,000), but 1 of 10 data-center requests is compliant instead of 2, from the low-carbon fix above; Louvain finds 3 regions instead of 4. book_slate_recommendation: a different time-limit incumbent,TIME_LIMIT577 instead of 557; both stop at the 180 s limit.simple-start and fraud-detection's fraud_detection_rules.ipynb ran clean; #110 kept no notebook output to compare them with.
TIME_LIMIT632,672,721 instead of 664,676,160, both at the 240 s limit with 16 of 24 scenario cells planned.fraud_detection_local.py, whose loader it keeps: 16 audits in 80 of 80 hours as before, capturing $111,685,519 instead of $60,618,861.OPTIMALplans at 45.41B, 40.46B and 28.92B instead of 46.14B, 41.10B and 29.41B.retail_planning_local.py: both problemsOPTIMAL, revenue $60,942.48 instead of $62,477.99 and cost $6,599.60 instead of $9,488.61.OPTIMALplan picks 24 upgrades as before. The report counts 7 advisories, one per advised equipment model, where Move the templates to relationalai 2.1.1 #110 counted the CSV's 8 rows.Some tables print their rows in a different order, and enumerations number their solutions differently.
Known limits
Problem.verify(...)raisesNotImplementedErroron a deployed model, so the templates that called it no longer re-check the returned solution; the constraints themselves are unchanged.TowerLoad, portfolio_balancing's per-solve concepts), not on the concept the solve reads.Relationship, not aProperty.aggs.rank(-score, id)), so an exact tie still goes to the smallest id.id, and smoker_status_prediction renames columns such asheight(cm). smoker_status_prediction also inlines its 38,984 people rows in four batches, since one inline table of that size failed deploy with "View definition too large".[Unsupported Construct Id Type]warning when they query.rai models teardownfails, so it has no teardown step.SELECTon the table; the README says so.INFEASIBLE, although an empty allocation is feasible.