can i use tool calling with generable in foundation models
Asked on 2025-07-15
1 search
Yes, you can use tool calling with generable types in the Foundation Models framework. Tool calling is built on guided generation, which ensures that the model will not produce invalid tool names or arguments. By defining your argument type as generable, you can ensure that the model generates valid input arguments for your tools. This allows the model to call your custom functions and incorporate the tool's output into its final response. For more details, you can refer to the session Meet the Foundation Models framework (11:28) and Deep dive into the Foundation Models framework (18:10).

Meet the Foundation Models framework
Learn how to tap into the on-device large language model behind Apple Intelligence! This high-level overview covers everything from guided generation for generating Swift data structures and streaming for responsive experiences, to tool calling for integrating data sources and sessions for context management. This session has no prerequisites.

Deep dive into the Foundation Models framework
Level up with the Foundation Models framework. Learn how guided generation works under the hood, and use guides, regexes, and generation schemas to get custom structured responses. We’ll show you how to use tool calling to let the model autonomously access external information and perform actions, for a personalized experience. To get the most out of this video, we recommend first watching “Meet the Foundation Models framework”.

Discover machine learning & AI frameworks on Apple platforms
Tour the latest updates to machine learning and AI frameworks available on Apple platforms. Whether you are an app developer ready to tap into Apple Intelligence, an ML engineer optimizing models for on-device deployment, or an AI enthusiast exploring the frontier of what is possible, we’ll offer guidance to help select the right tools for your needs.