{"abstract":[{"text":"An error that signals the session reached its context window size limit.","type":"text"}],"deprecationSummary":[{"inlineContent":[{"text":"Use ","type":"text"},{"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelError\/contextSizeExceeded(_:)","isActive":true,"type":"reference"},{"text":" instead.","type":"text"}],"type":"paragraph"}],"hierarchy":{"paths":[["doc:\/\/com.apple.documentation\/documentation\/technologies","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError"]]},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/exceededContextWindowSize(_:)"},"kind":"symbol","legalNotices":{"copyright":"Copyright &copy; 2026 Apple Inc. All rights reserved.","privacyPolicy":"https:\/\/www.apple.com\/privacy\/privacy-policy","termsOfUse":"https:\/\/www.apple.com\/legal\/internet-services\/terms\/site.html"},"metadata":{"availableLanguages":["de-DE","en-US","es-419","fr-FR","it-IT","ja-JP","ko-KR","pt-BR","zh-CN"],"externalID":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO25exceededContextWindowSizeyA2E0I0VcAEmF","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"exceededContextWindowSize"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"modules":[{"name":"Foundation Models"}],"platforms":[{"deprecatedAt":"27.0","introducedAt":"26.0","message":"Use ``LanguageModelError\/contextSizeExceeded(_:)`` instead.","name":"iOS"},{"deprecatedAt":"27.0","introducedAt":"26.0","message":"Use ``LanguageModelError\/contextSizeExceeded(_:)`` instead.","name":"iPadOS"},{"deprecatedAt":"27.0","introducedAt":"26.0","message":"Use ``LanguageModelError\/contextSizeExceeded(_:)`` instead.","name":"Mac Catalyst"},{"deprecatedAt":"27.0","introducedAt":"26.0","message":"Use ``LanguageModelError\/contextSizeExceeded(_:)`` instead.","name":"macOS"},{"deprecatedAt":"27.0","introducedAt":"26.0","message":"Use ``LanguageModelError\/contextSizeExceeded(_:)`` instead.","name":"visionOS"}],"role":"symbol","roleHeading":"Case","symbolKind":"case","title":"LanguageModelSession.GenerationError.exceededContextWindowSize(_:)"},"primaryContentSections":[{"declarations":[{"languages":["swift"],"platforms":["iOS","iPadOS","Mac Catalyst","macOS","visionOS"],"tokens":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"exceededContextWindowSize"},{"kind":"text","text":"("},{"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession","kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError","kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/Context","kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}]}],"kind":"declarations"},{"content":[{"anchor":"discussion","level":2,"text":"Discussion","type":"heading"},{"inlineContent":[{"text":"This error occurs when you use the available tokens for the context window of 4,096 tokens. The","type":"text"},{"text":" ","type":"text"},{"text":"token count includes instructions, prompts, and outputs for a session instance. A single token","type":"text"},{"text":" ","type":"text"},{"text":"corresponds to approximately three to four characters in languages like English, Spanish, or","type":"text"},{"text":" ","type":"text"},{"text":"German, and one token per character in languages like Japanese, Chinese, and Korean.","type":"text"}],"type":"paragraph"},{"inlineContent":[{"text":"Start a new session when you exceed the content window size, and try again using a shorter","type":"text"},{"text":" ","type":"text"},{"text":"prompt or shorter output length.","type":"text"}],"type":"paragraph"},{"inlineContent":[{"text":"For more information on managing the context window size,","type":"text"},{"text":" ","type":"text"},{"text":"see ","type":"text"},{"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/managing-the-context-window","isActive":true,"type":"reference"},{"text":".","type":"text"}],"type":"paragraph"}],"kind":"content"}],"schemaVersion":{"major":0,"minor":3,"patch":0},"sections":[],"seeAlsoSections":[{"anchor":"Generation-errors","generated":true,"identifiers":["doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/assetsUnavailable(_:)","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/decodingFailure(_:)","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/guardrailViolation(_:)","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/rateLimited(_:)","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/refusal(_:_:)","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/concurrentRequests(_:)","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/unsupportedGuide(_:)","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/unsupportedLanguageOrLocale(_:)","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/Context","doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/Refusal"],"title":"Generation errors"}],"variants":[{"paths":["\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/exceededcontextwindowsize(_:)"],"traits":[{"interfaceLanguage":"swift"}]}],"references":{"doc://com.apple.documentation/documentation/technologies":{"abstract":[],"identifier":"doc:\/\/com.apple.documentation\/documentation\/technologies","kind":"technologies","role":"overview","title":"Technologies","type":"topic","url":"\/documentation\/technologies"},"doc://com.apple.foundationmodels/documentation/FoundationModels":{"abstract":[{"text":"Perform tasks with models that specialize in language understanding, structured output, and tool calling.","type":"text"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels","images":[{"identifier":"foundation-models-framework-landing-PageImage-card.png","type":"card"}],"kind":"symbol","navigatorTitle":[{"kind":"text","text":"Foundation Models"}],"role":"collection","title":"Foundation Models","type":"topic","url":"\/documentation\/foundationmodels"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelError/contextSizeExceeded(_:)":{"abstract":[{"text":"The session’s transcript exceeded the model’s context size.","type":"text"}],"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"contextSizeExceeded"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels18LanguageModelErrorO","text":"LanguageModelError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels18LanguageModelErrorO19ContextSizeExceededV","text":"ContextSizeExceeded"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelError\/contextSizeExceeded(_:)","kind":"symbol","role":"symbol","title":"LanguageModelError.contextSizeExceeded(_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelerror\/contextsizeexceeded(_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession":{"abstract":[{"text":"An object that represents a session that interacts with a language model.","type":"text"}],"fragments":[{"kind":"keyword","text":"class"},{"kind":"text","text":" "},{"kind":"identifier","text":"LanguageModelSession"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession","kind":"symbol","navigatorTitle":[{"kind":"identifier","text":"LanguageModelSession"}],"role":"symbol","title":"LanguageModelSession","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError":{"abstract":[{"text":"An error that may occur while generating a response.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"GenerationError"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError","kind":"symbol","navigatorTitle":[{"kind":"identifier","text":"GenerationError"}],"role":"symbol","title":"LanguageModelSession.GenerationError","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/Context":{"abstract":[{"text":"The context in which the error occurred.","type":"text"}],"fragments":[{"kind":"keyword","text":"struct"},{"kind":"text","text":" "},{"kind":"identifier","text":"Context"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/Context","kind":"symbol","navigatorTitle":[{"kind":"identifier","text":"Context"}],"role":"symbol","title":"LanguageModelSession.GenerationError.Context","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/context"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/Refusal":{"abstract":[{"text":"A refusal produced by a language model.","type":"text"}],"fragments":[{"kind":"keyword","text":"struct"},{"kind":"text","text":" "},{"kind":"identifier","text":"Refusal"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/Refusal","kind":"symbol","navigatorTitle":[{"kind":"identifier","text":"Refusal"}],"role":"symbol","title":"LanguageModelSession.GenerationError.Refusal","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/refusal"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/assetsUnavailable(_:)":{"abstract":[{"text":"An error that indicates the assets required for the session are unavailable.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"assetsUnavailable"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/assetsUnavailable(_:)","kind":"symbol","role":"symbol","title":"LanguageModelSession.GenerationError.assetsUnavailable(_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/assetsunavailable(_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/concurrentRequests(_:)":{"abstract":[{"text":"An error that happens if you attempt to make a session respond to a","type":"text"},{"text":" ","type":"text"},{"text":"second prompt while it’s still responding to the first one.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"concurrentRequests"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/concurrentRequests(_:)","kind":"symbol","role":"symbol","title":"LanguageModelSession.GenerationError.concurrentRequests(_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/concurrentrequests(_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/decodingFailure(_:)":{"abstract":[{"text":"An error that indicates the session failed to deserialize a valid generable type from model output.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"decodingFailure"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/decodingFailure(_:)","kind":"symbol","role":"symbol","title":"LanguageModelSession.GenerationError.decodingFailure(_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/decodingfailure(_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/exceededContextWindowSize(_:)":{"abstract":[{"text":"An error that signals the session reached its context window size limit.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"exceededContextWindowSize"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/exceededContextWindowSize(_:)","kind":"symbol","role":"symbol","title":"LanguageModelSession.GenerationError.exceededContextWindowSize(_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/exceededcontextwindowsize(_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/guardrailViolation(_:)":{"abstract":[{"text":"An error that indicates the system’s safety guardrails are triggered by content in a","type":"text"},{"text":" ","type":"text"},{"text":"prompt or the response generated by the model.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"guardrailViolation"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/guardrailViolation(_:)","kind":"symbol","role":"symbol","title":"LanguageModelSession.GenerationError.guardrailViolation(_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/guardrailviolation(_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/rateLimited(_:)":{"abstract":[{"text":"An error that indicates your session has been rate limited.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"rateLimited"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/rateLimited(_:)","kind":"symbol","role":"symbol","title":"LanguageModelSession.GenerationError.rateLimited(_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/ratelimited(_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/refusal(_:_:)":{"abstract":[{"text":"An error indicating that the model refused to answer.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"refusal"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7RefusalV","text":"Refusal"},{"kind":"text","text":", "},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/refusal(_:_:)","kind":"symbol","role":"symbol","title":"LanguageModelSession.GenerationError.refusal(_:_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/refusal(_:_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/unsupportedGuide(_:)":{"abstract":[{"text":"An error that indicates a generation guide with an unsupported pattern was used.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"unsupportedGuide"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/unsupportedGuide(_:)","kind":"symbol","role":"symbol","title":"LanguageModelSession.GenerationError.unsupportedGuide(_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/unsupportedguide(_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/GenerationError/unsupportedLanguageOrLocale(_:)":{"abstract":[{"text":"An error that indicates an error that occurs if the model is prompted to respond in a language","type":"text"},{"text":" ","type":"text"},{"text":"that it does not support.","type":"text"}],"deprecated":true,"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"unsupportedLanguageOrLocale"},{"kind":"text","text":"("},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC","text":"LanguageModelSession"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO","text":"GenerationError"},{"kind":"text","text":"."},{"kind":"typeIdentifier","preciseIdentifier":"s:16FoundationModels20LanguageModelSessionC15GenerationErrorO7ContextV","text":"Context"},{"kind":"text","text":")"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/LanguageModelSession\/GenerationError\/unsupportedLanguageOrLocale(_:)","kind":"symbol","role":"symbol","title":"LanguageModelSession.GenerationError.unsupportedLanguageOrLocale(_:)","type":"topic","url":"\/documentation\/foundationmodels\/languagemodelsession\/generationerror\/unsupportedlanguageorlocale(_:)"},"doc://com.apple.foundationmodels/documentation/FoundationModels/managing-the-context-window":{"abstract":[{"text":"Optimize your app’s token usage when prompting a model with the Foundation Models","type":"text"},{"text":" ","type":"text"},{"text":"framework.","type":"text"}],"identifier":"doc:\/\/com.apple.foundationmodels\/documentation\/FoundationModels\/managing-the-context-window","kind":"article","role":"article","title":"Managing the context window","type":"topic","url":"\/documentation\/foundationmodels\/managing-the-context-window"},"foundation-models-framework-landing-PageImage-card.png":{"alt":"An illustration that represents a foundation model.","identifier":"foundation-models-framework-landing-PageImage-card.png","type":"image","variants":[{"traits":["2x","light"],"url":"\/images\/com.apple.foundationmodels\/foundation-models-framework-landing-PageImage-card@2x.png"},{"traits":["2x","dark"],"url":"\/images\/com.apple.foundationmodels\/foundation-models-framework-landing-PageImage-card~dark@2x.png"}]}}}