Skip to content

Document dynamic profiles - #317

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

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

Conversation

@qoli

@qoli qoli commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a Dynamic Profile example using session properties and conditional profiles
  • explain modifier precedence, lifecycle callbacks, request projections, and canonical history
  • document the provider-continuation compatibility seam and producing-request Tool semantics
  • list the OS 27-compatible surface separately from AnyLanguageModel integration extensions

Stack

This documentation PR depends on #315 and therefore #314, #311, and #313. After those merge, the documentation-only change is commit b9738ab.

Verification

  • final README diff reviewed with git diff --check
  • every referenced type, modifier, session initializer, and compatibility hook verified against source
  • documented history and continuation claims are covered by the Dynamic Profile and provider-usage test suites
  • no application code changed

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
Comment thread Sources/AnyLanguageModel/LanguageModelSession.swift
Comment thread Sources/AnyLanguageModel/LanguageModelSession.swift Outdated

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

Multi-round Tool continuations duplicate prior in-flight entries in session-property history bindings.

1 open finding
3 resolved since last review

🧠 Review effort: Balanced

currentRoundEntries: [Transcript.Entry]
) async throws {
guard let profile = requestContext.profile else { return }
let history = requestContext.canonicalTranscript + currentRoundEntries
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