diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..32fa5dd4d9205fabbde8948c14f9f50e0d66308e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Mind Lab + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9f31fef9d2ae8691ea44bebe09039559878ff34a --- /dev/null +++ b/README.md @@ -0,0 +1,104 @@ +--- +license: mit +task_categories: +- question-answering +- text-generation +language: +- en +pretty_name: FlowBench +size_categories: +- n<1K +tags: +- agents +- tool-use +- benchmark +- harbor +- data-orchestration +--- + +# FlowBench + +Dataset ID: `jwu323/FlowBench` + +FlowBench v3 is a tool-use benchmark for deterministic business operations +workflows. Each task asks an agent to compose Python tools over synthetic +customers, products, orders, returns, inventory, support tickets, FX rates, and +SLA policies. + +This repository contains the public `test` split. It is answer-free by design: +fixed gold labels, oracle solutions, and strict verifier expected files are not +included. The public files are suitable for task inspection, agent integration, +and reproducible smoke tests. Official scoring should use a private evaluator +pack or a freshly generated held-out split with hidden answers. + +## Splits + +`test` contains 300 public task specifications: + +| depth | tasks | description | +|---:|---:|---| +| 1 | 50 | single-step lookups such as region currency or top-selling product id | +| 2 | 50 | filtered order and customer counts | +| 3 | 50 | revenue and refund-rate aggregations | +| 4 | 50 | local-currency conversion and margin-after-refund calculations | +| 5 | 50 | replenishment shortfall and delayed-order revenue workflows | +| 6 | 50 | delayed fulfillment plus SLA breach burden, and at-risk revenue from breached tickets | + +There are 12 task families with 25 tasks per family. The public `test` split is +closed-world and deterministic, but it is not a public-answer leaderboard split. + +## Files + +- `data/test.jsonl`: answer-free task records. +- `tools/flowbench_tools_v3.py`: deterministic tool implementation visible to agents. +- `harbor/`: Harbor-compatible public task pack with a smoke verifier. The smoke + verifier checks output shape only; it is not official scoring. + +Each JSONL record includes: + +- `task_id` +- `depth` +- `family` +- `region`, `category`, `month_start`, `month_end` +- `instruction` +- `answer_format` + +No record contains a gold answer. + +## Running the Harbor Smoke Pack + +```bash +harbor run -p harbor -a -l 1 +``` + +The Harbor pack in this repository is a public smoke pack. It verifies that an +agent writes an output with the required shape. It deliberately does not contain +the private expected answers. + +## Task Families + +- `currency_lookup` +- `top_product_lookup` +- `order_count` +- `unique_customer_count` +- `net_revenue_usd` +- `refund_share_bp` +- `local_net_revenue` +- `margin_after_refunds` +- `reorder_shortfall` +- `delayed_net_revenue` +- `delay_sla_burden` +- `breached_ticket_revenue` + +## Evaluation Notes + +FlowBench is designed to compare how agent interfaces express the same tool +capabilities: function-calling style, command style, and code/REPL style +substrates can all call the same tools. For public release, do not evaluate by +matching against labels embedded in this repository; there are none. Use a +private evaluator or generate a held-out split with hidden answers. + +## Citation + +If you use FlowBench, cite the associated paper or this dataset repository once +the paper is released. diff --git a/data/test.jsonl b/data/test.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..024bd9cda275b8760537c222e95ba03c1375c0a7 --- /dev/null +++ b/data/test.jsonl @@ -0,0 +1,300 @@ +{"answer_format": "exact code", "category": "A", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the NA region? Report only the code.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth1_currency_lookup_t0"} +{"answer_format": "exact code", "category": "B", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the NA region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth1_currency_lookup_t1"} +{"answer_format": "exact code", "category": "C", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the EU region? Report only the code.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth1_currency_lookup_t2"} +{"answer_format": "exact code", "category": "D", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the EU region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth1_currency_lookup_t3"} +{"answer_format": "exact code", "category": "A", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the APAC region? Report only the code.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth1_currency_lookup_t4"} +{"answer_format": "exact code", "category": "D", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the APAC region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth1_currency_lookup_t5"} +{"answer_format": "exact code", "category": "B", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the LATAM region? Report only the code.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth1_currency_lookup_t6"} +{"answer_format": "exact code", "category": "C", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the LATAM region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth1_currency_lookup_t7"} +{"answer_format": "exact code", "category": "D", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the NA region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth1_currency_lookup_t8"} +{"answer_format": "exact code", "category": "A", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the EU region? Report only the code.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth1_currency_lookup_t9"} +{"answer_format": "exact code", "category": "B", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the APAC region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth1_currency_lookup_t10"} +{"answer_format": "exact code", "category": "A", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the LATAM region? Report only the code.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth1_currency_lookup_t11"} +{"answer_format": "exact code", "category": "C", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the NA region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth1_currency_lookup_t12"} +{"answer_format": "exact code", "category": "B", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the EU region? Report only the code.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth1_currency_lookup_t13"} +{"answer_format": "exact code", "category": "C", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the APAC region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth1_currency_lookup_t14"} +{"answer_format": "exact code", "category": "D", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the LATAM region? Report only the code.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth1_currency_lookup_t15"} +{"answer_format": "exact code", "category": "A", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the NA region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth1_currency_lookup_t16"} +{"answer_format": "exact code", "category": "D", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the EU region? Report only the code.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth1_currency_lookup_t17"} +{"answer_format": "exact code", "category": "A", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the APAC region? Report only the code.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth1_currency_lookup_t18"} +{"answer_format": "exact code", "category": "B", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the LATAM region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth1_currency_lookup_t19"} +{"answer_format": "exact code", "category": "C", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the NA region? Report only the code.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth1_currency_lookup_t20"} +{"answer_format": "exact code", "category": "B", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the EU region? Report only the code.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth1_currency_lookup_t21"} +{"answer_format": "exact code", "category": "D", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the APAC region? Report only the code.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth1_currency_lookup_t22"} +{"answer_format": "exact code", "category": "C", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the LATAM region? Report only the code.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth1_currency_lookup_t23"} +{"answer_format": "exact code", "category": "D", "depth": 1, "family": "currency_lookup", "instruction": "What ISO currency code is used for the NA region? Report only the code.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth1_currency_lookup_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 1, "family": "top_product_lookup", "instruction": "For region NA, category A, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth1_top_product_lookup_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 1, "family": "top_product_lookup", "instruction": "For region NA, category B, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth1_top_product_lookup_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 1, "family": "top_product_lookup", "instruction": "For region EU, category C, months 202601-202604, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth1_top_product_lookup_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 1, "family": "top_product_lookup", "instruction": "For region EU, category D, months 202603-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth1_top_product_lookup_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 1, "family": "top_product_lookup", "instruction": "For region APAC, category A, months 202602-202605, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth1_top_product_lookup_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 1, "family": "top_product_lookup", "instruction": "For region APAC, category D, months 202601-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth1_top_product_lookup_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 1, "family": "top_product_lookup", "instruction": "For region LATAM, category B, months 202601-202604, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth1_top_product_lookup_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 1, "family": "top_product_lookup", "instruction": "For region LATAM, category C, months 202603-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth1_top_product_lookup_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 1, "family": "top_product_lookup", "instruction": "For region NA, category D, months 202602-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth1_top_product_lookup_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 1, "family": "top_product_lookup", "instruction": "For region EU, category A, months 202602-202605, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth1_top_product_lookup_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 1, "family": "top_product_lookup", "instruction": "For region APAC, category B, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth1_top_product_lookup_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 1, "family": "top_product_lookup", "instruction": "For region LATAM, category A, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth1_top_product_lookup_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 1, "family": "top_product_lookup", "instruction": "For region NA, category C, months 202601-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth1_top_product_lookup_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 1, "family": "top_product_lookup", "instruction": "For region EU, category B, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth1_top_product_lookup_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 1, "family": "top_product_lookup", "instruction": "For region APAC, category C, months 202602-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth1_top_product_lookup_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 1, "family": "top_product_lookup", "instruction": "For region LATAM, category D, months 202601-202605, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth1_top_product_lookup_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 1, "family": "top_product_lookup", "instruction": "For region NA, category A, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth1_top_product_lookup_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 1, "family": "top_product_lookup", "instruction": "For region EU, category D, months 202601-202602, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth1_top_product_lookup_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 1, "family": "top_product_lookup", "instruction": "For region APAC, category A, months 202603-202604, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth1_top_product_lookup_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 1, "family": "top_product_lookup", "instruction": "For region LATAM, category B, months 202605-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth1_top_product_lookup_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 1, "family": "top_product_lookup", "instruction": "For region NA, category C, months 202602-202604, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth1_top_product_lookup_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 1, "family": "top_product_lookup", "instruction": "For region EU, category B, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth1_top_product_lookup_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 1, "family": "top_product_lookup", "instruction": "For region APAC, category D, months 202603-202605, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth1_top_product_lookup_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 1, "family": "top_product_lookup", "instruction": "For region LATAM, category C, months 202601-202602, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth1_top_product_lookup_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 1, "family": "top_product_lookup", "instruction": "For region NA, category D, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth1_top_product_lookup_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region NA, category A, from month 202601 through 202603? Report the count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth2_order_count_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region NA, category B, from month 202604 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth2_order_count_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region EU, category C, from month 202601 through 202604? Report the count.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth2_order_count_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region EU, category D, from month 202603 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth2_order_count_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region APAC, category A, from month 202602 through 202605? Report the count.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth2_order_count_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region APAC, category D, from month 202601 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth2_order_count_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region LATAM, category B, from month 202601 through 202604? Report the count.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth2_order_count_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region LATAM, category C, from month 202603 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth2_order_count_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region NA, category D, from month 202602 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth2_order_count_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region EU, category A, from month 202602 through 202605? Report the count.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth2_order_count_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region APAC, category B, from month 202604 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth2_order_count_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region LATAM, category A, from month 202601 through 202603? Report the count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth2_order_count_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region NA, category C, from month 202601 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth2_order_count_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region EU, category B, from month 202601 through 202603? Report the count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth2_order_count_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region APAC, category C, from month 202602 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth2_order_count_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region LATAM, category D, from month 202601 through 202605? Report the count.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth2_order_count_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region NA, category A, from month 202604 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth2_order_count_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region EU, category D, from month 202601 through 202602? Report the count.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth2_order_count_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region APAC, category A, from month 202603 through 202604? Report the count.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth2_order_count_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region LATAM, category B, from month 202605 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth2_order_count_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region NA, category C, from month 202602 through 202604? Report the count.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth2_order_count_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region EU, category B, from month 202604 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth2_order_count_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region APAC, category D, from month 202603 through 202605? Report the count.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth2_order_count_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region LATAM, category C, from month 202601 through 202602? Report the count.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth2_order_count_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "order_count", "instruction": "How many paid/refunded orders are in region NA, category D, from month 202601 through 202603? Report the count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth2_order_count_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region NA, category A, from month 202601 through 202603? Report the count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth2_unique_customer_count_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region NA, category B, from month 202604 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth2_unique_customer_count_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region EU, category C, from month 202601 through 202604? Report the count.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth2_unique_customer_count_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region EU, category D, from month 202603 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth2_unique_customer_count_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region APAC, category A, from month 202602 through 202605? Report the count.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth2_unique_customer_count_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region APAC, category D, from month 202601 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth2_unique_customer_count_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region LATAM, category B, from month 202601 through 202604? Report the count.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth2_unique_customer_count_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region LATAM, category C, from month 202603 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth2_unique_customer_count_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region NA, category D, from month 202602 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth2_unique_customer_count_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region EU, category A, from month 202602 through 202605? Report the count.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth2_unique_customer_count_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region APAC, category B, from month 202604 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth2_unique_customer_count_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region LATAM, category A, from month 202601 through 202603? Report the count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth2_unique_customer_count_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region NA, category C, from month 202601 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth2_unique_customer_count_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region EU, category B, from month 202601 through 202603? Report the count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth2_unique_customer_count_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region APAC, category C, from month 202602 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth2_unique_customer_count_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region LATAM, category D, from month 202601 through 202605? Report the count.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth2_unique_customer_count_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region NA, category A, from month 202604 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth2_unique_customer_count_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region EU, category D, from month 202601 through 202602? Report the count.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth2_unique_customer_count_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region APAC, category A, from month 202603 through 202604? Report the count.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth2_unique_customer_count_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region LATAM, category B, from month 202605 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth2_unique_customer_count_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region NA, category C, from month 202602 through 202604? Report the count.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth2_unique_customer_count_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region EU, category B, from month 202604 through 202606? Report the count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth2_unique_customer_count_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region APAC, category D, from month 202603 through 202605? Report the count.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth2_unique_customer_count_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region LATAM, category C, from month 202601 through 202602? Report the count.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth2_unique_customer_count_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 2, "family": "unique_customer_count", "instruction": "How many unique customers placed paid/refunded orders in region NA, category D, from month 202601 through 202603? Report the count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth2_unique_customer_count_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region NA, category A, months 202601-202603: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth3_net_revenue_usd_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region NA, category B, months 202604-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth3_net_revenue_usd_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region EU, category C, months 202601-202604: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth3_net_revenue_usd_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region EU, category D, months 202603-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth3_net_revenue_usd_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region APAC, category A, months 202602-202605: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth3_net_revenue_usd_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region APAC, category D, months 202601-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth3_net_revenue_usd_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region LATAM, category B, months 202601-202604: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth3_net_revenue_usd_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region LATAM, category C, months 202603-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth3_net_revenue_usd_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region NA, category D, months 202602-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth3_net_revenue_usd_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region EU, category A, months 202602-202605: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth3_net_revenue_usd_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region APAC, category B, months 202604-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth3_net_revenue_usd_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region LATAM, category A, months 202601-202603: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth3_net_revenue_usd_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region NA, category C, months 202601-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth3_net_revenue_usd_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region EU, category B, months 202601-202603: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth3_net_revenue_usd_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region APAC, category C, months 202602-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth3_net_revenue_usd_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region LATAM, category D, months 202601-202605: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth3_net_revenue_usd_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region NA, category A, months 202604-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth3_net_revenue_usd_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region EU, category D, months 202601-202602: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth3_net_revenue_usd_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region APAC, category A, months 202603-202604: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth3_net_revenue_usd_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region LATAM, category B, months 202605-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth3_net_revenue_usd_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region NA, category C, months 202602-202604: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth3_net_revenue_usd_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region EU, category B, months 202604-202606: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth3_net_revenue_usd_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region APAC, category D, months 202603-202605: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth3_net_revenue_usd_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region LATAM, category C, months 202601-202602: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth3_net_revenue_usd_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "net_revenue_usd", "instruction": "For orders in region NA, category D, months 202601-202603: compute each order's net USD revenue after loyalty discount and refunds, then report the total net revenue in USD.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth3_net_revenue_usd_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region NA, category A, months 202601-202603: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth3_refund_share_bp_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region NA, category B, months 202604-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth3_refund_share_bp_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region EU, category C, months 202601-202604: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth3_refund_share_bp_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region EU, category D, months 202603-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth3_refund_share_bp_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region APAC, category A, months 202602-202605: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth3_refund_share_bp_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region APAC, category D, months 202601-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth3_refund_share_bp_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region LATAM, category B, months 202601-202604: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth3_refund_share_bp_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region LATAM, category C, months 202603-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth3_refund_share_bp_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region NA, category D, months 202602-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth3_refund_share_bp_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region EU, category A, months 202602-202605: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth3_refund_share_bp_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region APAC, category B, months 202604-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth3_refund_share_bp_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region LATAM, category A, months 202601-202603: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth3_refund_share_bp_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region NA, category C, months 202601-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth3_refund_share_bp_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region EU, category B, months 202601-202603: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth3_refund_share_bp_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region APAC, category C, months 202602-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth3_refund_share_bp_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region LATAM, category D, months 202601-202605: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth3_refund_share_bp_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region NA, category A, months 202604-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth3_refund_share_bp_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region EU, category D, months 202601-202602: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth3_refund_share_bp_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region APAC, category A, months 202603-202604: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth3_refund_share_bp_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region LATAM, category B, months 202605-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth3_refund_share_bp_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region NA, category C, months 202602-202604: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth3_refund_share_bp_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region EU, category B, months 202604-202606: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth3_refund_share_bp_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region APAC, category D, months 202603-202605: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth3_refund_share_bp_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region LATAM, category C, months 202601-202602: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth3_refund_share_bp_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 3, "family": "refund_share_bp", "instruction": "For orders in region NA, category D, months 202601-202603: sum gross USD revenue and refund USD amounts, then report the refund share in basis points as floor(refunds * 10000 / gross). Report 0 if gross is zero.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth3_refund_share_bp_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region NA, category A, months 202601-202603: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth4_local_net_revenue_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region NA, category B, months 202604-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth4_local_net_revenue_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region EU, category C, months 202601-202604: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth4_local_net_revenue_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region EU, category D, months 202603-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth4_local_net_revenue_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region APAC, category A, months 202602-202605: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth4_local_net_revenue_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region APAC, category D, months 202601-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth4_local_net_revenue_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region LATAM, category B, months 202601-202604: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth4_local_net_revenue_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region LATAM, category C, months 202603-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth4_local_net_revenue_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region NA, category D, months 202602-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth4_local_net_revenue_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region EU, category A, months 202602-202605: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth4_local_net_revenue_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region APAC, category B, months 202604-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth4_local_net_revenue_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region LATAM, category A, months 202601-202603: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth4_local_net_revenue_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region NA, category C, months 202601-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth4_local_net_revenue_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region EU, category B, months 202601-202603: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth4_local_net_revenue_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region APAC, category C, months 202602-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth4_local_net_revenue_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region LATAM, category D, months 202601-202605: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth4_local_net_revenue_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region NA, category A, months 202604-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth4_local_net_revenue_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region EU, category D, months 202601-202602: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth4_local_net_revenue_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region APAC, category A, months 202603-202604: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth4_local_net_revenue_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region LATAM, category B, months 202605-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth4_local_net_revenue_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region NA, category C, months 202602-202604: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth4_local_net_revenue_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region EU, category B, months 202604-202606: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth4_local_net_revenue_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region APAC, category D, months 202603-202605: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth4_local_net_revenue_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region LATAM, category C, months 202601-202602: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth4_local_net_revenue_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "local_net_revenue", "instruction": "For orders in region NA, category D, months 202601-202603: sum net USD revenue after loyalty discounts and refunds, then convert the total into the region's local currency. Report the integer local-currency amount.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth4_local_net_revenue_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region NA, category A, months 202601-202603: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth4_margin_after_refunds_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region NA, category B, months 202604-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth4_margin_after_refunds_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region EU, category C, months 202601-202604: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth4_margin_after_refunds_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region EU, category D, months 202603-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth4_margin_after_refunds_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region APAC, category A, months 202602-202605: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth4_margin_after_refunds_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region APAC, category D, months 202601-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth4_margin_after_refunds_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region LATAM, category B, months 202601-202604: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth4_margin_after_refunds_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region LATAM, category C, months 202603-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth4_margin_after_refunds_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region NA, category D, months 202602-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth4_margin_after_refunds_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region EU, category A, months 202602-202605: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth4_margin_after_refunds_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region APAC, category B, months 202604-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth4_margin_after_refunds_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region LATAM, category A, months 202601-202603: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth4_margin_after_refunds_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region NA, category C, months 202601-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth4_margin_after_refunds_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region EU, category B, months 202601-202603: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth4_margin_after_refunds_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region APAC, category C, months 202602-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth4_margin_after_refunds_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region LATAM, category D, months 202601-202605: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth4_margin_after_refunds_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region NA, category A, months 202604-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth4_margin_after_refunds_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region EU, category D, months 202601-202602: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth4_margin_after_refunds_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region APAC, category A, months 202603-202604: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth4_margin_after_refunds_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region LATAM, category B, months 202605-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth4_margin_after_refunds_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region NA, category C, months 202602-202604: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth4_margin_after_refunds_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region EU, category B, months 202604-202606: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth4_margin_after_refunds_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region APAC, category D, months 202603-202605: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth4_margin_after_refunds_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region LATAM, category C, months 202601-202602: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth4_margin_after_refunds_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 4, "family": "margin_after_refunds", "instruction": "For orders in region NA, category D, months 202601-202603: compute each order's gross USD margin, subtract that order's USD refund amount, floor at zero per order, and report the total margin.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth4_margin_after_refunds_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region NA, category A, months 202601-202603. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth5_reorder_shortfall_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region NA, category B, months 202604-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth5_reorder_shortfall_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region EU, category C, months 202601-202604. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth5_reorder_shortfall_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region EU, category D, months 202603-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth5_reorder_shortfall_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region APAC, category A, months 202602-202605. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth5_reorder_shortfall_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region APAC, category D, months 202601-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth5_reorder_shortfall_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region LATAM, category B, months 202601-202604. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth5_reorder_shortfall_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region LATAM, category C, months 202603-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth5_reorder_shortfall_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region NA, category D, months 202602-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth5_reorder_shortfall_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region EU, category A, months 202602-202605. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth5_reorder_shortfall_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region APAC, category B, months 202604-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth5_reorder_shortfall_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region LATAM, category A, months 202601-202603. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth5_reorder_shortfall_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region NA, category C, months 202601-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth5_reorder_shortfall_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region EU, category B, months 202601-202603. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth5_reorder_shortfall_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region APAC, category C, months 202602-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth5_reorder_shortfall_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region LATAM, category D, months 202601-202605. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth5_reorder_shortfall_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region NA, category A, months 202604-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth5_reorder_shortfall_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region EU, category D, months 202601-202602. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth5_reorder_shortfall_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region APAC, category A, months 202603-202604. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth5_reorder_shortfall_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region LATAM, category B, months 202605-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth5_reorder_shortfall_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region NA, category C, months 202602-202604. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth5_reorder_shortfall_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region EU, category B, months 202604-202606. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth5_reorder_shortfall_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region APAC, category D, months 202603-202605. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth5_reorder_shortfall_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region LATAM, category C, months 202601-202602. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth5_reorder_shortfall_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "reorder_shortfall", "instruction": "Find the top-selling product id for region NA, category D, months 202601-202603. For that product, compute inventory position (on_hand - reserved + inbound), estimate daily demand as floor(units sold in the window / 4) with a minimum of 1, compute planning demand as (lead_time_days + 21 safety-stock days) * daily demand, and report the reorder shortfall max(0, planning demand - inventory position).", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth5_reorder_shortfall_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region NA, category A, months 202601-202603: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth5_delayed_net_revenue_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region NA, category B, months 202604-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth5_delayed_net_revenue_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region EU, category C, months 202601-202604: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth5_delayed_net_revenue_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region EU, category D, months 202603-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth5_delayed_net_revenue_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region APAC, category A, months 202602-202605: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth5_delayed_net_revenue_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region APAC, category D, months 202601-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth5_delayed_net_revenue_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region LATAM, category B, months 202601-202604: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth5_delayed_net_revenue_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region LATAM, category C, months 202603-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth5_delayed_net_revenue_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region NA, category D, months 202602-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth5_delayed_net_revenue_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region EU, category A, months 202602-202605: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth5_delayed_net_revenue_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region APAC, category B, months 202604-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth5_delayed_net_revenue_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region LATAM, category A, months 202601-202603: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth5_delayed_net_revenue_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region NA, category C, months 202601-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth5_delayed_net_revenue_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region EU, category B, months 202601-202603: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth5_delayed_net_revenue_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region APAC, category C, months 202602-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth5_delayed_net_revenue_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region LATAM, category D, months 202601-202605: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth5_delayed_net_revenue_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region NA, category A, months 202604-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth5_delayed_net_revenue_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region EU, category D, months 202601-202602: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth5_delayed_net_revenue_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region APAC, category A, months 202603-202604: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth5_delayed_net_revenue_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region LATAM, category B, months 202605-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth5_delayed_net_revenue_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region NA, category C, months 202602-202604: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth5_delayed_net_revenue_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region EU, category B, months 202604-202606: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth5_delayed_net_revenue_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region APAC, category D, months 202603-202605: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth5_delayed_net_revenue_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region LATAM, category C, months 202601-202602: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth5_delayed_net_revenue_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 5, "family": "delayed_net_revenue", "instruction": "For region NA, category D, months 202601-202603: get the paid/refunded orders, keep only orders whose ship_days exceeded promised_days, compute net USD revenue after loyalty discounts and refunds for those delayed orders, and report the total.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth5_delayed_net_revenue_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "delay_sla_burden", "instruction": "For region NA, category A, months 202601-202603: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth6_delay_sla_burden_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "delay_sla_burden", "instruction": "For region NA, category B, months 202604-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth6_delay_sla_burden_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "delay_sla_burden", "instruction": "For region EU, category C, months 202601-202604: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth6_delay_sla_burden_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "delay_sla_burden", "instruction": "For region EU, category D, months 202603-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth6_delay_sla_burden_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "delay_sla_burden", "instruction": "For region APAC, category A, months 202602-202605: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth6_delay_sla_burden_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "delay_sla_burden", "instruction": "For region APAC, category D, months 202601-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth6_delay_sla_burden_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "delay_sla_burden", "instruction": "For region LATAM, category B, months 202601-202604: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth6_delay_sla_burden_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "delay_sla_burden", "instruction": "For region LATAM, category C, months 202603-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth6_delay_sla_burden_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "delay_sla_burden", "instruction": "For region NA, category D, months 202602-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth6_delay_sla_burden_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "delay_sla_burden", "instruction": "For region EU, category A, months 202602-202605: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth6_delay_sla_burden_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "delay_sla_burden", "instruction": "For region APAC, category B, months 202604-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth6_delay_sla_burden_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "delay_sla_burden", "instruction": "For region LATAM, category A, months 202601-202603: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth6_delay_sla_burden_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "delay_sla_burden", "instruction": "For region NA, category C, months 202601-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth6_delay_sla_burden_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "delay_sla_burden", "instruction": "For region EU, category B, months 202601-202603: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth6_delay_sla_burden_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "delay_sla_burden", "instruction": "For region APAC, category C, months 202602-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth6_delay_sla_burden_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "delay_sla_burden", "instruction": "For region LATAM, category D, months 202601-202605: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth6_delay_sla_burden_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "delay_sla_burden", "instruction": "For region NA, category A, months 202604-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth6_delay_sla_burden_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "delay_sla_burden", "instruction": "For region EU, category D, months 202601-202602: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth6_delay_sla_burden_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "delay_sla_burden", "instruction": "For region APAC, category A, months 202603-202604: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth6_delay_sla_burden_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "delay_sla_burden", "instruction": "For region LATAM, category B, months 202605-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth6_delay_sla_burden_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "delay_sla_burden", "instruction": "For region NA, category C, months 202602-202604: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth6_delay_sla_burden_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "delay_sla_burden", "instruction": "For region EU, category B, months 202604-202606: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth6_delay_sla_burden_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "delay_sla_burden", "instruction": "For region APAC, category D, months 202603-202605: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth6_delay_sla_burden_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "delay_sla_burden", "instruction": "For region LATAM, category C, months 202601-202602: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth6_delay_sla_burden_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "delay_sla_burden", "instruction": "For region NA, category D, months 202601-202603: get the orders, count delayed orders where ship_days exceeded promised_days, find high and critical support tickets for those orders, count tickets that breach a 24-hour first-response or 120-hour resolution SLA, and report delayed_order_count + breached_ticket_count.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth6_delay_sla_burden_t24"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region NA, category A, months 202601-202603: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth6_breached_ticket_revenue_t0"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region NA, category B, months 202604-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth6_breached_ticket_revenue_t1"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region EU, category C, months 202601-202604: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "EU", "task_id": "v3_depth6_breached_ticket_revenue_t2"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region EU, category D, months 202603-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "EU", "task_id": "v3_depth6_breached_ticket_revenue_t3"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region APAC, category A, months 202602-202605: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "APAC", "task_id": "v3_depth6_breached_ticket_revenue_t4"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region APAC, category D, months 202601-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "APAC", "task_id": "v3_depth6_breached_ticket_revenue_t5"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region LATAM, category B, months 202601-202604: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202604, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth6_breached_ticket_revenue_t6"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region LATAM, category C, months 202603-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202603, "region": "LATAM", "task_id": "v3_depth6_breached_ticket_revenue_t7"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region NA, category D, months 202602-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "NA", "task_id": "v3_depth6_breached_ticket_revenue_t8"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region EU, category A, months 202602-202605: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202605, "month_start": 202602, "region": "EU", "task_id": "v3_depth6_breached_ticket_revenue_t9"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region APAC, category B, months 202604-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "APAC", "task_id": "v3_depth6_breached_ticket_revenue_t10"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region LATAM, category A, months 202601-202603: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth6_breached_ticket_revenue_t11"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region NA, category C, months 202601-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202601, "region": "NA", "task_id": "v3_depth6_breached_ticket_revenue_t12"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region EU, category B, months 202601-202603: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "EU", "task_id": "v3_depth6_breached_ticket_revenue_t13"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region APAC, category C, months 202602-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202602, "region": "APAC", "task_id": "v3_depth6_breached_ticket_revenue_t14"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region LATAM, category D, months 202601-202605: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202605, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth6_breached_ticket_revenue_t15"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region NA, category A, months 202604-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "NA", "task_id": "v3_depth6_breached_ticket_revenue_t16"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region EU, category D, months 202601-202602: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "EU", "task_id": "v3_depth6_breached_ticket_revenue_t17"} +{"answer_format": "exact integer", "category": "A", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region APAC, category A, months 202603-202604: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202604, "month_start": 202603, "region": "APAC", "task_id": "v3_depth6_breached_ticket_revenue_t18"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region LATAM, category B, months 202605-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202605, "region": "LATAM", "task_id": "v3_depth6_breached_ticket_revenue_t19"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region NA, category C, months 202602-202604: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202604, "month_start": 202602, "region": "NA", "task_id": "v3_depth6_breached_ticket_revenue_t20"} +{"answer_format": "exact integer", "category": "B", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region EU, category B, months 202604-202606: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202606, "month_start": 202604, "region": "EU", "task_id": "v3_depth6_breached_ticket_revenue_t21"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region APAC, category D, months 202603-202605: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202605, "month_start": 202603, "region": "APAC", "task_id": "v3_depth6_breached_ticket_revenue_t22"} +{"answer_format": "exact integer", "category": "C", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region LATAM, category C, months 202601-202602: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202602, "month_start": 202601, "region": "LATAM", "task_id": "v3_depth6_breached_ticket_revenue_t23"} +{"answer_format": "exact integer", "category": "D", "depth": 6, "family": "breached_ticket_revenue", "instruction": "For region NA, category D, months 202601-202603: get the paid/refunded orders, find high and critical tickets for those orders, keep tickets that breach a 24-hour first-response or 120-hour resolution SLA, map those breached tickets back to their unique order ids, compute net USD revenue after discounts and refunds for those orders, and report the total at-risk revenue.", "kind": "ops", "month_end": 202603, "month_start": 202601, "region": "NA", "task_id": "v3_depth6_breached_ticket_revenue_t24"} diff --git a/harbor/README.md b/harbor/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f6a4b770a52bd3e59be9a458fb1d71d12f300a09 --- /dev/null +++ b/harbor/README.md @@ -0,0 +1,21 @@ +# FlowBench v3 Public Release + +This is the answer-free public task package. It is suitable for inspecting +tasks, integrating agents, and launching Harbor containers with a smoke +verifier. It is not the official scoring package. + +Files intentionally excluded from this public package: +- fixed gold labels +- Harbor oracle solutions +- strict verifier expected files +- model result logs and generated transcripts + +Official benchmark scores should be computed with the private evaluator +pack or a freshly generated held-out split. Publishing fixed labels for the +official split would make hard-coded benchmark submissions possible. + +Harbor smoke run, replacing `` with the Harbor agent to evaluate: + +```bash +harbor run -p code/flowbench_public/harbor_v3_public -a -l 1 +``` diff --git a/harbor/dataset.toml b/harbor/dataset.toml new file mode 100644 index 0000000000000000000000000000000000000000..86e2104d4f9794b6a7ebbb4d689ecaeae22c594c --- /dev/null +++ b/harbor/dataset.toml @@ -0,0 +1,1210 @@ +# Public task-only manifest for mindlab/flowbench-v3-public +# Smoke verifier only; official scoring uses the private evaluator pack. + +[dataset] +name = "mindlab/flowbench-v3-public" +description = "Answer-free public FlowBench v3 task pack with smoke verifier." +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] +[[dataset.authors]] +name = "Mind Lab" +email = "contact@mindlab.ltd" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t0" +digest = "sha256:38952be087dded21bdc16c0f099ee4dcdf3e19315149efa8b9a05ec65e87a4cc" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t1" +digest = "sha256:29d1778238deed5b2ecab2bef000e46556a15bb0a37e87a555c3698388401da2" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t2" +digest = "sha256:e999f46b693e5be45c383abb2eb7053659991d24c34cd0226723f1783896a895" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t3" +digest = "sha256:08572d97636eafaa654dc5bb4d334c932bbd64380ae3d5b4c520be025ff387b9" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t4" +digest = "sha256:7e938a3de0e60e651619335a554bf854b7105ff5514e5a73f4448e60626e7726" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t5" +digest = "sha256:0c1aa8e7381c5b6ccf4fed06365a885b8fe27990fd513b20f7805add393719d4" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t6" +digest = "sha256:beba5b7fd75837a6859c794a82d791a77c05760e918ae7062034804873b506af" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t7" +digest = "sha256:5cd31f7a566a2bc0c62f34d39f25d8807d3ea61dac48b7db687f8f49f4d3bba8" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t8" +digest = "sha256:fac1ff8137bc6f6c824e9bd2bb9d64c549cc3b891bccdf18c623be364c96516d" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t9" +digest = "sha256:3d57a28fb4e7a927cd6813cf0aab9dc48a80c3df1ef2ddf741e1f880ecb49935" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t10" +digest = "sha256:e72f9e47a0d208f99e92e4430ab874328146ae0cd12bd8cfdc87ae3c39bee3d0" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t11" +digest = "sha256:d9188060c7e6d2347c4097af84c91e7edb15fd235dacca2fb363a6a0267e6aad" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t12" +digest = "sha256:10bd9cdd11ac3a23fa8b4c365551e79ee81e8c658f465be038ff2a2f80f2d1e4" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t13" +digest = "sha256:7df6f59824962952d1b6100297b900b8b7cb5cbd9128f54813751186ba118d9d" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t14" +digest = "sha256:14ae991706f62d3452fc4fe72a247fb2da74c3af7e668fc82b4c00e04782c455" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t15" +digest = "sha256:87a868fd22a186a6aa6e5dd7c66e04a296529fdc1bc02753c7abee4eaf3c8c67" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t16" +digest = "sha256:b3c01a2c210d98c61785c720d47c103504822f3e8756ccfca1dc78908314cff7" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t17" +digest = "sha256:417c789452b47e32d6d6daa0cb0fb896c637d339040b90c75aca34779416867c" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t18" +digest = "sha256:260c7f74e4fd795b7a4fac41d2f3f71241ed0b3d50f04fd5403acd178b3d3b09" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t19" +digest = "sha256:f484c166069615c461a572f73de047cb7295999d1f8971d0f4eba637f36584e1" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t20" +digest = "sha256:17eef1cf3d1e06d862a7dac4273f67441ea55236ff2fd1a8aa1d2ad82289d82b" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t21" +digest = "sha256:414a719a51eb85c838a56b00e6ea2994348f8d5b5a32b06ce33da695c792b28f" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t22" +digest = "sha256:7d89c8ee836cb6e65e9442422560a31b0505c2cf1df15130301947cf532e4471" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t23" +digest = "sha256:6cdbf1970fffb6ba11bb8c2e8d9d1136d5b5d1304ce59159b9e35101e7f279a3" + +[[tasks]] +name = "mindlab/v3_depth1_currency_lookup_t24" +digest = "sha256:4c9540a6f2624f715648ff3447f2df385e4272dd9dcd4023d5a37d117916e928" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t0" +digest = "sha256:8ecff84976eb65e8faa0269c03a2fb551c8b45cdd55cfdbc7818dd7a962fe191" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t1" +digest = "sha256:03b3b1fd470c5a47e91fb0899d30cfbcf927901853e8dfa271479587672cad6a" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t2" +digest = "sha256:69009aa9deeb372399e6fcea5c9790d4ab9727bfe2465aaa7aefaec0ba4ce879" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t3" +digest = "sha256:c6bfeb4396163b26a0d699944ab0c94e23b97c73b3c1b125f1d9121833b45139" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t4" +digest = "sha256:5a4d0a0ca95fd43c48132202f9930d248a58a763805125c518d1fb06ca4df9be" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t5" +digest = "sha256:cc2222c4da2d2c07b622809628118113a080d0987fb7ee6c94bd138572ff2a5b" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t6" +digest = "sha256:9274ca72d5ce3b281c85941c17df44511622494336df6f7086577890dbd46f66" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t7" +digest = "sha256:369c2105cca67232c30409b98d22b4d688aff5c6d41a2e4e38a1d4ef23e228cc" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t8" +digest = "sha256:bb63dfdb01c670e852aded52b8c9c6933f969dfdcf71941a886f0f60b156d841" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t9" +digest = "sha256:a2eb6ceb3187b3f7a54df52b10c917265e7002c586c865f226c1de71e18bcdae" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t10" +digest = "sha256:ff0c0946461999b100daea851732bb78f0efed21c54347e1c8224f34f2db0901" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t11" +digest = "sha256:ac6f660f8da2cd724c5e64ec6bf0ee60d4981e0a93ca763b50b385971d30b584" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t12" +digest = "sha256:4beaf32fba1a8ebc461a186c0e2c3d93ef3cc5d91b424c73f7eb55e2acf11831" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t13" +digest = "sha256:2d6087702a179b14a024bb8f07ce089448e93712e6b4ba578c41881303bfbd16" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t14" +digest = "sha256:1cd43d588d229ac93d1d8076ec997c0c421fa9682fcc85008a430b6184fd6a6c" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t15" +digest = "sha256:d631560f48523145db325850575583dcb0aa69a895cb37b7be7d219fa98a281f" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t16" +digest = "sha256:086c0e17a1ca99d16a175af13682590cba52488e034eb49486e33d4f6e5fd3f1" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t17" +digest = "sha256:ba64ae9ccde1efe1748fd7e60063f4b0de688b6f5b871c69693d1d998c7aeb87" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t18" +digest = "sha256:82d07ad6ead4b48466cf8b502147f8a6667cabdfbf185fc4c50d0a7f0049f5c3" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t19" +digest = "sha256:8600998ac67e8a59ecab439c6a4c45f23574491be744acf867b613e08a6196c1" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t20" +digest = "sha256:400bf14ef9d5ae2c993de9ee999e7e2039e069d8e43de8f82711910498e1e69a" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t21" +digest = "sha256:60295743c068215937f96c0023c9d0820ab8d4be032047d0d8b6b5a039c9d315" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t22" +digest = "sha256:8cc0b7df5e3b73eda6a3c23f7eef0cf1a40c9db9a8fc56cee283c040a4c2cd82" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t23" +digest = "sha256:b414ce2a50896eac507e1f7bb4d36bd825968260ad21810690c8943e0ba5cd1f" + +[[tasks]] +name = "mindlab/v3_depth1_top_product_lookup_t24" +digest = "sha256:20cb854552f9a47149eb02f7da8417a46f9a543566b73bdb3f5db3ef4ff1536b" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t0" +digest = "sha256:46c7a242eb11e56770c0d456985d48fae51ebc713428a55978d06afa09c514f5" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t1" +digest = "sha256:6873fb0c4efacf6943d2b1bb2d61072fb482f6950f7ae956164e052f8aa9b09d" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t2" +digest = "sha256:f1e2fa0a5495873e812a2b218077868749fd7e0428c613b46a0ed4abd01a2e7b" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t3" +digest = "sha256:34cb144c0978f9c8a64212212457299d38fe8b348d095ebfd659eba4fcdea3c1" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t4" +digest = "sha256:2fdd23792ea797952f49b49917d6ed6a122089968c0f8594d24266a36c358fe9" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t5" +digest = "sha256:90ce8959bcf6f848bae6476cd6bd2c63f1ddb3ec846a14041bc942120b645570" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t6" +digest = "sha256:aee653c6506521b5c95b7410105780115f1adb81f4e9fbe4bf437f6ba45c4676" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t7" +digest = "sha256:e419fe5c0934370b70f5e41e33fd4abb45368d77b8df47ece4e32644c6af8633" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t8" +digest = "sha256:ffac21dc82682b2400fbd2b122f92ca01f40133dce44c9fccd724e503993bb9a" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t9" +digest = "sha256:fd445403ae2aca6bd0bc92ad7bf57bc10b8d3083f4bc16bd28dea59312400cbb" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t10" +digest = "sha256:b18b92ac27da7e6538c48783dd49e1966c1502296590e5e4a14cc8c26a2b21e9" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t11" +digest = "sha256:a436a02bc8970eb7407bfbb90cbb404cf90158bae13bbdd126387e8a351e263d" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t12" +digest = "sha256:32e551c73a18ae20e6d90d32aa263d8f01bc1a897b91393747eabe6cc6b5dc7c" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t13" +digest = "sha256:43e55f537e0309c429a13b83cb91d1eb496f51cd2c7244d270358737f2bc96ec" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t14" +digest = "sha256:249f49fd955a8cfc7a29a154ff68c43cd822b9f13ad5b4fa74c7356e021ba8ff" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t15" +digest = "sha256:3d3bb62350b950707f8cb5b96da7336bba0b376144d80e742ba57b813c546604" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t16" +digest = "sha256:4cde6f134b4dbd1286d40dcd47fdef1c757b159d591d538f46e9624f6be99573" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t17" +digest = "sha256:df835d60319087f7f28951633c5d4350d7026ff8d6b573af1cea3a4563a93027" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t18" +digest = "sha256:758f33cea97f13bac62e0ddacefad2692f58dda2d91b8dd198509a1e69d40fe3" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t19" +digest = "sha256:037221b8eb614a1bf9eb63f511aae73f3e1a018034fdf0216ec78f99c591f9df" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t20" +digest = "sha256:2613706cbf67313c910f0353a8336fe7274f3382976a37b91a84d1afc25ef05b" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t21" +digest = "sha256:a16dc5e8f16540b646d8846f7edbd2ed001ab3f821e23049147874676a5bee45" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t22" +digest = "sha256:1066628f29df214850718c3b85fd6251be23e1d9cd59fc5e5f7dc810c337cfd4" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t23" +digest = "sha256:29e4b0d20ca96c9fef55a79475130cb5cc33be03dfce67837308eb7fb1b6a0d8" + +[[tasks]] +name = "mindlab/v3_depth2_order_count_t24" +digest = "sha256:856b5503d50140deeb6aebded8ab212f24a04ee6db40ba5dd317838fef9b2aa6" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t0" +digest = "sha256:01753bbfaba7e43a1e1fad9fb4376b7f22cccb1af777dbe809a997b3319eb61f" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t1" +digest = "sha256:bff9a3014a35f8f6fce94d5f66693cd02dd1e92ad30b7c5fa7440a2558855d01" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t2" +digest = "sha256:6360a049077eb628f2eae90072eb5b3e1ac614485515756f86926f3042626e13" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t3" +digest = "sha256:54b00e2afceb7e7993592b600a55a442b128aeac208bd272688a21f5a56f70c4" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t4" +digest = "sha256:8ca794136e0b46939793f6a70900eb59c067f7d4249790616eb1b71dc6a98dbe" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t5" +digest = "sha256:71921c421f84bc7cb83a242585a11bb301c82cd80c269888dc51eb92cc71feb4" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t6" +digest = "sha256:f3b5deef2ed76b28fb9ce24baea1d279e83aede0415e05270498aab8a2812fe3" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t7" +digest = "sha256:69b3e29ac47ff5d87dd7eb50d845cfce51a213da46e0fbddea9f4130f51ce394" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t8" +digest = "sha256:33acb284e0cc7a5a3088906e8ed3cf71639ec68ed90d2812932874049c1483f1" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t9" +digest = "sha256:cef17783b7d361ad70f9dc92da4f9a9b70c41b88822fdfeb3b2cc7a5bd3c448d" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t10" +digest = "sha256:4fe74bbc86e910cb5dfd4416bfdce9e2b6ef4f0705bc029d4c7989da1489f29a" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t11" +digest = "sha256:a1c0fa906cbaa1ecf2a60edaf00cb281d4c8bc5a3fe851ce333987c98b18d28c" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t12" +digest = "sha256:bb3f1fceefebaf9a0c835fa4b9f67e030e15b3e02121103755a231653caccb8c" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t13" +digest = "sha256:d95a6f730e4c7602d1e325237440fa9e4c53d2186396c55f698aa88740a86ac0" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t14" +digest = "sha256:5b945b7e0b10ce1790a475329957e46539391c11001df820994b964a7debf5fd" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t15" +digest = "sha256:081fe8b63b7612ea6571216d7dc5df02a26a2fdad896b2f3b88fafc3c8be9143" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t16" +digest = "sha256:bcbace62285425120c7571b037f4bd4988d170be751b2bd7e711a6aaa9e310d1" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t17" +digest = "sha256:f5188c6862d6b4e7ac8997abf0848dd3f3cc3d3836ee3b1100b45064673e89fb" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t18" +digest = "sha256:152fd7cafe09366657fbb93f30826d1d1c96c3cebb5c74c56da3e1e44077c353" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t19" +digest = "sha256:1231cb9cd97981651dcba311b3ddf0dcef96865d582203ad58de80b0cb5df1cc" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t20" +digest = "sha256:5fe09fd3a80cdc43b0d8d9d6e0ad086e962052cc9b9549c0cbb8c9a4efeb311f" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t21" +digest = "sha256:4ec9f7fcb6e87fd9cf7db8e1498cd249b81f9c349eec5e51fed501faa42179c9" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t22" +digest = "sha256:a6d3f10092327fb6d7b15b9aaf890de9c9f12e60996167a6ad54a50357c4c8d5" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t23" +digest = "sha256:ffaa621befca29c11212ff90e05af04b6455e0a4a829cf1ed8a3340aa4a29dab" + +[[tasks]] +name = "mindlab/v3_depth2_unique_customer_count_t24" +digest = "sha256:fb025e975c9a36908c0f37e40f0792f2019d5f1295d134cf90d63af181eeeee2" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t0" +digest = "sha256:1a9e80dd89e0773d298e284fefb5d271a2cc991067262f33191ebce9cc835f03" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t1" +digest = "sha256:ccb4be30ef9cab931888c3fd57ef9bf48b84aa3a7a27ca89c88bcbdcabc00563" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t2" +digest = "sha256:eebb33c284c0ad2f9893d64164589f840e091b69a2c8919917321ef73ab9ce1a" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t3" +digest = "sha256:a6bb1117a1d12df74289e3a7aac3c92322e9134fc588dbddc10fbaa6ec1e3f99" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t4" +digest = "sha256:2769a21d2121fadf32d44d13f050c3184d0f2fd97f985774f88d3eefd5cbcf89" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t5" +digest = "sha256:e3ce7a9fad349d05c609d45a36366c0848bdc721eb7436bc6186ddd3c7e31563" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t6" +digest = "sha256:44615bcc0129745a60d5420d3d8ad7ad9b03fe5709557656847400bd05fc8c04" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t7" +digest = "sha256:798fbf0eff0467f2c32ed941dfbb6b6984b8a52a483af49614e3f0bb219c10ee" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t8" +digest = "sha256:28432bda3fc9deb0025eea202e655ed1a160679c8710b85f5fe7f406a720710f" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t9" +digest = "sha256:641b2796c6c9912e582382767fb6d02dc79c48ddd8a8d874ababe4d92a300a8e" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t10" +digest = "sha256:ce25905a92a1871ae3c44e2e866cfcce4905213d05ad3457e42b8f3f30571bee" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t11" +digest = "sha256:dc7d041ffd0840d78e617784da90ec9826864156bbd6d1a07111f0c2c4649544" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t12" +digest = "sha256:b951947bdb8a9454162e7f569ea7006d8c53cb3fa1a81b80c59864b868241a8a" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t13" +digest = "sha256:a8bd25db8cfda9cad3a64478c3a7b50f43f2347f2b96ce3d95750e07031f7ca9" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t14" +digest = "sha256:e2c33bd09055f25dbc1dc166c70ec3353376f1ad10e44b13bbc008b0ebd83d3f" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t15" +digest = "sha256:fb37aacad743a2b20db30e442dae55ccbc3cdcb80e3dfd27ae89ebe087bdfb3d" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t16" +digest = "sha256:5478dfdb0e29b26ef97bebddbcd002b5fc7b3391919de01a408879e44b1809f2" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t17" +digest = "sha256:d5ab3f88009ad9fec57280c5fc11046882c2768825270d11cc9c43d6390ad336" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t18" +digest = "sha256:7feff3634cf21360ecace5ca4009f5a8b26b53a8a89258b933fedb73a051a86a" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t19" +digest = "sha256:f163ba3015d1459a9dd2d076205bcbce664ef1050a8f1ba94936435513bc700f" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t20" +digest = "sha256:e17a39e3985b36582e3c65056b966db1c07112441c8c79daba6db19f8b605b65" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t21" +digest = "sha256:93506ca6ea1c780858b49a03c3e3a6c6a532dfdfa5853d4270c891a82280f4d8" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t22" +digest = "sha256:8980e806ed649d5b61cf69ff29a116ed6aba61bc27ed460376337861d59ebb97" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t23" +digest = "sha256:b6c824b3577a2652cbea775bc5209235cb0f824a2717824a61aa4131b37c0e13" + +[[tasks]] +name = "mindlab/v3_depth3_net_revenue_usd_t24" +digest = "sha256:ad3871cf723af33633a2ad115d3d76a143b0da68b18935cd250daa9836104dbd" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t0" +digest = "sha256:2a870209ac866137771170fb758e2e5a7cbbf84bf7482c9963908fbff021b0c8" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t1" +digest = "sha256:603b3a8423fcc7c2efc0655d7f0f3b01351637686baa45f5b7906f81512ac13b" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t2" +digest = "sha256:3a22e4d2e4bcd9a4b7f348405dae129cd6aee63b8fab1b40d2f2142064870297" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t3" +digest = "sha256:3d39add56bc8e4f96f569df5c53b596f4cae9abfe415305824cd4e8110de9810" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t4" +digest = "sha256:ed73ca7560ab41b57e935b89cfc4e3530e1aa206d87e33e77f78261a3da4451e" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t5" +digest = "sha256:c4ec9553e704f489716651d2e2a040a6677efd1cb73a1dbc6710a71b7f01badb" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t6" +digest = "sha256:981a8cb0d092576f988a55ab271d7a607fda8d3c07176ab9dab7ea7d3ca3e42d" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t7" +digest = "sha256:e29464f70a0db07c9bb3ff0e419c6f9ef8856ab70d3a1edf241f5f9d42307416" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t8" +digest = "sha256:7e08a049418744a3d9d71edab8902b8831d008c3be8fd42a2012611466ce4940" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t9" +digest = "sha256:ab04256dcbd013309c11a306ae8b9ca30e88de539b8810a2a5809eaad48eb2ca" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t10" +digest = "sha256:bd3f6542d9adde5e8ed5933111a635e8d2ca149bc526dc2e896d4ab13ff061ba" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t11" +digest = "sha256:c6367897c41dffdd2ae1f46b854c321de752850ab2e7c258db40c8dd0a274966" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t12" +digest = "sha256:748129ae55ea4b3c2393f1c472816fcc5547ebe53b327d956e1165c9130c3edd" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t13" +digest = "sha256:88377fc034fa3e4e1f20b3ddc55e42cfa19aedd3a72cafb06ce692d633bdc2e9" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t14" +digest = "sha256:4b1ee6c381d2dd1d4799153be25e48ab0d341f7608bb111c095cb1adb260678f" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t15" +digest = "sha256:71fcfe332e20f55125cd3a18e96f6309e89f810e15b4279b0a1888d72d0cb3e5" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t16" +digest = "sha256:4695afa7fa52ac669675b79441deca44e21f725a17c636eb01edcc3376feb6fa" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t17" +digest = "sha256:1b6f5b209256efe72bee539002d181ad04a432ca16a287f4fffe2f1d0f10700b" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t18" +digest = "sha256:6d3fcacff195409463ac5148c404b3a13b7dd8926d6caf7964d1bc765f6d16ae" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t19" +digest = "sha256:751eeba652e8de548923377623dcad295d6d3ad7ef52a9e510d43170e9b26a04" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t20" +digest = "sha256:dbd18af1951a61ebd22ce7e456ffb4b254bde441d5d8a97aa9fa0b20656db5b6" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t21" +digest = "sha256:54287c3ea44b5005a23a7684f8da9aa836651a27755caf33c16a48a9403fdb7b" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t22" +digest = "sha256:a51979492d9119555c25283a39c10a425f9b6a6e36da63c50c35579af4a375d2" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t23" +digest = "sha256:28ee094594eafec92437990ecd33174cc6365418d1ebc02b7e5784aeda691d84" + +[[tasks]] +name = "mindlab/v3_depth3_refund_share_bp_t24" +digest = "sha256:1ba169e3ea781bd59c788f99407314f57a97fb937e383c6e33d6c72cc93d0c7c" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t0" +digest = "sha256:76fd6293ed327793a94ca3140a2ff01929656a16c158a485faf50a6a7cdab93b" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t1" +digest = "sha256:296d00481dc6d3f0d7db0c6a15dfc5216cce9a004a6fd0784e2b590efa4bc38a" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t2" +digest = "sha256:9fe54804187acee53bf8abd04bda12559e2228cdf8e1b2083ac18a3600328c48" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t3" +digest = "sha256:d369e071d28b179866d978042393ccacde24c49696f4103f4a45542ec67db344" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t4" +digest = "sha256:47db52019c5b846d9a52bc671687f656f0427d7db39bfd743a4c4c1a94efcefb" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t5" +digest = "sha256:d96dab8897e9f64c667107edd8c03078895bde59064cdfcfef6454840a22fd45" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t6" +digest = "sha256:027124353fcd6545f0a0c85e0d64673936c2a182628cea0cfbaa02e6a3bd72ea" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t7" +digest = "sha256:1923bb52c45f904c2c3c2eae3546f5886c41625b6c06503cf7ae0d458a8a635c" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t8" +digest = "sha256:76c639cac54eb28ec6d06d6a6559e8c150934f7230802fe7df8e36b7d7112bbb" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t9" +digest = "sha256:7330745cf7805f284576cf3f9edd8da8f457887bbf86d2d92f04cb89c8f81319" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t10" +digest = "sha256:8bf25a6a857383b8bd9777ac657bde3d017e44507f0bff20b75a89ebb6dffc9e" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t11" +digest = "sha256:de8c5c7ceeaa6a82125827067c9858b33618fcf30603686214806a1406a09935" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t12" +digest = "sha256:9350c8a8036978a0ebbb091c1b0ace391df2e088daeb02ccd693d019e61b5e13" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t13" +digest = "sha256:d3119b621ddf907947c4fdb1b7595cd017f369517a31bcc99ccbeccc4bcdd571" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t14" +digest = "sha256:105f3382d1da3ded8b77702b7f0b9242258ba8214665e40c9385aa9065bf432a" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t15" +digest = "sha256:8a0886888e89ab259d7076eb3285b72448806ab824bd6f374f2a12507842e050" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t16" +digest = "sha256:c494f5706b9557b17406ddaf49ff197dda83d084a8fe8dc5419d8f2e5cfcdba1" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t17" +digest = "sha256:2ca0315e37ead2975da9e470cb99846720235f1499649c685b3e9bcc3e77e868" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t18" +digest = "sha256:ec3be69daedc3c77e9bd8a81e32f6a6a70800a4807eb09bf80c6d39061e84e9e" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t19" +digest = "sha256:8b92e33134fb6e51f6cccab0c1144c4e06c48495da01d34ecffd01fbbdb82f08" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t20" +digest = "sha256:6929dba500235ccdde8566b6c1e8047ad2d62651ab4bf1732c168d6b60b08ac6" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t21" +digest = "sha256:4625c2b26c2e257278b2baa787b58c790345a1ff09ec52aaa32794279ac7f412" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t22" +digest = "sha256:6f85fbc8ca809738b9b96dd2004d6e0e9a2b7fa214af9e976d7e6a5d575343fe" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t23" +digest = "sha256:9ea0bd46cd3c9cbb42cd6b81964b1b1d52cb96bc7c150e4fcd965a65fc555072" + +[[tasks]] +name = "mindlab/v3_depth4_local_net_revenue_t24" +digest = "sha256:7de828be1deeff60b287a6a820efc389d8924cdd933bd25c29ece1ef509a8db0" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t0" +digest = "sha256:44708eb2e2c5df1fdff1ee7af7b6fe920ed42a0ce19207758a42783629160e3d" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t1" +digest = "sha256:4ca8927604cfc6c2415de9248f1b32882864877517c42870761e77675e64244e" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t2" +digest = "sha256:75f73787954a97bc5ca643bde3bdfa7bf7144b75e5be0850be3b18cc3f693cab" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t3" +digest = "sha256:cdc4a71ad41bc61d64afd2534eb2afa3cf22e8c6552d57fb487fc68fe8abc456" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t4" +digest = "sha256:825c4a8813e29d20017a61bda1007f51c206c563033931521f200ca8a9d3bf71" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t5" +digest = "sha256:8c5d2fb945d54fef851c0377847cd614976a9e172a6175df9605db26b4b6b2c7" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t6" +digest = "sha256:5b42f4cef3d83bb0ad39adcdb5b759bb8404d35695296ce2ce106883f8c036a2" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t7" +digest = "sha256:e6a5aa14800f0721fdc075f280eeea0433b670b5ff4a90b56d73d7382f181e11" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t8" +digest = "sha256:a1fbe20ec257523fdee667485ad9fa66357867c0600e03ab8397efc283c3480d" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t9" +digest = "sha256:6a2575e523262c2eef5cb2d5e949b1ff02bfd578208923dbe159d34b530aa3fa" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t10" +digest = "sha256:7c95d73749a4cb101d965facceaccd4a6f46a7ea8e6e01649ab6e231a80e27db" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t11" +digest = "sha256:8e0a0aead47fea9a5fcae8a7bed45dbce00561716837f63e20f9c4920587dd74" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t12" +digest = "sha256:0fb3929b648d29bf4195390b76848b99bcf0079d4085f2d199fd046b8748b450" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t13" +digest = "sha256:464ceadff8c981c7985767c5bff00a4301cbd8d5ffb28d22e94fbbbeec347570" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t14" +digest = "sha256:f78c414abdf555cbdf3bb2710d4c18696ff3fb2d7c38464ece91fcdfef480633" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t15" +digest = "sha256:bd709792ac5cd011e9761e3cbf0aa8c114cd00192e49f5a40c18d84404b70962" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t16" +digest = "sha256:3ebae8f8de027626ec5b372931fbf56f53cd3d43dce690b380c01bade8ad0f0b" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t17" +digest = "sha256:785df75479ba9c8bc3420352d0df74137a317c70e5aedeb1a3e5bd470fd37699" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t18" +digest = "sha256:8ed3c0dcb62ca9f6a55137a9232c9a864575e646bd012eaaa68ab8de319c1d81" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t19" +digest = "sha256:182eea365188d342848203d2f8c0d40e2e1fe2d54d2094b16dc1295d45e1c4c4" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t20" +digest = "sha256:3aeb4f59a39d48a233033e3c1867cd0e35c93d379906a9ceb459540191da5289" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t21" +digest = "sha256:d3c9ba9da426c0abd521d102e390cafcb5aed9ad2848bf521f8f0c15d2412825" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t22" +digest = "sha256:ab435329b9e218bf688430fd8b7b0fbfd5c47d10944249a3011bda286df8a678" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t23" +digest = "sha256:1e39ea9163051481f9ae6068ca3cc6b86acfd91e1e6d7b371ed8620490bc988b" + +[[tasks]] +name = "mindlab/v3_depth4_margin_after_refunds_t24" +digest = "sha256:5476b225935eccdfdb36d8ba237cd1f88db18dff04805b202128f6c24eb55bb6" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t0" +digest = "sha256:e11475497abf90d4d1175e0c02d9367bc6bc2c3597a928b2c83de942a7729b14" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t1" +digest = "sha256:edbe4638755b1ccc3fe2039e42170acd22f69cff9b0bced6a66a35d722836974" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t2" +digest = "sha256:e4e6d40d7d715b31538a633bdf7bfa6cb198565396c6c03e987d8aedfdf5139e" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t3" +digest = "sha256:46072e516fd6b67e8ea14a067cc7add132fa9fe20de1c4aff36fc9e01baf7947" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t4" +digest = "sha256:eaf1ab58c5db5889ea7dc75edd689512a8d2c5eeb2b03b5be93d1b02b87da986" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t5" +digest = "sha256:600fbdbfce807816fe1801e3c8d2cdfccd5ffb326ffb5cf25ea31c0b7616bbe3" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t6" +digest = "sha256:5ece81a88b6739011da630c44b88c988fcad146dfc5a13736e7655947e288db2" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t7" +digest = "sha256:1772a1018d57346263c751366e541224e4a61e6c4ad2a46f0d8c459fd8119c8a" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t8" +digest = "sha256:238f2aa7f5bdea91c255d16d0394b0dd72b734e6580621af3458065b917e149f" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t9" +digest = "sha256:ee3cfbb3be0578abe35e602521ac64826e69eee55ebc0a8200716ba08360af16" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t10" +digest = "sha256:87dc4e684b7c0a8f8195d2a440b22ea0a5e26572bc8c39e88c3402b6ccc62af5" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t11" +digest = "sha256:19b0b382332bed549c2f0e517d0826c455a12a579afa92a784551e2370dd2ab6" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t12" +digest = "sha256:b8ffd922056699c662dbaff72e1ade5451bae6e476c1b6b5d9fbf503fc0612bc" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t13" +digest = "sha256:f8083e8f4af0811ec4f611b3651389d3631a3bcd489b2d07828937a877d206ec" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t14" +digest = "sha256:6f9a1ea629944b8abf9875f070496e56722e640082b7bbbf6d71f7099dca670a" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t15" +digest = "sha256:dead07914d5d5b6460a01d31df15bb496c1aecba98ee85aca9ac17611479ba5d" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t16" +digest = "sha256:5d60037187ad78297583452ce1235ea58f47aee8df45fc0b4b2fb63aabcbc3f2" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t17" +digest = "sha256:31a7698ff82df0c50b4d7d726466199e8d37bc8eb8728845bf537f47839ef229" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t18" +digest = "sha256:9907364e6b2b8c2309ef06a9e8be72b4a9aeb753c050683fc2f114869ea0231b" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t19" +digest = "sha256:0d9ea638dcf7a75d733f6221cde2d4b238f3d83a3540c2cdcd0db84dc9cd4dff" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t20" +digest = "sha256:04a1818c7b852c02de628f7b65f1877d51d33ac7795187def322a20c040edcdf" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t21" +digest = "sha256:7b779f25d35d3cd01eb62ad0da6246862c91377b968bdbb9c016670bd3c4e3b0" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t22" +digest = "sha256:70d65cfe27500f8c5354dbb4f1ea9ee007dc7b1514d1627dc83103e3b29255d9" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t23" +digest = "sha256:d97c1e4e113d4b4dfa07fdd3ed715f4674f97d65d246058676f152743d4463c5" + +[[tasks]] +name = "mindlab/v3_depth5_reorder_shortfall_t24" +digest = "sha256:e6ee3a5a9ebeb0de2433d37d9396229acf0e752697cb906620a138a3e30de1c3" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t0" +digest = "sha256:64c31e152821b3d4083a9344c59d417abe545d5f73075be8d8ec6b67261b89a8" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t1" +digest = "sha256:0c9410d86d556ceefde4146c9ff74a313eaf1888eed5088c73b3d9a0b410e690" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t2" +digest = "sha256:d81d82f2a8667076cfb4b9d651723a0dbb8ffb3a232a083a1221af335f49dc15" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t3" +digest = "sha256:8db9bc1bc4ae2dec0afc9424ed03b4473b8c64931512c6058b3eb714170fb101" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t4" +digest = "sha256:97b337d7fc2980cfe39683f1af6fa0fb215614fbbe06f7f1c46dfa979e5a9b64" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t5" +digest = "sha256:efb3e7f5a441e395bf03b1c4a636173b5f23d13c891f2d4403c62eccb0093ad0" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t6" +digest = "sha256:56f862b79ba8eab6f7dc4e8c39ced1838aaea17605f43588cb8c370949f738d9" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t7" +digest = "sha256:79abb144530d550e474efc0f9d58ac97641a0826f8af16db5dd9ff4a2c5a4121" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t8" +digest = "sha256:62016493680dd3788ab0f7fa528f84785fd2dc7f5b2574e644019c502942fead" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t9" +digest = "sha256:bf1799a0f83c5c9b94f7306534c07e7393db6bff8294b5edeb6851e46bee7225" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t10" +digest = "sha256:2c82fb117cce91049f52059b56d12d4b7719d2ebaae4c8c15b21308f72f0e13c" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t11" +digest = "sha256:b95c957fb02af4dc57cec3f0d8536c04ec32e43bec8087c1495056d4de378f6f" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t12" +digest = "sha256:f613875090b28abba724fe362587e6d82203d2d4663b805d0ee27c4442ccc332" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t13" +digest = "sha256:08fad45cf1f144f945ac4923a55a6f593e6d2fede8e6bb2d0da795c93b56815f" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t14" +digest = "sha256:e0c697639c49b4eaf019d97e9572389339067808c7059db6905d3d1e95ed4252" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t15" +digest = "sha256:18ed9fc8e839254a2d83d1c97275a4622af4b4acf6ce11884776a1ce58969cc5" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t16" +digest = "sha256:ae0f11c221f8cf9d3024af81b047ae70570011bc4d7c4bb084087e9dccbd85f7" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t17" +digest = "sha256:f22f49c1799179b7079708279f59ebd2d80e18144de7de4a119be20d6b1f3258" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t18" +digest = "sha256:6084cf342a7811e591f873a23219d5c1ad5128f6fe0ab5ec5ef9782b9c52c90f" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t19" +digest = "sha256:8c075e9048b604dc3e244d37dc2884d315bef86e983e5bc07937cbf242af5a78" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t20" +digest = "sha256:5f4f29b1fbb9058a9df296379b40d840041e709f750f8a34c7bcbeaa8468c652" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t21" +digest = "sha256:8a845789f37818dd4029488654b7ec58f0056b372aad2a2ef50658e07974edc4" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t22" +digest = "sha256:d05ad4e4e6d6f6b1927f85bc0803aa31a27934324e0e70d7b000c33c67b4e724" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t23" +digest = "sha256:4d74b04cfd56ae38f053de155a886fed5c4045d73165895ab080f65a653882ac" + +[[tasks]] +name = "mindlab/v3_depth5_delayed_net_revenue_t24" +digest = "sha256:198d9d37a7ffebe3b7eaf8bb58622da09c52975e5510bf609f89457b7d569a34" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t0" +digest = "sha256:94a52bbac3f8a1c083074384049ba05a135258102928f97f48cf636443f9b7ec" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t1" +digest = "sha256:29245f11c260f75bf9cd406b036be8691755d870fa0ade85e4f70c5cc2720817" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t2" +digest = "sha256:71d2ec8ede5a3ac1cea954c642a7fc7a0d73d6188857d9784ddcc171753a8cfb" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t3" +digest = "sha256:69a3e1081a390831a1df375144ce1aef5cd34d25be3108d2963399577d6e03c8" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t4" +digest = "sha256:03d9ecf29de38c12351abe776e8167d02a7432525ef2ed1c4894e8153d91588c" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t5" +digest = "sha256:9a86f3be0e28f049a961c23498351e6916231bdc4d10ba257e646b3db71c11a9" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t6" +digest = "sha256:3c0705d910df0864f9170176793f6993eebf01fac86d8193e27b9f8608a45829" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t7" +digest = "sha256:ebfe5c21b86fff7416528ff12d4f96e668685718818e428f1b423a9aa399f80a" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t8" +digest = "sha256:3c1f0d84d8512f6fdd1fa86bb4e2ffdb3b87fc86a50b6dffb5d5de08c5b0fe32" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t9" +digest = "sha256:b7c1aab57775dcd1a1313be900328d38d266f85796f0a1dbd93e09b41da2138b" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t10" +digest = "sha256:966202f13d1e150134fd1d06a8a91b84decbe7aaf588ade7e8225f80a649eaf9" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t11" +digest = "sha256:f5d5744b44eeebdada66fd794ca1865c188c26d8ec817531212c046ccfa64c2d" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t12" +digest = "sha256:8d1752257ec595db20914b4acd92c8bfe80cd70bb2926a6f0f63dd97c95f272e" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t13" +digest = "sha256:4b8268605eead6c0af22379ad1dbed5d388b956f42a7c56c9c8e4ddeeac402a6" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t14" +digest = "sha256:7aa0efeff11f8ae2756cf4e89fea5e3e7b9394e2b0d2809a5a66ef130ba4b38c" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t15" +digest = "sha256:de3be3c73ce91840c052b3f9527bafcfaf606f84146f6879b8cc382fd5a13221" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t16" +digest = "sha256:e453576b4397a2a215976a4afe35bb002b99812b02b6c7d4c47d016775a3b161" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t17" +digest = "sha256:b78f0f718d0096b651580853070868c019f28b80c213881d5738d440e5762f77" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t18" +digest = "sha256:0985e2399f9e30180f9601551b4918505a101f06a0c342b14e8a7c07785f1ee2" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t19" +digest = "sha256:e3cf50465e72695850b00edc0ae005944cd5704e8decfc773f99e3b5748be3ba" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t20" +digest = "sha256:b485ab05ebb0cfd6be399afec09c7826672cbdf8ccfd041022bd7865b7d73c43" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t21" +digest = "sha256:28e0366181ed69eaafe39e892ba621fb7349c01c1aded07da28b00e5b85f056e" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t22" +digest = "sha256:e2d783a69296ec9c580b6f87977c113a24e82eb4e4d9e72d768f79bf561aeeaf" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t23" +digest = "sha256:657c9bc5bb9a6a148efa3c8d502566b75a34b96bdcda6253ae7a2f2383c247a2" + +[[tasks]] +name = "mindlab/v3_depth6_delay_sla_burden_t24" +digest = "sha256:26418c875811c561cb2feac82ef0e43182b03f879e001b1e165ff5a2c94eccc7" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t0" +digest = "sha256:aba2707d1a4627184884eb6d4ea11b488ac3d70b716d0c2a66e0e5487507894c" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t1" +digest = "sha256:5009ec4735bf53ec987a6e05dfb9c8626ed74c6f6a7e1212c5aa762d7f49c17d" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t2" +digest = "sha256:6669cebce0c6854a4c03523039b58beb4bce1b9d33e73be3e630149baf297680" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t3" +digest = "sha256:7aef50d575aba2d36d3219aa6784423bc9f1945f9a922760d2b556f71f8f55ae" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t4" +digest = "sha256:47ccde1106ea02bad3c4456bd05a829cb5bebdc5beda32227542f679264cb1c0" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t5" +digest = "sha256:eb1c5d5ca182b10ec5e0fd134cc51af72af55973265ea29a33fcb2c0fff3df14" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t6" +digest = "sha256:a6d9cdb203abaa3535fb01c6fe1d829bfc9a85f3b267d8d1e57073cfcbfb1103" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t7" +digest = "sha256:df70291b5157a8e17912d783f918b9a5746a56d08aa1ef832f0ad076faf861ac" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t8" +digest = "sha256:2768456c8f4db1ffb62850ddf95d79856c7e87349640a4bbf8ea0470c0fb8452" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t9" +digest = "sha256:b3a82cc7680a8acdf9d207d7deddc5d55c0784b0e6fb4e1163ad09ea85030491" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t10" +digest = "sha256:6b3e0590fa5ac55d4e3fd7141ef46aed960d9e3a93b406c55de4ca0645ae6601" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t11" +digest = "sha256:bdf7d009e86922c2c36f8402e4d3cae78bbb222c85ad91f7642354709068278e" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t12" +digest = "sha256:9104b5e1198b4de2d0f4246bf65281c06ee46ef6fedde802aba1c339e85b8b36" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t13" +digest = "sha256:27184d51389560daa07eeb805a6b1fd9a7bbee6bc693cdd99215287be618936f" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t14" +digest = "sha256:7c8f49c40e184504c4fc8f0fe8c8dcf42db2da19f0555df5545b31e8ed4a4544" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t15" +digest = "sha256:a75af663750a43a3dec597cdccea3fcc945c7d556a8605972eacdcee82a8b113" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t16" +digest = "sha256:3c7b74a209a19c4927581aaff3f6faa3936c76e98b0589daf3454810126884e8" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t17" +digest = "sha256:15e738818e5e58199fc473acd7ec61dcb2c92fc189a155f88f7bc0f1dd19d058" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t18" +digest = "sha256:8129e080cda9d68f5e0a4c3e409068ee602c730f59f2ebb912b55271c8186fb0" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t19" +digest = "sha256:ba76847a4eef05b2a9337537e88776257576045ffbaee9cd3f4862c62aff6ff8" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t20" +digest = "sha256:ad3f90173f4909cd7fad134b962a0ebb578e8f35c9c5b87ef465284fbc0dca87" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t21" +digest = "sha256:1f2720bb3fd0b4665a05bfdb5b38a8e71436467bbd3d63906862047c56e80b6b" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t22" +digest = "sha256:71843c11b51f67ab95ddd99e329a289d662f4aa5b9f4791905a68a89efb520dd" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t23" +digest = "sha256:e9683f8c16852b326697fe022abf14de52767bb8dfe68e749c0f11317094e7f5" + +[[tasks]] +name = "mindlab/v3_depth6_breached_ticket_revenue_t24" +digest = "sha256:8fc6404693e4a394f260a19acb65348570d7641c73646d5399cf433dc6ae6002" diff --git a/harbor/manifest.json b/harbor/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..69e6633d6eaeac278b1f2d50f60cd7dd43af02b2 --- /dev/null +++ b/harbor/manifest.json @@ -0,0 +1,330 @@ +{ + "benchmark": "FlowBench-v3", + "split": "public-task-only", + "task_count": 300, + "depths": { + "1": 50, + "2": 50, + "3": 50, + "4": 50, + "5": 50, + "6": 50 + }, + "families": [ + "breached_ticket_revenue", + "currency_lookup", + "delay_sla_burden", + "delayed_net_revenue", + "local_net_revenue", + "margin_after_refunds", + "net_revenue_usd", + "order_count", + "refund_share_bp", + "reorder_shortfall", + "top_product_lookup", + "unique_customer_count" + ], + "answer_visibility": "No gold labels, oracle solutions, or strict expected files are included.", + "task_ids": [ + "v3_depth1_currency_lookup_t0", + "v3_depth1_currency_lookup_t1", + "v3_depth1_currency_lookup_t2", + "v3_depth1_currency_lookup_t3", + "v3_depth1_currency_lookup_t4", + "v3_depth1_currency_lookup_t5", + "v3_depth1_currency_lookup_t6", + "v3_depth1_currency_lookup_t7", + "v3_depth1_currency_lookup_t8", + "v3_depth1_currency_lookup_t9", + "v3_depth1_currency_lookup_t10", + "v3_depth1_currency_lookup_t11", + "v3_depth1_currency_lookup_t12", + "v3_depth1_currency_lookup_t13", + "v3_depth1_currency_lookup_t14", + "v3_depth1_currency_lookup_t15", + "v3_depth1_currency_lookup_t16", + "v3_depth1_currency_lookup_t17", + "v3_depth1_currency_lookup_t18", + "v3_depth1_currency_lookup_t19", + "v3_depth1_currency_lookup_t20", + "v3_depth1_currency_lookup_t21", + "v3_depth1_currency_lookup_t22", + "v3_depth1_currency_lookup_t23", + "v3_depth1_currency_lookup_t24", + "v3_depth1_top_product_lookup_t0", + "v3_depth1_top_product_lookup_t1", + "v3_depth1_top_product_lookup_t2", + "v3_depth1_top_product_lookup_t3", + "v3_depth1_top_product_lookup_t4", + "v3_depth1_top_product_lookup_t5", + "v3_depth1_top_product_lookup_t6", + "v3_depth1_top_product_lookup_t7", + "v3_depth1_top_product_lookup_t8", + "v3_depth1_top_product_lookup_t9", + "v3_depth1_top_product_lookup_t10", + "v3_depth1_top_product_lookup_t11", + "v3_depth1_top_product_lookup_t12", + "v3_depth1_top_product_lookup_t13", + "v3_depth1_top_product_lookup_t14", + "v3_depth1_top_product_lookup_t15", + "v3_depth1_top_product_lookup_t16", + "v3_depth1_top_product_lookup_t17", + "v3_depth1_top_product_lookup_t18", + "v3_depth1_top_product_lookup_t19", + "v3_depth1_top_product_lookup_t20", + "v3_depth1_top_product_lookup_t21", + "v3_depth1_top_product_lookup_t22", + "v3_depth1_top_product_lookup_t23", + "v3_depth1_top_product_lookup_t24", + "v3_depth2_order_count_t0", + "v3_depth2_order_count_t1", + "v3_depth2_order_count_t2", + "v3_depth2_order_count_t3", + "v3_depth2_order_count_t4", + "v3_depth2_order_count_t5", + "v3_depth2_order_count_t6", + "v3_depth2_order_count_t7", + "v3_depth2_order_count_t8", + "v3_depth2_order_count_t9", + "v3_depth2_order_count_t10", + "v3_depth2_order_count_t11", + "v3_depth2_order_count_t12", + "v3_depth2_order_count_t13", + "v3_depth2_order_count_t14", + "v3_depth2_order_count_t15", + "v3_depth2_order_count_t16", + "v3_depth2_order_count_t17", + "v3_depth2_order_count_t18", + "v3_depth2_order_count_t19", + "v3_depth2_order_count_t20", + "v3_depth2_order_count_t21", + "v3_depth2_order_count_t22", + "v3_depth2_order_count_t23", + "v3_depth2_order_count_t24", + "v3_depth2_unique_customer_count_t0", + "v3_depth2_unique_customer_count_t1", + "v3_depth2_unique_customer_count_t2", + "v3_depth2_unique_customer_count_t3", + "v3_depth2_unique_customer_count_t4", + "v3_depth2_unique_customer_count_t5", + "v3_depth2_unique_customer_count_t6", + "v3_depth2_unique_customer_count_t7", + "v3_depth2_unique_customer_count_t8", + "v3_depth2_unique_customer_count_t9", + "v3_depth2_unique_customer_count_t10", + "v3_depth2_unique_customer_count_t11", + "v3_depth2_unique_customer_count_t12", + "v3_depth2_unique_customer_count_t13", + "v3_depth2_unique_customer_count_t14", + "v3_depth2_unique_customer_count_t15", + "v3_depth2_unique_customer_count_t16", + "v3_depth2_unique_customer_count_t17", + "v3_depth2_unique_customer_count_t18", + "v3_depth2_unique_customer_count_t19", + "v3_depth2_unique_customer_count_t20", + "v3_depth2_unique_customer_count_t21", + "v3_depth2_unique_customer_count_t22", + "v3_depth2_unique_customer_count_t23", + "v3_depth2_unique_customer_count_t24", + "v3_depth3_net_revenue_usd_t0", + "v3_depth3_net_revenue_usd_t1", + "v3_depth3_net_revenue_usd_t2", + "v3_depth3_net_revenue_usd_t3", + "v3_depth3_net_revenue_usd_t4", + "v3_depth3_net_revenue_usd_t5", + "v3_depth3_net_revenue_usd_t6", + "v3_depth3_net_revenue_usd_t7", + "v3_depth3_net_revenue_usd_t8", + "v3_depth3_net_revenue_usd_t9", + "v3_depth3_net_revenue_usd_t10", + "v3_depth3_net_revenue_usd_t11", + "v3_depth3_net_revenue_usd_t12", + "v3_depth3_net_revenue_usd_t13", + "v3_depth3_net_revenue_usd_t14", + "v3_depth3_net_revenue_usd_t15", + "v3_depth3_net_revenue_usd_t16", + "v3_depth3_net_revenue_usd_t17", + "v3_depth3_net_revenue_usd_t18", + "v3_depth3_net_revenue_usd_t19", + "v3_depth3_net_revenue_usd_t20", + "v3_depth3_net_revenue_usd_t21", + "v3_depth3_net_revenue_usd_t22", + "v3_depth3_net_revenue_usd_t23", + "v3_depth3_net_revenue_usd_t24", + "v3_depth3_refund_share_bp_t0", + "v3_depth3_refund_share_bp_t1", + "v3_depth3_refund_share_bp_t2", + "v3_depth3_refund_share_bp_t3", + "v3_depth3_refund_share_bp_t4", + "v3_depth3_refund_share_bp_t5", + "v3_depth3_refund_share_bp_t6", + "v3_depth3_refund_share_bp_t7", + "v3_depth3_refund_share_bp_t8", + "v3_depth3_refund_share_bp_t9", + "v3_depth3_refund_share_bp_t10", + "v3_depth3_refund_share_bp_t11", + "v3_depth3_refund_share_bp_t12", + "v3_depth3_refund_share_bp_t13", + "v3_depth3_refund_share_bp_t14", + "v3_depth3_refund_share_bp_t15", + "v3_depth3_refund_share_bp_t16", + "v3_depth3_refund_share_bp_t17", + "v3_depth3_refund_share_bp_t18", + "v3_depth3_refund_share_bp_t19", + "v3_depth3_refund_share_bp_t20", + "v3_depth3_refund_share_bp_t21", + "v3_depth3_refund_share_bp_t22", + "v3_depth3_refund_share_bp_t23", + "v3_depth3_refund_share_bp_t24", + "v3_depth4_local_net_revenue_t0", + "v3_depth4_local_net_revenue_t1", + "v3_depth4_local_net_revenue_t2", + "v3_depth4_local_net_revenue_t3", + "v3_depth4_local_net_revenue_t4", + "v3_depth4_local_net_revenue_t5", + "v3_depth4_local_net_revenue_t6", + "v3_depth4_local_net_revenue_t7", + "v3_depth4_local_net_revenue_t8", + "v3_depth4_local_net_revenue_t9", + "v3_depth4_local_net_revenue_t10", + "v3_depth4_local_net_revenue_t11", + "v3_depth4_local_net_revenue_t12", + "v3_depth4_local_net_revenue_t13", + "v3_depth4_local_net_revenue_t14", + "v3_depth4_local_net_revenue_t15", + "v3_depth4_local_net_revenue_t16", + "v3_depth4_local_net_revenue_t17", + "v3_depth4_local_net_revenue_t18", + "v3_depth4_local_net_revenue_t19", + "v3_depth4_local_net_revenue_t20", + "v3_depth4_local_net_revenue_t21", + "v3_depth4_local_net_revenue_t22", + "v3_depth4_local_net_revenue_t23", + "v3_depth4_local_net_revenue_t24", + "v3_depth4_margin_after_refunds_t0", + "v3_depth4_margin_after_refunds_t1", + "v3_depth4_margin_after_refunds_t2", + "v3_depth4_margin_after_refunds_t3", + "v3_depth4_margin_after_refunds_t4", + "v3_depth4_margin_after_refunds_t5", + "v3_depth4_margin_after_refunds_t6", + "v3_depth4_margin_after_refunds_t7", + "v3_depth4_margin_after_refunds_t8", + "v3_depth4_margin_after_refunds_t9", + "v3_depth4_margin_after_refunds_t10", + "v3_depth4_margin_after_refunds_t11", + "v3_depth4_margin_after_refunds_t12", + "v3_depth4_margin_after_refunds_t13", + "v3_depth4_margin_after_refunds_t14", + "v3_depth4_margin_after_refunds_t15", + "v3_depth4_margin_after_refunds_t16", + "v3_depth4_margin_after_refunds_t17", + "v3_depth4_margin_after_refunds_t18", + "v3_depth4_margin_after_refunds_t19", + "v3_depth4_margin_after_refunds_t20", + "v3_depth4_margin_after_refunds_t21", + "v3_depth4_margin_after_refunds_t22", + "v3_depth4_margin_after_refunds_t23", + "v3_depth4_margin_after_refunds_t24", + "v3_depth5_reorder_shortfall_t0", + "v3_depth5_reorder_shortfall_t1", + "v3_depth5_reorder_shortfall_t2", + "v3_depth5_reorder_shortfall_t3", + "v3_depth5_reorder_shortfall_t4", + "v3_depth5_reorder_shortfall_t5", + "v3_depth5_reorder_shortfall_t6", + "v3_depth5_reorder_shortfall_t7", + "v3_depth5_reorder_shortfall_t8", + "v3_depth5_reorder_shortfall_t9", + "v3_depth5_reorder_shortfall_t10", + "v3_depth5_reorder_shortfall_t11", + "v3_depth5_reorder_shortfall_t12", + "v3_depth5_reorder_shortfall_t13", + "v3_depth5_reorder_shortfall_t14", + "v3_depth5_reorder_shortfall_t15", + "v3_depth5_reorder_shortfall_t16", + "v3_depth5_reorder_shortfall_t17", + "v3_depth5_reorder_shortfall_t18", + "v3_depth5_reorder_shortfall_t19", + "v3_depth5_reorder_shortfall_t20", + "v3_depth5_reorder_shortfall_t21", + "v3_depth5_reorder_shortfall_t22", + "v3_depth5_reorder_shortfall_t23", + "v3_depth5_reorder_shortfall_t24", + "v3_depth5_delayed_net_revenue_t0", + "v3_depth5_delayed_net_revenue_t1", + "v3_depth5_delayed_net_revenue_t2", + "v3_depth5_delayed_net_revenue_t3", + "v3_depth5_delayed_net_revenue_t4", + "v3_depth5_delayed_net_revenue_t5", + "v3_depth5_delayed_net_revenue_t6", + "v3_depth5_delayed_net_revenue_t7", + "v3_depth5_delayed_net_revenue_t8", + "v3_depth5_delayed_net_revenue_t9", + "v3_depth5_delayed_net_revenue_t10", + "v3_depth5_delayed_net_revenue_t11", + "v3_depth5_delayed_net_revenue_t12", + "v3_depth5_delayed_net_revenue_t13", + "v3_depth5_delayed_net_revenue_t14", + "v3_depth5_delayed_net_revenue_t15", + "v3_depth5_delayed_net_revenue_t16", + "v3_depth5_delayed_net_revenue_t17", + "v3_depth5_delayed_net_revenue_t18", + "v3_depth5_delayed_net_revenue_t19", + "v3_depth5_delayed_net_revenue_t20", + "v3_depth5_delayed_net_revenue_t21", + "v3_depth5_delayed_net_revenue_t22", + "v3_depth5_delayed_net_revenue_t23", + "v3_depth5_delayed_net_revenue_t24", + "v3_depth6_delay_sla_burden_t0", + "v3_depth6_delay_sla_burden_t1", + "v3_depth6_delay_sla_burden_t2", + "v3_depth6_delay_sla_burden_t3", + "v3_depth6_delay_sla_burden_t4", + "v3_depth6_delay_sla_burden_t5", + "v3_depth6_delay_sla_burden_t6", + "v3_depth6_delay_sla_burden_t7", + "v3_depth6_delay_sla_burden_t8", + "v3_depth6_delay_sla_burden_t9", + "v3_depth6_delay_sla_burden_t10", + "v3_depth6_delay_sla_burden_t11", + "v3_depth6_delay_sla_burden_t12", + "v3_depth6_delay_sla_burden_t13", + "v3_depth6_delay_sla_burden_t14", + "v3_depth6_delay_sla_burden_t15", + "v3_depth6_delay_sla_burden_t16", + "v3_depth6_delay_sla_burden_t17", + "v3_depth6_delay_sla_burden_t18", + "v3_depth6_delay_sla_burden_t19", + "v3_depth6_delay_sla_burden_t20", + "v3_depth6_delay_sla_burden_t21", + "v3_depth6_delay_sla_burden_t22", + "v3_depth6_delay_sla_burden_t23", + "v3_depth6_delay_sla_burden_t24", + "v3_depth6_breached_ticket_revenue_t0", + "v3_depth6_breached_ticket_revenue_t1", + "v3_depth6_breached_ticket_revenue_t2", + "v3_depth6_breached_ticket_revenue_t3", + "v3_depth6_breached_ticket_revenue_t4", + "v3_depth6_breached_ticket_revenue_t5", + "v3_depth6_breached_ticket_revenue_t6", + "v3_depth6_breached_ticket_revenue_t7", + "v3_depth6_breached_ticket_revenue_t8", + "v3_depth6_breached_ticket_revenue_t9", + "v3_depth6_breached_ticket_revenue_t10", + "v3_depth6_breached_ticket_revenue_t11", + "v3_depth6_breached_ticket_revenue_t12", + "v3_depth6_breached_ticket_revenue_t13", + "v3_depth6_breached_ticket_revenue_t14", + "v3_depth6_breached_ticket_revenue_t15", + "v3_depth6_breached_ticket_revenue_t16", + "v3_depth6_breached_ticket_revenue_t17", + "v3_depth6_breached_ticket_revenue_t18", + "v3_depth6_breached_ticket_revenue_t19", + "v3_depth6_breached_ticket_revenue_t20", + "v3_depth6_breached_ticket_revenue_t21", + "v3_depth6_breached_ticket_revenue_t22", + "v3_depth6_breached_ticket_revenue_t23", + "v3_depth6_breached_ticket_revenue_t24" + ] +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t0/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t0/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t0/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t0/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t0/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t0/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t0/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..f8325a91eaeef1ce2b263d76be3750cd8fa0270f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t0/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t0", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "NA", + "category": "A", + "month_start": 202601, + "month_end": 202603 + }, + "question": "What ISO currency code is used for the NA region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t0/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t0/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7862f017d818ad5e8158e891f88bc71a9834b22f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t0/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the NA region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t0/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t0/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a345ab642ed28f4c9c0909fa8feb539d2caee434 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t0/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t0" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t0/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t0/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t0/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t0/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t0/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t1/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t1/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t1/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t1/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t1/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t1/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t1/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..bfd4b67d51c934307b96e83dab651775a3daa096 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t1/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t1", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "NA", + "category": "B", + "month_start": 202604, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the NA region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t1/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t1/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7862f017d818ad5e8158e891f88bc71a9834b22f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t1/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the NA region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t1/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t1/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5e52b36241354d207da11eb7d52477fd5355cc8c --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t1/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t1" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t1/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t1/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t1/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t1/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t1/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t10/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t10/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t10/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t10/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t10/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t10/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t10/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t10/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..9e140e48cb9490d901fe0bfc8b1af61549dc280f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t10/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t10", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "APAC", + "category": "B", + "month_start": 202604, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the APAC region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t10/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41ab7a3119b3c44f20e4c1863904c3244c33e783 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t10/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the APAC region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t10/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4ded092f4c12c69aa3677a32390a1784812744c1 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t10/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t10" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t10/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t10/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t10/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t10/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t10/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t11/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t11/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t11/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t11/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t11/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t11/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t11/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t11/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..8fc7ccab0d2d165b17efcdcd0a1f668e4703b152 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t11/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t11", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "LATAM", + "category": "A", + "month_start": 202601, + "month_end": 202603 + }, + "question": "What ISO currency code is used for the LATAM region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t11/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ace9aa4036061f65d31bdc16fa303ee2a2ff18cf --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t11/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the LATAM region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t11/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1a5f93a86cda69e61352f8cf5dadaaeba7d89941 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t11/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t11" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t11/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t11/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t11/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t11/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t11/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t12/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t12/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t12/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t12/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t12/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t12/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t12/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t12/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..56421de8e22eae9ca72b7e61b7dc6e5ea7529d1e --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t12/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t12", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "NA", + "category": "C", + "month_start": 202601, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the NA region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t12/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7862f017d818ad5e8158e891f88bc71a9834b22f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t12/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the NA region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t12/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3a149eec9d0357cb7763161043a4bcb5b22f6388 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t12/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t12" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t12/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t12/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t12/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t12/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t12/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t13/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t13/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t13/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t13/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t13/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t13/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t13/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t13/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..8b133597d0c2b49ff48c77c7d979d3449a8690d1 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t13/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t13", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "EU", + "category": "B", + "month_start": 202601, + "month_end": 202603 + }, + "question": "What ISO currency code is used for the EU region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t13/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t13/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b382f1ac888d3909a557f2ea860e8215c7c08526 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t13/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the EU region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t13/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t13/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b760b78cc9baf5586c33f8eb5afe87752654c229 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t13/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t13" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t13/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t13/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t13/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t13/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t13/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t13/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t14/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t14/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t14/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t14/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t14/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t14/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t14/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t14/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..9e8933964871255eea7bdbf60dca4880a1aea4a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t14/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t14", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "APAC", + "category": "C", + "month_start": 202602, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the APAC region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t14/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t14/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41ab7a3119b3c44f20e4c1863904c3244c33e783 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t14/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the APAC region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t14/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t14/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..14bba43b7222489018c8f28fb73f7324af341351 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t14/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t14" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t14/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t14/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t14/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t14/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t14/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t14/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t15/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t15/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t15/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t15/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t15/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t15/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t15/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t15/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..555b8b7fff2635aff6a8b7e5ab7d5e2dfd14e09c --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t15/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t15", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "LATAM", + "category": "D", + "month_start": 202601, + "month_end": 202605 + }, + "question": "What ISO currency code is used for the LATAM region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t15/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t15/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ace9aa4036061f65d31bdc16fa303ee2a2ff18cf --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t15/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the LATAM region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t15/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t15/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..136469e8d37cac0f08682eb33204eca58b7810da --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t15/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t15" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t15/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t15/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t15/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t15/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t15/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t15/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t16/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t16/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t16/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t16/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t16/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t16/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t16/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t16/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..f4c83fb4ed54d745818bd2ca0af221136789e19e --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t16/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t16", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "NA", + "category": "A", + "month_start": 202604, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the NA region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t16/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t16/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7862f017d818ad5e8158e891f88bc71a9834b22f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t16/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the NA region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t16/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t16/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..dbb514dcf3e89dc77566dc64afeb3d513d938d52 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t16/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t16" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t16/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t16/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t16/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t16/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t16/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t16/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t17/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t17/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t17/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t17/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t17/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t17/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t17/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t17/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..6b128ac50e07815c3423e45ed41892554477be96 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t17/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t17", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "EU", + "category": "D", + "month_start": 202601, + "month_end": 202602 + }, + "question": "What ISO currency code is used for the EU region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t17/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t17/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b382f1ac888d3909a557f2ea860e8215c7c08526 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t17/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the EU region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t17/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t17/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7354fc922c6e386720317a67ccdf6273a315b454 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t17/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t17" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t17/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t17/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t17/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t17/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t17/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t17/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t18/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t18/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t18/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t18/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t18/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t18/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t18/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t18/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..98f08c354279ff9fd18f17e4672943b6f6db8b43 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t18/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t18", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "APAC", + "category": "A", + "month_start": 202603, + "month_end": 202604 + }, + "question": "What ISO currency code is used for the APAC region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t18/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t18/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41ab7a3119b3c44f20e4c1863904c3244c33e783 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t18/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the APAC region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t18/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t18/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..20bbc2227a3ff88793684bc52a01fa3b30dc1571 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t18/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t18" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t18/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t18/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t18/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t18/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t18/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t18/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t19/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t19/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t19/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t19/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t19/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t19/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t19/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t19/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..cd042f79907216cf27f557f66efd8011d1018078 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t19/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t19", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "LATAM", + "category": "B", + "month_start": 202605, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the LATAM region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t19/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t19/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ace9aa4036061f65d31bdc16fa303ee2a2ff18cf --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t19/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the LATAM region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t19/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t19/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..25910e54795aca3793b01737f74e0e258dc069f1 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t19/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t19" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t19/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t19/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t19/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t19/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t19/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t19/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t2/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t2/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t2/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t2/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t2/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t2/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t2/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t2/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..d858861b69ebd7a4270a55ca75325c3cb9f0b361 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t2/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t2", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "EU", + "category": "C", + "month_start": 202601, + "month_end": 202604 + }, + "question": "What ISO currency code is used for the EU region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t2/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t2/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b382f1ac888d3909a557f2ea860e8215c7c08526 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t2/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the EU region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t2/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t2/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..871f0583cd6276ca283c04e3b56a8143e67285cc --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t2/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t2" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t2/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t2/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t2/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t2/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t2/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t2/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t20/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t20/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t20/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t20/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t20/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t20/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t20/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t20/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..86985bc6828b3d9a3727aa662f8ae395dddc4275 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t20/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t20", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "NA", + "category": "C", + "month_start": 202602, + "month_end": 202604 + }, + "question": "What ISO currency code is used for the NA region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t20/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t20/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7862f017d818ad5e8158e891f88bc71a9834b22f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t20/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the NA region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t20/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t20/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ebc3586b98367d45b9f356c259b1bc4b677c7092 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t20/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t20" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t20/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t20/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t20/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t20/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t20/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t20/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t21/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t21/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t21/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t21/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t21/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t21/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t21/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t21/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..395db5f7c7feae7c5d6a6c15f86dd045d22daf21 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t21/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t21", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "EU", + "category": "B", + "month_start": 202604, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the EU region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t21/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t21/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b382f1ac888d3909a557f2ea860e8215c7c08526 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t21/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the EU region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t21/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t21/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..33ccc8faf87f74d3f274ee9f8df91c72263eecf8 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t21/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t21" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t21/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t21/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t21/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t21/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t21/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t21/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t22/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t22/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t22/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t22/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t22/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t22/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t22/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t22/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..e3098e928d2b2cbe2e96ee6a89baa0c1b13514ee --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t22/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t22", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "APAC", + "category": "D", + "month_start": 202603, + "month_end": 202605 + }, + "question": "What ISO currency code is used for the APAC region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t22/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t22/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41ab7a3119b3c44f20e4c1863904c3244c33e783 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t22/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the APAC region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t22/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t22/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a7ac0d30131f553fb92d9b18350b05cc2231324d --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t22/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t22" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t22/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t22/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t22/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t22/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t22/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t22/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t23/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t23/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t23/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t23/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t23/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t23/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t23/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t23/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..b7faa7d2c2360534da1706cd4e8c9f1520db3954 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t23/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t23", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "LATAM", + "category": "C", + "month_start": 202601, + "month_end": 202602 + }, + "question": "What ISO currency code is used for the LATAM region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t23/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t23/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ace9aa4036061f65d31bdc16fa303ee2a2ff18cf --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t23/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the LATAM region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t23/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t23/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1c1b0b408b34a8fe6e44165a7b5641a72093a664 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t23/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t23" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t23/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t23/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t23/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t23/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t23/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t23/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t24/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t24/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t24/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t24/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t24/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t24/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t24/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t24/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..123bd3062a2634b03d43d2d780e686f5f06f3a8e --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t24/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t24", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "NA", + "category": "D", + "month_start": 202601, + "month_end": 202603 + }, + "question": "What ISO currency code is used for the NA region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t24/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t24/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7862f017d818ad5e8158e891f88bc71a9834b22f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t24/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the NA region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t24/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t24/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..778cb9366f1e0c40c722642e9b5486e493cce250 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t24/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t24" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t24/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t24/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t24/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t24/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t24/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t24/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t3/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t3/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t3/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t3/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t3/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t3/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t3/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..844aa3cdb9602497a229a28cec7802145837d799 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t3/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t3", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "EU", + "category": "D", + "month_start": 202603, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the EU region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t3/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t3/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b382f1ac888d3909a557f2ea860e8215c7c08526 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t3/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the EU region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t3/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t3/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..03e55fce805c661719214f846812b99178696b7b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t3/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t3" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t3/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t3/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t3/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t3/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t3/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t4/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t4/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t4/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t4/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t4/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t4/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t4/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t4/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..9a94298c494d3fd51a4ba672f8c29fdf7b4df23f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t4/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t4", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "APAC", + "category": "A", + "month_start": 202602, + "month_end": 202605 + }, + "question": "What ISO currency code is used for the APAC region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t4/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t4/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41ab7a3119b3c44f20e4c1863904c3244c33e783 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t4/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the APAC region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t4/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t4/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4e0859a57ef279a5eb24c1f4b501c18f8906feb5 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t4/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t4" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t4/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t4/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t4/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t4/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t4/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t4/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t5/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t5/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t5/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t5/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t5/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t5/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t5/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t5/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..e6f630bfa2a507a791b68d8f80aaafe724f07ef4 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t5/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t5", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "APAC", + "category": "D", + "month_start": 202601, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the APAC region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t5/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t5/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41ab7a3119b3c44f20e4c1863904c3244c33e783 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t5/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the APAC region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t5/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t5/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6776c62206caf48f7a0f04aff562049a0634c495 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t5/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t5" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t5/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t5/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t5/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t5/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t5/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t5/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t6/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t6/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t6/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t6/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t6/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t6/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t6/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t6/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..6b09b89604a937bae2b1d5a87804ff83e956fd20 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t6/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t6", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "LATAM", + "category": "B", + "month_start": 202601, + "month_end": 202604 + }, + "question": "What ISO currency code is used for the LATAM region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t6/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t6/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ace9aa4036061f65d31bdc16fa303ee2a2ff18cf --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t6/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the LATAM region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t6/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t6/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4db4657c68785161c1afd6bce2ebebd2ea65a9ef --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t6/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t6" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t6/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t6/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t6/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t6/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t6/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t6/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t7/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t7/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t7/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t7/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t7/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t7/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t7/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..eae96d6966f5513514a3b3403c383e24779cde3d --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t7/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t7", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "LATAM", + "category": "C", + "month_start": 202603, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the LATAM region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t7/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t7/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ace9aa4036061f65d31bdc16fa303ee2a2ff18cf --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t7/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the LATAM region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t7/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t7/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..941d2a85d5d0f33024f38640f770eef2242e3984 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t7/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t7" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t7/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t7/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t7/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t7/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t7/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t8/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t8/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t8/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t8/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t8/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t8/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t8/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t8/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..5a26f47b05f883e62915c370a472d8c075337b5b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t8/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t8", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "NA", + "category": "D", + "month_start": 202602, + "month_end": 202606 + }, + "question": "What ISO currency code is used for the NA region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t8/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t8/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7862f017d818ad5e8158e891f88bc71a9834b22f --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t8/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the NA region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t8/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t8/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..37f79b7b96e02bec1502ef03649d1d5a219dda32 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t8/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t8" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t8/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t8/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t8/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t8/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t8/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t8/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_currency_lookup_t9/environment/Dockerfile b/harbor/tasks/v3_depth1_currency_lookup_t9/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t9/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_currency_lookup_t9/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_currency_lookup_t9/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t9/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_currency_lookup_t9/environment/task.json b/harbor/tasks/v3_depth1_currency_lookup_t9/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..35b36aeebd085c1a4ae22bb2f97135590229ed0b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t9/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_currency_lookup_t9", + "depth": 1, + "family": "currency_lookup", + "params": { + "region": "EU", + "category": "A", + "month_start": 202602, + "month_end": 202605 + }, + "question": "What ISO currency code is used for the EU region? Report only the code.", + "answer_format": "exact code" +} diff --git a/harbor/tasks/v3_depth1_currency_lookup_t9/instruction.md b/harbor/tasks/v3_depth1_currency_lookup_t9/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b382f1ac888d3909a557f2ea860e8215c7c08526 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t9/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact code. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +What ISO currency code is used for the EU region? Report only the code. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_currency_lookup_t9/task.toml b/harbor/tasks/v3_depth1_currency_lookup_t9/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..78cb9fdd6989b16a3b13b37015c0e9097c98cba1 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t9/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_currency_lookup_t9" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_currency_lookup_t9/tests/check_output_shape.py b/harbor/tasks/v3_depth1_currency_lookup_t9/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t9/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_currency_lookup_t9/tests/test.sh b/harbor/tasks/v3_depth1_currency_lookup_t9/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_currency_lookup_t9/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t0/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t0/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t0/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t0/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t0/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t0/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t0/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t0/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..cda24d5e19ff55307b3c1f4c34d936186787e4fd --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t0/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t0", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "NA", + "category": "A", + "month_start": 202601, + "month_end": 202603 + }, + "question": "For region NA, category A, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t0/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t0/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7b608c30f6e7d428f38454dbeba3c0c3e9332b1d --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t0/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region NA, category A, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t0/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t0/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d7bb2d88447910b0847efd4b61a0d2616cab0442 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t0/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t0" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t0/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t0/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t0/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t0/tests/test.sh b/harbor/tasks/v3_depth1_top_product_lookup_t0/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t0/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t1/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t1/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t1/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t1/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t1/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t1/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t1/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t1/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..d0936c155bd7d1d1db03780324d77cd21cef1a86 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t1/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t1", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "NA", + "category": "B", + "month_start": 202604, + "month_end": 202606 + }, + "question": "For region NA, category B, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t1/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t1/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a07557581c60698132a039bcd47d0c5c93f641db --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t1/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region NA, category B, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t1/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t1/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b828c824d3a713772ce7b2d086d5724ceafa78b1 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t1/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t1" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t1/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t1/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t1/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t1/tests/test.sh b/harbor/tasks/v3_depth1_top_product_lookup_t1/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t1/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t10/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t10/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t10/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t10/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t10/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t10/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t10/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t10/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..a68f224371ea531c62bef70e7e59b357e2bb42f8 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t10/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t10", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "APAC", + "category": "B", + "month_start": 202604, + "month_end": 202606 + }, + "question": "For region APAC, category B, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t10/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..af2519c10d905df0fa2c18a3499437c1b47c9e88 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t10/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region APAC, category B, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t10/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..91155de78011636fd02a0737919e95065b98cfa8 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t10/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t10" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t10/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t10/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t10/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t10/tests/test.sh b/harbor/tasks/v3_depth1_top_product_lookup_t10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t10/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t11/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t11/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t11/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t11/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t11/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t11/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t11/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t11/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..37d5bc23e133a9448bcd6ba485a8eaa03dec6d06 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t11/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t11", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "LATAM", + "category": "A", + "month_start": 202601, + "month_end": 202603 + }, + "question": "For region LATAM, category A, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t11/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d3598629641641b5a2922efe9fd7dfbba464f885 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t11/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region LATAM, category A, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t11/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..64fb0beb00c96130720f7af923182b12d415df71 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t11/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t11" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t11/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t11/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t11/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t11/tests/test.sh b/harbor/tasks/v3_depth1_top_product_lookup_t11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t11/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t12/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t12/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t12/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t12/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t12/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t12/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t12/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t12/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..79daa3612900ac5c17db9dfc656ba9830a5e75b9 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t12/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t12", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "NA", + "category": "C", + "month_start": 202601, + "month_end": 202606 + }, + "question": "For region NA, category C, months 202601-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t12/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..229b92b9f1e32bb15bc7a856b9e1bcda5fe4007d --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t12/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region NA, category C, months 202601-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t12/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7076528850fa162e662a5b7d418ac02812e90f16 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t12/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t12" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t12/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t12/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t12/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t12/tests/test.sh b/harbor/tasks/v3_depth1_top_product_lookup_t12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t12/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t13/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t13/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t13/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t13/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t13/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t13/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t13/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t13/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..16e26041cb3a7f8a64ae042b91fbe33f25ae4a47 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t13/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t13", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "EU", + "category": "B", + "month_start": 202601, + "month_end": 202603 + }, + "question": "For region EU, category B, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t13/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t13/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b748bca73b0e3ea65daa48714cf1336505563b9a --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t13/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region EU, category B, months 202601-202603, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t13/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t13/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7845d3b398e745ac04b5c7b04bea127ab9468944 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t13/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t13" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t13/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t13/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t13/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t13/tests/test.sh b/harbor/tasks/v3_depth1_top_product_lookup_t13/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t13/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t14/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t14/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t14/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t14/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t14/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t14/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t14/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t14/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..2ad8c91eba26771ee4ff8e89f21f4af1f2ce51a9 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t14/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t14", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "APAC", + "category": "C", + "month_start": 202602, + "month_end": 202606 + }, + "question": "For region APAC, category C, months 202602-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t14/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t14/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..caebd4ca973d47aacc5e86bff91faea84e63ab06 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t14/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region APAC, category C, months 202602-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t14/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t14/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a81bc2b56137d6f74c4e8c18f66e043fa50bc7f0 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t14/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t14" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t14/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t14/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t14/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t14/tests/test.sh b/harbor/tasks/v3_depth1_top_product_lookup_t14/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t14/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t15/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t15/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t15/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t15/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t15/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t15/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t15/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t15/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..500309e919b75e012c06839f1f05672a0a655266 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t15/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t15", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "LATAM", + "category": "D", + "month_start": 202601, + "month_end": 202605 + }, + "question": "For region LATAM, category D, months 202601-202605, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t15/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t15/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..57e72be903bf7319cfc42d5086a572abe360b175 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t15/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region LATAM, category D, months 202601-202605, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t15/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t15/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..57496471729f3bbcd81f7acd196f232629c60bd9 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t15/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t15" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t15/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t15/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t15/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t15/tests/test.sh b/harbor/tasks/v3_depth1_top_product_lookup_t15/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t15/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t16/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t16/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t16/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t16/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t16/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t16/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t16/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t16/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..c86327a40a45b0862d1fb14780bb2a75aa04c7d1 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t16/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t16", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "NA", + "category": "A", + "month_start": 202604, + "month_end": 202606 + }, + "question": "For region NA, category A, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t16/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t16/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ad29587e23508241c675ff52ba248fc2df97ce05 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t16/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region NA, category A, months 202604-202606, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t16/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t16/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..968c1a30b03035d49ab81ddd2564da51155028ff --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t16/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t16" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t16/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t16/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t16/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t16/tests/test.sh b/harbor/tasks/v3_depth1_top_product_lookup_t16/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8943b5d6a288c8fd56844aec54a60479395af94b --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t16/tests/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -u +python /tests/check_output_shape.py diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t17/environment/Dockerfile b/harbor/tasks/v3_depth1_top_product_lookup_t17/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..97377a0aa30bcf17ddd3345fff9e77e27b28ddb3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t17/environment/Dockerfile @@ -0,0 +1,4 @@ +FROM python:3.12-slim +WORKDIR /app +COPY flowbench_tools.py /app/flowbench_tools.py +COPY task.json /app/task.json diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t17/environment/flowbench_tools.py b/harbor/tasks/v3_depth1_top_product_lookup_t17/environment/flowbench_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..96661210d32ed1d8089959097124c723844255a3 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t17/environment/flowbench_tools.py @@ -0,0 +1,311 @@ +"""Deterministic FlowBench v3 tools. This file contains no task answers.""" + + +REGIONS = ["NA", "EU", "APAC", "LATAM"] +CATEGORIES = ["A", "B", "C", "D"] +CURRENCIES = {"NA": "USD", "EU": "EUR", "APAC": "JPY", "LATAM": "BRL"} +FX_TO_USD_BP = {"USD": 10000, "EUR": 10900, "JPY": 67, "BRL": 1850} +TIERS = ["std", "gold", "plat"] +DISCOUNT_PCT = {"std": 0, "gold": 10, "plat": 20} +CHANNELS = ["web", "store", "partner"] +MONTHS = [202601, 202602, 202603, 202604, 202605, 202606] + +N_CUSTOMERS = 72 +N_PRODUCTS = 48 +N_ORDERS = 720 +N_TICKETS = 260 +N_RETURNS = 180 + + +def _h(*xs): + import hashlib + s = "|".join(str(x) for x in xs).encode() + return int.from_bytes(hashlib.sha256(s).digest()[:8], "big") & 0x7FFFFFFF + + +def build_data(): + customers = [] + for cid in range(N_CUSTOMERS): + region = REGIONS[_h("region", cid) % len(REGIONS)] + customers.append({ + "customer_id": cid, + "region": region, + "tier": TIERS[_h("tier", cid) % len(TIERS)], + "segment": ["consumer", "smb", "enterprise"][_h("segment", cid) % 3], + }) + + products = [] + for pid in range(N_PRODUCTS): + cat = CATEGORIES[_h("cat", pid) % len(CATEGORIES)] + unit_price = 12 + _h("price", pid) % 240 + cogs = unit_price * (45 + _h("margin", pid) % 35) // 100 + products.append({ + "product_id": pid, + "category": cat, + "unit_price_usd": unit_price, + "unit_cogs_usd": cogs, + "lead_time_days": 3 + _h("lead", pid) % 18, + }) + + inventory = [] + for pid in range(N_PRODUCTS): + for region in REGIONS: + inventory.append({ + "product_id": pid, + "region": region, + "on_hand": 10 + _h("onhand", pid, region) % 140, + "reserved": _h("reserved", pid, region) % 28, + "inbound": _h("inbound", pid, region) % 85, + }) + + orders = [] + for oid in range(N_ORDERS): + customer_id = _h("ocust", oid) % N_CUSTOMERS + product_id = _h("oprod", oid) % N_PRODUCTS + month = MONTHS[_h("month", oid) % len(MONTHS)] + qty = 1 + _h("qty", oid) % 9 + ship_days = 1 + _h("shipdays", oid) % 16 + promised_days = 3 + _h("promise", oid) % 9 + status = ["paid", "paid", "paid", "paid", "cancelled", "refunded"][ + _h("status", oid) % 6] + orders.append({ + "order_id": oid, + "customer_id": customer_id, + "product_id": product_id, + "month": month, + "qty": qty, + "status": status, + "channel": CHANNELS[_h("channel", oid) % len(CHANNELS)], + "ship_days": ship_days, + "promised_days": promised_days, + }) + + returns = [] + for rid in range(N_RETURNS): + oid = _h("roid", rid) % N_ORDERS + order = orders[oid] + if order["status"] == "cancelled": + continue + returned_qty = 1 + _h("rqty", rid) % max(1, order["qty"]) + reason = ["defect", "late", "changed_mind", "wrong_item"][_h("reason", rid) % 4] + returns.append({ + "return_id": rid, + "order_id": oid, + "month": MONTHS[_h("rmonth", rid) % len(MONTHS)], + "returned_qty": returned_qty, + "reason": reason, + }) + + tickets = [] + for tid in range(N_TICKETS): + oid = _h("toid", tid) % N_ORDERS + severity = ["low", "medium", "high", "critical"][_h("sev", tid) % 4] + opened = MONTHS[_h("tmonth", tid) % len(MONTHS)] + first_response_hours = 1 + _h("resp", tid) % 96 + resolution_hours = first_response_hours + _h("res", tid) % 240 + tickets.append({ + "ticket_id": tid, + "order_id": oid, + "opened_month": opened, + "severity": severity, + "first_response_hours": first_response_hours, + "resolution_hours": resolution_hours, + }) + + return { + "customers": customers, + "products": products, + "inventory": inventory, + "orders": orders, + "returns": returns, + "tickets": tickets, + "fx_to_usd_bp": FX_TO_USD_BP, + } + + +DATA = build_data() +CUSTOMERS = {c["customer_id"]: c for c in DATA["customers"]} +PRODUCTS = {p["product_id"]: p for p in DATA["products"]} +ORDERS = {o["order_id"]: o for o in DATA["orders"]} + + +def region_currency(region: str) -> str: + return CURRENCIES[region] + + +def get_orders(region: str, category: str, month_start: int, month_end: int) -> list: + """Paid/refunded order ids in a region/category/month window.""" + out = [] + for o in DATA["orders"]: + if o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + p = PRODUCTS[o["product_id"]] + if c["region"] == region and p["category"] == category and month_start <= o["month"] <= month_end: + out.append(o["order_id"]) + return sorted(out) + + +def order_gross_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * p["unit_price_usd"] + + +def order_margin_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + return o["qty"] * (p["unit_price_usd"] - p["unit_cogs_usd"]) + + +def refund_usd(order_id: int) -> int: + o = ORDERS[order_id] + p = PRODUCTS[o["product_id"]] + qty = sum(r["returned_qty"] for r in DATA["returns"] if r["order_id"] == order_id) + qty = min(qty, o["qty"]) + return qty * p["unit_price_usd"] + + +def customer_tier(order_id: int) -> str: + o = ORDERS[order_id] + return CUSTOMERS[o["customer_id"]]["tier"] + + +def apply_discount(amount_usd: int, tier: str) -> int: + return amount_usd * (100 - DISCOUNT_PCT[tier]) // 100 + + +def net_revenue_usd(order_id: int) -> int: + gross = apply_discount(order_gross_usd(order_id), customer_tier(order_id)) + return max(0, gross - refund_usd(order_id)) + + +def to_local(amount_usd: int, currency: str) -> int: + return amount_usd * 10000 // FX_TO_USD_BP[currency] + + +def inventory_position(product_id: int, region: str) -> int: + row = next(x for x in DATA["inventory"] + if x["product_id"] == product_id and x["region"] == region) + return row["on_hand"] - row["reserved"] + row["inbound"] + + +def product_lead_time(product_id: int) -> int: + return PRODUCTS[product_id]["lead_time_days"] + + +def product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int: + totals = {} + for oid in get_orders(region, category, month_start, month_end): + o = ORDERS[oid] + totals[o["product_id"]] = totals.get(o["product_id"], 0) + o["qty"] + if not totals: + return -1 + return min((-qty, pid) for pid, qty in totals.items())[1] + + +def units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int: + total = 0 + for o in DATA["orders"]: + if o["product_id"] != product_id or o["status"] not in ("paid", "refunded"): + continue + c = CUSTOMERS[o["customer_id"]] + if c["region"] == region and month_start <= o["month"] <= month_end: + total += o["qty"] + return total + + +def tickets_for_orders(order_ids: list, severity: str) -> list: + s = set(order_ids) + return sorted(t["ticket_id"] for t in DATA["tickets"] + if t["order_id"] in s and t["severity"] == severity) + + +def ticket_order_id(ticket_id: int) -> int: + return next(t["order_id"] for t in DATA["tickets"] if t["ticket_id"] == ticket_id) + + +def sla_breached(ticket_id: int, first_response_limit_hours: int, + resolution_limit_hours: int) -> bool: + t = next(x for x in DATA["tickets"] if x["ticket_id"] == ticket_id) + return (t["first_response_hours"] > first_response_limit_hours or + t["resolution_hours"] > resolution_limit_hours) + + +def delayed_orders(order_ids: list) -> list: + s = set(order_ids) + return sorted(o["order_id"] for o in DATA["orders"] + if o["order_id"] in s and o["ship_days"] > o["promised_days"]) + + +def unique_customers(order_ids: list) -> list: + return sorted({ORDERS[oid]["customer_id"] for oid in order_ids}) + + +def count_items(values: list) -> int: + return len(values) + + +def sum_values(values: list) -> int: + return sum(values) + + +def count_true(values: list) -> int: + return sum(1 for v in values if bool(v)) + + +def count_below(values: list, threshold: int) -> int: + return sum(1 for v in values if v < threshold) + + +TOOLS = { + "region_currency": ("region_currency(region: str) -> str", + "ISO currency code for a region.", region_currency), + "get_orders": ("get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]", + "Paid/refunded order ids for a region, product category, and inclusive month window.", + get_orders), + "order_gross_usd": ("order_gross_usd(order_id: int) -> int", + "Gross order revenue in USD before discounts/refunds.", order_gross_usd), + "order_margin_usd": ("order_margin_usd(order_id: int) -> int", + "Gross order margin in USD before discounts/refunds.", order_margin_usd), + "refund_usd": ("refund_usd(order_id: int) -> int", + "Refund amount in USD for returned quantity on an order.", refund_usd), + "customer_tier": ("customer_tier(order_id: int) -> str", + "Customer loyalty tier for an order.", customer_tier), + "apply_discount": ("apply_discount(amount_usd: int, tier: str) -> int", + "Apply the order customer's loyalty discount to a USD amount.", apply_discount), + "net_revenue_usd": ("net_revenue_usd(order_id: int) -> int", + "Net USD revenue after loyalty discount and refunds.", net_revenue_usd), + "to_local": ("to_local(amount_usd: int, currency: str) -> int", + "Convert a USD integer amount to a local-currency integer.", to_local), + "inventory_position": ("inventory_position(product_id: int, region: str) -> int", + "Available inventory position: on_hand - reserved + inbound.", + inventory_position), + "product_lead_time": ("product_lead_time(product_id: int) -> int", + "Supplier lead time in days for a product.", product_lead_time), + "product_id_for_top_seller": ( + "product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int", + "Product id with the highest units sold in a region/category/month window.", + product_id_for_top_seller), + "units_sold": ("units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int", + "Units sold for one product in a region and month window.", units_sold), + "tickets_for_orders": ("tickets_for_orders(order_ids: list[int], severity: str) -> list[int]", + "Support ticket ids for given orders and severity.", tickets_for_orders), + "ticket_order_id": ("ticket_order_id(ticket_id: int) -> int", + "Order id associated with a support ticket.", ticket_order_id), + "sla_breached": ( + "sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool", + "Whether a support ticket breaches first-response or resolution SLA.", + sla_breached), + "delayed_orders": ("delayed_orders(order_ids: list[int]) -> list[int]", + "Subset of order ids whose ship_days exceeded promised_days.", delayed_orders), + "unique_customers": ("unique_customers(order_ids: list[int]) -> list[int]", + "Unique customer ids among the given orders.", unique_customers), + "count_items": ("count_items(values: list) -> int", "Length of a list.", count_items), + "sum_values": ("sum_values(values: list[int]) -> int", "Sum a list of integers.", sum_values), + "count_true": ("count_true(values: list[bool]) -> int", "Count true values.", count_true), + "count_below": ("count_below(values: list[int], threshold: int) -> int", + "Count values below a threshold.", count_below), +} + +__all__ = [name for name in TOOLS.keys()] + ['TOOLS'] diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t17/environment/task.json b/harbor/tasks/v3_depth1_top_product_lookup_t17/environment/task.json new file mode 100644 index 0000000000000000000000000000000000000000..3ef8c5960b66e38777f321f88cf770672f2d9aa5 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t17/environment/task.json @@ -0,0 +1,13 @@ +{ + "task_id": "v3_depth1_top_product_lookup_t17", + "depth": 1, + "family": "top_product_lookup", + "params": { + "region": "EU", + "category": "D", + "month_start": 202601, + "month_end": 202602 + }, + "question": "For region EU, category D, months 202601-202602, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders.", + "answer_format": "exact integer" +} diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t17/instruction.md b/harbor/tasks/v3_depth1_top_product_lookup_t17/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4ddf3d021c1ca90abca241a164c916d7f1ca1815 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t17/instruction.md @@ -0,0 +1,38 @@ +# FlowBench v3 Public Task + +You are in `/app`. The file `/app/flowbench_tools.py` contains deterministic +Python tools over a synthetic business-operations dataset. Use those tools +to compute the requested value, then write the final output to +`/app/answer.txt`. + +Required output: +- `/app/answer.txt` must contain only the exact integer. +- Use integer arithmetic for currency and counts. Do not use floating point + arithmetic. + +Task: +For region EU, category D, months 202601-202602, identify the product id with the highest units sold. Report only the product id; report -1 if no product has paid/refunded orders. + +Available tools: +- `region_currency(region: str) -> str`: ISO currency code for a region. +- `get_orders(region: str, category: str, month_start: int, month_end: int) -> list[int]`: Paid/refunded order ids for a region, product category, and inclusive month window. +- `order_gross_usd(order_id: int) -> int`: Gross order revenue in USD before discounts/refunds. +- `order_margin_usd(order_id: int) -> int`: Gross order margin in USD before discounts/refunds. +- `refund_usd(order_id: int) -> int`: Refund amount in USD for returned quantity on an order. +- `customer_tier(order_id: int) -> str`: Customer loyalty tier for an order. +- `apply_discount(amount_usd: int, tier: str) -> int`: Apply the order customer's loyalty discount to a USD amount. +- `net_revenue_usd(order_id: int) -> int`: Net USD revenue after loyalty discount and refunds. +- `to_local(amount_usd: int, currency: str) -> int`: Convert a USD integer amount to a local-currency integer. +- `inventory_position(product_id: int, region: str) -> int`: Available inventory position: on_hand - reserved + inbound. +- `product_lead_time(product_id: int) -> int`: Supplier lead time in days for a product. +- `product_id_for_top_seller(region: str, category: str, month_start: int, month_end: int) -> int`: Product id with the highest units sold in a region/category/month window. +- `units_sold(product_id: int, region: str, month_start: int, month_end: int) -> int`: Units sold for one product in a region and month window. +- `tickets_for_orders(order_ids: list[int], severity: str) -> list[int]`: Support ticket ids for given orders and severity. +- `ticket_order_id(ticket_id: int) -> int`: Order id associated with a support ticket. +- `sla_breached(ticket_id: int, first_response_limit_hours: int, resolution_limit_hours: int) -> bool`: Whether a support ticket breaches first-response or resolution SLA. +- `delayed_orders(order_ids: list[int]) -> list[int]`: Subset of order ids whose ship_days exceeded promised_days. +- `unique_customers(order_ids: list[int]) -> list[int]`: Unique customer ids among the given orders. +- `count_items(values: list) -> int`: Length of a list. +- `sum_values(values: list[int]) -> int`: Sum a list of integers. +- `count_true(values: list[bool]) -> int`: Count true values. +- `count_below(values: list[int], threshold: int) -> int`: Count values below a threshold. diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t17/task.toml b/harbor/tasks/v3_depth1_top_product_lookup_t17/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a8ff2dadba3de8d55928dcd72b3abe677a7132e9 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t17/task.toml @@ -0,0 +1,28 @@ +schema_version = "1.3" + +[task] +name = "mindlab/v3_depth1_top_product_lookup_t17" +description = "FlowBench v3 public task metadata. Public verifier is smoke-only." +authors = [{ name = "Mind Lab", email = "contact@mindlab.ltd" }] +keywords = ["flowbench", "tool-use", "data-orchestration", "operations"] + +[metadata] +benchmark = "FlowBench-v3" +split = "public-task-only" +category = "data-processing" +depth = 1 + +[verifier] +timeout_sec = 120.0 + +[agent] +timeout_sec = 900.0 + +[environment] +network_mode = "no-network" +build_timeout_sec = 600.0 +os = "linux" +cpus = 1 +memory_mb = 2048 +storage_mb = 2048 +gpus = 0 diff --git a/harbor/tasks/v3_depth1_top_product_lookup_t17/tests/check_output_shape.py b/harbor/tasks/v3_depth1_top_product_lookup_t17/tests/check_output_shape.py new file mode 100644 index 0000000000000000000000000000000000000000..19511d8e36ceaadad8043c93afbca73e685e53b6 --- /dev/null +++ b/harbor/tasks/v3_depth1_top_product_lookup_t17/tests/check_output_shape.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +from pathlib import Path + + +def write_reward(score: float, diagnostic: str) -> None: + log_dir = Path(os.environ.get("LOG_DIR", "/logs/verifier")) + log_dir.mkdir(parents=True, exist_ok=True) + (log_dir / "reward.txt").write_text(f"{score:.6g}\n") + (log_dir / "reward.json").write_text( + json.dumps({"reward": score, "smoke_only": True}, indent=2) + "\n" + ) + (log_dir / "diagnostic.txt").write_text(diagnostic + "\n") + + +def main() -> int: + app_dir = Path(os.environ.get("APP_DIR", "/app")) + task = json.loads((app_dir / "task.json").read_text()) + answer_path = app_dir / "answer.txt" + if not answer_path.exists(): + write_reward(0.0, "missing /app/answer.txt") + return 1 + + got = answer_path.read_text().strip() + if task["answer_format"] == "exact integer": + ok = bool(re.fullmatch(r"-?\d+", got)) + diagnostic = "valid integer smoke output" if ok else f"not an exact integer: {got!r}" + else: + ok = bool(re.fullmatch(r"[A-Za-z]+", got)) + diagnostic = "valid code smoke output" if ok else f"not an exact code: {got!r}" + + # This is intentionally not official scoring; it only verifies I/O shape. + write_reward(1.0 if ok else 0.0, diagnostic) + return 0 if ok else 1 + + +if __name__ == "__main__": + raise SystemExit(main())