Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f2de319
Add Foundation Models 27 request options
qoli Oct 9, 2026
cd1d6fc
Add session properties to dynamic instructions
qoli Oct 11, 2026
9481380
Add session properties to dynamic instructions
qoli Oct 11, 2026
a03fd6b
Add Foundation Models 27 dynamic profiles
qoli Oct 11, 2026
da63029
Keep session property requests observable
qoli Oct 12, 2026
8b3a234
Keep session property requests observable
qoli Oct 12, 2026
d0cae54
Isolate dynamic profile request state
qoli Oct 13, 2026
d1c8413
Merge remote-tracking branch 'upstream/main' into codex/upstream-dyna…
qoli Oct 14, 2026
93e4d4d
Fix session property observation and typed defaults
qoli Oct 15, 2026
e99341e
Merge branch 'codex/upstream-session-properties' into codex/upstream-…
qoli Oct 15, 2026
cdeed51
Fix dynamic profile callback concurrency
qoli Oct 15, 2026
d211109
Allow sampling mode without tool calling policy
qoli Oct 16, 2026
3ad28fb
Keep session history bindings isolated and instruction free
qoli Oct 16, 2026
1fde50e
Merge branch 'codex/upstream-request-options' into codex/upstream-dyn…
qoli Oct 16, 2026
05f892a
Merge branch 'codex/upstream-session-properties' into codex/upstream-…
qoli Oct 16, 2026
9b76d74
Preserve profile history and request callback identity
qoli Oct 16, 2026
2c5c488
Invalidate stale history commits and evaluate property defaults outsi…
qoli Oct 17, 2026
905194e
Merge branch 'codex/upstream-session-properties' into codex/upstream-…
qoli Oct 17, 2026
d9e5f31
Preserve profile lifecycle identity and evolving callback history
qoli Oct 17, 2026
790ce15
Merge remote-tracking branch 'upstream/main' into codex/upstream-sess…
qoli Oct 17, 2026
0a3580b
Match HistoryView collection shape and bind session properties in con…
qoli Oct 17, 2026
4cf0f06
Reshape dynamic profiles as composition-only API on current session p…
qoli Oct 17, 2026
0dad115
Merge remote-tracking branch 'upstream/main' into codex/upstream-sess…
qoli Oct 19, 2026
25d51f1
Preserve public request context and expose Tool session properties
qoli Oct 19, 2026
8e10048
Merge session properties and upstream request options into profiles
qoli Oct 19, 2026
982cc07
Match the SDK history transform closure contract
qoli Oct 19, 2026
db6bc62
Preserve public Tool identity and bind at execution boundaries
qoli Oct 21, 2026
9b01280
Merge main while retaining offered Tool filtering and execution binding
qoli Oct 21, 2026
846508e
Merge branch 'codex/upstream-session-properties' into codex/upstream-…
qoli Oct 21, 2026
170aa66
Merge commit '7013d51f5f5249ab907ac8e2b5b5d0eb222c4153' into codex/up…
qoli Oct 22, 2026
aeae6e1
Merge commit '170aa66ef7024b72cbcefcf13a08621c9b466f5a' into codex/up…
qoli Oct 22, 2026
2495f61
Merge upstream request accounting and stream updates
qoli Oct 23, 2026
5359f3d
Merge updated session-properties dependency
qoli Oct 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,28 @@ but never become part of the session's transcript.
> Otherwise, it throws `SystemLanguageModel.Error.dynamicInstructionsUnavailable`
> for a session with dynamic instructions.

### Foundation Models 27 request options

`ContextOptions` mirrors Foundation Models 27's schema-in-prompt and reasoning-level
settings for compatibility-layer request construction. `GenerationOptions` also
provides the OS 27 `samplingMode` spelling and `ToolCallingMode` values:

```swift
let context = ContextOptions(
includeSchemaInPrompt: true,
reasoningLevel: .moderate
)
let options = GenerationOptions(
samplingMode: .greedy,
toolCallingMode: .required
)
```

The older `sampling` property and initializer remain source-compatible.
Tool-calling mode is preserved in Codable transcripts and forwarded by the
Foundation Models bridge on OS 27. Other model providers can read the same
option from their request's `GenerationOptions`.

### Reasoning in the transcript

Reasoning is transcript content, separate from the answer in `response.content`.
Expand Down Expand Up @@ -654,6 +676,11 @@ say which API they follow.
- `DynamicInstructions`, its builder, and `LanguageModelSession.init(model:dynamicInstructions:history:)`:
[dynamic instructions](#dynamic-instructions),
which follow the Foundation Models 27 API.
- `ContextOptions`, `GenerationOptions.samplingMode`, and
`GenerationOptions.ToolCallingMode`:
[request options](#foundation-models-27-request-options), which follow the
Foundation Models 27 API while remaining available on the package's existing
deployment targets.
- `Transcript.Entry.reasoning` and `Transcript.Reasoning`:
[reasoning in the transcript](#reasoning-in-the-transcript),
which follows the Foundation Models 27 API.
Expand Down
27 changes: 27 additions & 0 deletions Sources/AnyLanguageModel/ContextOptions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/// Options that configure a model's request context.
///
/// This mirrors the Foundation Models 27 request-context surface while keeping
/// the package available on its existing deployment targets.
public struct ContextOptions: Sendable, Equatable {
/// The amount of reasoning the model should perform for a request.
public enum ReasoningLevel: Sendable, Equatable {
case light
case moderate
case deep
case custom(String)
}

/// Whether a structured-generation schema should also appear in the prompt.
public var includeSchemaInPrompt: Bool?

/// The amount of reasoning the model should perform.
public var reasoningLevel: ReasoningLevel?

public init(
includeSchemaInPrompt: Bool? = nil,
reasoningLevel: ReasoningLevel? = nil
) {
self.includeSchemaInPrompt = includeSchemaInPrompt
self.reasoningLevel = reasoningLevel
}
}
2 changes: 1 addition & 1 deletion Sources/AnyLanguageModel/DynamicInstructions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ extension Instructions: PrimitiveDynamicInstructions {
}
}

private func resolveDynamicInstructions(
func resolveDynamicInstructions(
_ dynamicInstructions: any DynamicInstructions
) -> ResolvedDynamicInstructions {
func resolve<Content>(_ content: Content) -> ResolvedDynamicInstructions
Expand Down
Loading
Loading