Skip to content

Document dynamic profiles - #317

Draft
qoli wants to merge 75 commits into
huggingface:mainfrom
qoli:codex/upstream-dynamic-profile-docs
Draft

qoli wants to merge 75 commits into
huggingface:mainfrom
qoli:codex/upstream-dynamic-profile-docs

Conversation

@qoli

@qoli qoli commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Draft: defer the public construction example

Following mattt's 1.x API-freeze / #210 guidance, this documentation PR remains draft. The retained README example describes profile session construction and provider hooks as public API; those entry points are now explicitly Compatibility SPI in #315. The example and public-facing wording should not be published as a stable 1.x contract before the construction decision is settled.

No new documentation has been added during the reshape. The original profile documentation change remains 64 added README lines; the branch now includes all current implementation dependencies for integrated verification. No independent provider implementation lives only in this documentation PR.

Dependencies

All existing branch histories are retained through normal merges. After the dependency PRs merge, this remains documentation-only.

Integrated verification on this branch

  • CI=1 swift test: 851 tests / 83 suites passed.
  • CI=1 swift test --traits MLX,Llama,CoreML: 1,017 tests / 93 suites passed.
  • CI=1 swift test --traits AsyncHTTPClient: 745 tests / 76 suites passed (Foundation URLProtocol-only suites are intentionally excluded by their existing build guards).
  • watchOS device xcodebuild build: BUILD SUCCEEDED.
  • watchOS Simulator xcodebuild build-for-testing: TEST BUILD SUCCEEDED.
  • Strict recursive Swift formatting lint and git diff --check passed; the lockfile-only changes caused by optional-trait dependency resolution were not committed.
  • These are builds/offline tests. Live model-weight and Apple Intelligence generation acceptance are not claimed.

The integrated checks include #312 file-deletion/archive replay, HistoryView collection shape, detached/native Tool property binding, and every provider-specific profile regression. Upstream workflow approval is tracked separately from test/code failures.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread Sources/AnyLanguageModel/SessionProperties.swift Outdated
Comment thread Sources/AnyLanguageModel/LanguageModelSession.swift
Comment thread Sources/AnyLanguageModel/LanguageModelSession.swift Outdated
@qoli
qoli marked this pull request as draft October 17, 2026 16:09
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.

2 participants