Gemma 4 26B A4B: Coding correctness: inventory transactions
The task
The model must implement a small inventory-transaction function to a written specification. Its output is run against a fixed pytest-style acceptance suite covering normal operation, edge cases and invalid input.
Pass if: percentage of the 5 acceptance tests passed when the extracted function is executed in an isolated sandbox with no filesystem/network/env access
The exact prompt
Write a Python function named `apply_transactions(stock, transactions)`.
Specification:
- `stock` maps item names to nonnegative integer quantities.
- Each transaction is a dictionary with `item`, `quantity` and `operation`.
- Supported operations are `add` and `remove`.
- Adding increases the item's quantity. Adding an unknown item creates it.
- Removing decreases the quantity.
- Removing an unknown item or reducing stock below zero raises `ValueError`.
- An invalid operation raises `ValueError`.
- Quantity must be a positive integer. Otherwise raise `ValueError`.
- Return a new inventory dictionary.
- Do not modify either input.
Return only the complete function definition. Do not use imports, external libraries, file access or network access.The model
A larger, roomier model we keep on hand for non-coding work. It handles images too, and natively fits a much bigger 47-51K token window than our coder before needing CPU help. Push it all the way to 128K context, though, and it has to run entirely on the CPU — we measured this, it's not a guess, and it's noticeably slower.
Tested by HapiTech on our own hardware. Want local AI that keeps your data in the building?
Talk to us