Skip to content

feat: apple context window handling#212

Open
JKobrynski wants to merge 7 commits into
callstackincubator:mainfrom
JKobrynski:feat/apple-context-window-handling
Open

feat: apple context window handling#212
JKobrynski wants to merge 7 commits into
callstackincubator:mainfrom
JKobrynski:feat/apple-context-window-handling

Conversation

@JKobrynski
Copy link
Copy Markdown

Related issue: #125

Summary

Adds explicit handling for Apple Foundation Models context window overflow errors.

When LanguageModelSession fails with exceededContextWindowSize, the Apple provider now exposes a stable CONTEXT_WINDOW_EXCEEDED error code. This allows apps to detect the failure and decide how to recover, for example by starting a new conversation or trimming previous messages.

Changes

  • Map Apple’s native context window overflow error to CONTEXT_WINDOW_EXCEEDED
  • Forward the error code through streaming errors
  • Expose AppleLLMErrorCodes.ContextWindowExceeded
  • Update the Expo example so text streams surface the error properly
  • Document recommended app-level recovery strategies

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

@JKobrynski is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@JKobrynski JKobrynski marked this pull request as ready for review May 22, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant