File size: 3,498 Bytes
c72da75 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """Unrun prompt candidate. Reuses the frozen validator; never replaces old prompts."""
import json
import environment as frozen
Shop = frozen.Shop
def prompt(row):
return json.dumps({
'contract_version': 'local-v2-unrun',
'instruction': 'Return exactly one JSON object with tool and arguments, no other text. '
'Each tool requires exactly the keys listed below. Maximum five calls; '
'invalid calls fail immediately, without repair or retry. '
'Complete with propose_item or route_service; those end the episode.',
'tools': {
'search_catalog': {'required': frozen.TOOLS['search_catalog'],
'rules': 'query must equal task.target exactly, not a rewritten search phrase. '
'filters must be an object, either empty or containing only task.field '
'with a string value. Matching is exact; preserve material qualifiers. '
'Returns items with id, the queried attribute, and fits.'},
'check_fit': {'required': frozen.TOOLS['check_fit'],
'rules': 'item_ids must be a nonempty list of IDs from the most recent search. '
'reference_width must be a string describing the reference footwear width. '
'Returns compatible_ids. Do not invent IDs.'},
'ask_clarification': {'required': frozen.TOOLS['ask_clarification'],
'rules': 'field must equal task.field exactly; question must be a nonempty string. '
'Returns answer.required (boolean) and answer.value (string).'},
'route_service': {'required': frozen.TOOLS['route_service'],
'rules': 'intent must be repair, return, or advice; target must equal task.target exactly. '
'Ends the episode.'},
'propose_item': {'required': frozen.TOOLS['propose_item'],
'rules': 'item_id must be an ID from the most recent search; never invent one. '
'For compatibility tasks choose from check_fit compatible_ids. Ends the episode.'}},
'workflow_rules': [
'Only handle the supplied target and queried field; do not add other product constraints.',
'For an explicit requirement, search once with that field/value filter, then propose an item. Do not ask.',
'If inheritance of an old item attribute is unclear, ask once BEFORE searching. If required is true, '
'filter by answer.value; otherwise use empty filters. Then propose an item.',
'No requirement means empty filters, not prohibition of the mentioned value. Do not use any as a value.',
'For a reference footwear compatibility requirement, search once with empty filters, '
'check_fit once, then propose a compatible item. Do not treat reference width as the new item width.',
'For repair, return or advice about the target, route_service only; do not shop.',
'If the queried field is absent or outside its field_meaning, search with empty filters; do not ask.',
'For purchase success this benchmark requires exactly one search and no unnecessary clarification or fit calls.',
'An empty catalog result has no valid proposal; there is no recovery/abstention tool in this benchmark.'
],
'task': row['input'],
}, sort_keys=True)
|