The Minutiae of Tool-calling A developer recounts building a mail classifier with GPT-3 before structured output and tool-calling existed, using a custom pipeline that generated JSON schemas and repaired outputs, and argues that understanding the underlying mechanics of tool-calling is essential, illustrating with a puzzle where Claude must guess a door code through various tool interfaces. Two years ago I was hosting my own SMTP server and had a simple goal: receiving one-time codes + the occasional human email. But I kept running into two issues: This was around the time GPT 3 came out, but we didn’t have structured output yet, let alone tool-calls, so I came up with this beautiful strategy: 1// Mail classifier. 2// 3const classifyMail = createPipeline 4 'mail corpus', 5 z.object { 6 chance: z 7 .number 8 .min 0 9 .max 1 10 .describe 'Chances of the email being important password reset, verification etc. and not filtered by the smart email filter.'+ 11 'Promotional, scam-like, spammy, and advertising content should receive a 0 score.' , 12 linkOrCode: z.string .optional .describe 'Any important link or code' , 13 summary: z.string .describe 'Summary of the body' 14 } , 15 { 16 lang: 'English' 17 } 18 ; 1export function createPipeline