File size: 521 Bytes
d158bbb
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
"""Serialize exactly the information available to an approve/deny classifier."""
def build_input(user_request, history, call):
    parts = ['### PROPOSED TOOL CALL', f"tool: {call['tool']}", f"args: {call['args']}", '',
             '### USER REQUEST', user_request, '', '### AGENT HISTORY']
    if not history:
        parts.append('(no prior actions)')
    else:
        for i, h in enumerate(history):
            parts.append(f"[{i+1}] {h['tool']}({h['args']})\n-> {h.get('result', '')}")
    return '\n'.join(parts)