Skip to main content
Tool calling allows AI models to execute functions and interact with external systems, enabling more dynamic and powerful applications.

Basic Tool Calling

Simple Function Definition

Define a tool within your application that the AI model can call.
TypeScript

Streaming with Tools

TypeScript

Next Steps

  1. Structured Output - Generate JSON and structured data
  2. Image Input - Work with multimodal inputs
  3. Reasoning - Advanced reasoning capabilities
Tool calling works best with models like GPT-4o, Claude Sonnet-4, and other function-calling capable models. Always validate tool inputs and handle errors gracefully. Both TypeScript and Python SDKs provide the same powerful tool calling capabilities with language-appropriate patterns.