fm-rs 0.2.1

Rust bindings for Apple's FoundationModels.framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import FoundationModels

/// Creates generation options using the Foundation Models 26 SDK spelling.
/// Pre-27 SDKs have no tool-calling mode; the option is ignored.
func makeGenerationOptions(
    sampling: String?,
    temperature: Double?,
    maximumResponseTokens: UInt32?,
    toolCallingMode: String?
) -> GenerationOptions {
    _ = toolCallingMode
    return GenerationOptions(
        sampling: sampling == "greedy" ? .greedy : nil,
        temperature: temperature,
        maximumResponseTokens: maximumResponseTokens.map(Int.init)
    )
}