One Logo Pool Ball
FoundationModels · IOS API REFERENCE

LanguageModelCapabilities

struct · iOS 27.0+ · SDK 27.1

struct LanguageModelCapabilities

A set of capabilities that a language model provides. Use this to declare what your model can do, like tool calling and guided generation: ```swift struct MyLanguageModel: LanguageModel { var capabilities: LanguageModelCapabilities { LanguageModelCapabilities([ .toolCalling, .guidedGeneration, .reasoning ]) } } ``` Inspect ``LanguageModel/capabilities`` ahead of time to detect what the model supports before performing the request: ```swift // Before prompting the model with a generable type, check whether it // supports guided generation. if selectedModel.capabilities.contains(.guidedGeneration) { let response = try await session.respond(to: "...", generating: MySchema.self) } ``` When a model doesn't support a capability, the framework can refuse to dispatch incompatible requests to the executor and throw an ``LanguageModelError/unsupportedCapability(_:)`` error instead.

Members (2)

method · iOS 27.0+

contains

TypeScript
contains(capability: LanguageModelCapabilities_Capability): boolean
Swift declaration
func contains(_ capability: LanguageModelCapabilities.Capability) -> Bool

Returns a Boolean value that indicates whether the specified capability is supported.

init · iOS 27.0+

init

TypeScript
static init(capabilities: Array<LanguageModelCapabilities_Capability>): LanguageModelCapabilities
Swift declaration
init(_ capabilities: [LanguageModelCapabilities.Capability])

Creates a capabilities instance from a list of supported capabilities.

Skipped declarations

No declarations were skipped in this snapshot.

All FoundationModels types →