Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Streaming context propagation, callback error policy, and protected continuation history have unresolved correctness issues.
3 open findings
What changed in this PR
Implements and documents Foundation Models 27-compatible dynamic profiles, session properties, request options, and provider Tool continuations.
Changes:
- Adds dynamic profile composition, lifecycle callbacks, session properties, and request options.
- Supports profile reevaluation and model handoff across remote providers.
- Adds compatibility, lifecycle, continuation, and serialization tests plus README guidance.
| File | Description |
|---|---|
Tests/AnyLanguageModelTests/SessionPropertyTests.swift |
Tests session properties and history behavior. |
Tests/AnyLanguageModelTests/RequestOptionsTests.swift |
Tests request-option compatibility. |
Tests/AnyLanguageModelTests/ProviderUsageTests.swift |
Tests provider profile continuations. |
Tests/AnyLanguageModelTests/FoundationModelsGenerationOptionsTests.swift |
Tests Foundation Models option bridging. |
Tests/AnyLanguageModelTests/DynamicProfileTests.swift |
Tests profiles and lifecycle behavior. |
Tests/AnyLanguageModelTests/APICompatibilityFoundationModelsTests.swift |
Checks Foundation Models API compatibility. |
Tests/AnyLanguageModelTests/APICompatibilityAnyLanguageModelTests.swift |
Checks AnyLanguageModel compatibility. |
Tests/AnyLanguageModelTests/AnthropicReasoningTests.swift |
Covers non-streaming Anthropic continuation. |
Sources/AnyLanguageModelMacros/SessionPropertyEntryMacro.swift |
Generates session-property storage accessors. |
Sources/AnyLanguageModelMacros/Plugin.swift |
Registers the new macro. |
Sources/AnyLanguageModel/SessionProperties.swift |
Implements session-scoped properties and history. |
Sources/AnyLanguageModel/ProfileToolExecution.swift |
Centralizes profile-aware Tool execution and handoff. |
Sources/AnyLanguageModel/Models/SystemLanguageModel.swift |
Bridges Tool-calling mode. |
Sources/AnyLanguageModel/Models/OpenResponsesLanguageModel.swift |
Adds profile-aware continuations. |
Sources/AnyLanguageModel/Models/OpenAILanguageModel.swift |
Adds profile-aware continuations. |
Sources/AnyLanguageModel/Models/OllamaLanguageModel.swift |
Adds multi-round profile continuations. |
Sources/AnyLanguageModel/Models/GeminiLanguageModel.swift |
Adds profile-aware continuations. |
Sources/AnyLanguageModel/Models/AnthropicLanguageModel.swift |
Adds non-streaming Tool continuations. |
Sources/AnyLanguageModel/LanguageModelSession.swift |
Integrates profile resolution and callbacks. |
Sources/AnyLanguageModel/GenerationOptions.swift |
Adds OS 27-compatible options. |
Sources/AnyLanguageModel/DynamicProfile.swift |
Defines dynamic profile composition. |
Sources/AnyLanguageModel/DynamicInstructions.swift |
Exposes instruction resolution internally. |
Sources/AnyLanguageModel/ContextOptions.swift |
Defines request-context options. |
README.md |
Documents request options and profiles. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…stream-profile-gemini
…stream-profile-native-history
…stream-dynamic-profile-docs
…stream-dynamic-profile-docs
…stream-dynamic-profile-docs
…stream-dynamic-profile-docs
…stream-dynamic-profile-docs
…stream-dynamic-profile-docs
…stream-dynamic-profile-docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Draft: defer the public construction example
This remains draft. The original profile-construction/provider-hook README example must not be published as an agreed stable 1.x contract while the #315 constructor/hooks remain Compatibility SPI and the construction decision is outstanding.
No independent documentation was added. Against the current #312 README the original profile delta is still 64 added lines. The branch inherits #312's authorized Gemini 3+ / remote-URL note and upstream transport documentation through normal dependency merges.
Implementation dependencies / source ownership
Head b946bec has all ten implementation heads as ancestors. Provider source matches each owning PR; the native source adds only #312's two snapshot-preserving lowering changes over #349, retaining upstream #297's delegate. No independent provider implementation lives only here. No force-push/new checkout or profile-documentation expansion.
Upstream 1.1 synchronization
Normal history-preserving merges synchronize upstream main 7d43219, including #357 per-request usage accounting, #341 Ollama reasoning, #358 host-scoped Chat Completions reasoning, #300 response-start timeouts, #362 cancellation collection, #364 partial structured snapshots and #366/#367 bounds/reasoning/system-Tool fixes. Earlier #336 final-request usage, #340 HTTPTransport, #297/#325/#331/#343/#352/#354/#356 remain intact. No force-push, new checkout, replacement PR or extra fallback.
The integrated source retains per-request/failure usage accounting, final-request response values, host/provider-scoped reasoning replay, producing-profile callbacks, response start timeouts and partial/cancelled stream behavior. Provider files exactly match their owning PRs; the native bridge adds only #312's two snapshot lowerings over #349. The shared runtime/fixtures exactly match #315. No profile documentation or constructor visibility is expanded.
Fresh integrated verification (2026-10-23)
Same fixed checkout/source with
CI=1 GIT_CONFIG_GLOBAL=/dev/null swift test:These are compile/offline tests, not live APIs, model weights or Apple Intelligence inference. Latest-source watchOS/Linux validation must come from this head's checks, not the previous head's successful CI. Constructor visibility/default model and the separate ordinary Ollama continuation PR remain outstanding; this PR stays draft.