Qwen 3.8 27B: Coding correctness: inventory transactions
Complete function implementation with passing tests
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
HapiTech's current default model for coding work. It's a sizeable 11 GB download that can read images as well as text. On this machine it only comfortably fits around 26-27K tokens of context on the GPU alone — stretching it out to the 64K window Hermes requires means some of the model has to run on the CPU instead, which is slower but still workable.
Tested by HapiTech on our own hardware. Want local AI that keeps your data in the building?
Talk to us