Contents

SessionPropertyEntry()

A macro for defining a custom key.

Declaration

@attached(accessor) @attached(peer, names: prefixed(__Key_)) macro SessionPropertyEntry()

Mentioned in

Overview

When you need session-scoped properties apply the SessionPropertyEntry() macro to a stored property in an extension on SessionPropertyValues:

extension SessionPropertyValues {
    @SessionPropertyEntry
    var activatedSkills: [String: Bool] = [:]
}

Read the shared session state for the custom value by using LanguageModelSession.SessionProperty:

@SessionProperty(\.activatedSkills)
var activatedSkills

See Also

Custom session properties