Function Calling Deep Dive — OpenAI, Anthropic, Gemini

The three frontier providers converged on the same tool-call loop in 2024 and then diverged on everything else. OpenAI uses `tools` and `tool_calls`. Anthropic uses `tool_use` and `tool_result` blocks. Gemini uses `functionDeclarations` and unique-id correlation. This lesson diffs the three side by side so code that ships on one provider does not break when you port it.

Build 1.3 hr Python (stdlib, schema translators)

Prerequisites: Phase 13 · 01 (the tool interface)

#Learning Objectives

  • State the three shape differences between OpenAI, Anthropic, and Gemini function-calling payloads (declaration, call, result).
  • Translate one tool declaration across all three provider formats and predict where strict-mode constraints will differ.
  • Use tool_choice in each provider to force, forbid, or auto-pick tool calls.
  • Know the per-provider hard limits (tool count, schema depth, argument length) and the error signatures each one emits when limits are violated.
Full Access lesson

Keep going. The rest of this lesson is one step away.

Unlock all 503 lessons, video, code, quizzes and every future update. Pay in your own currency with Paystack.

The text and code of this lesson are based on AI Engineering from Scratch by Rohit Ghumare, MIT licensed.