@@ -79,7 +79,7 @@ public struct GenerateParameters: Sendable {
7979 self . repetitionContextSize = repetitionContextSize
8080 }
8181
82- func sampler( ) -> LogitSampler {
82+ public func sampler( ) -> LogitSampler {
8383 if temperature == 0 {
8484 return ArgMaxSampler ( )
8585 } else if topP > 0 && topP < 1 {
@@ -89,7 +89,7 @@ public struct GenerateParameters: Sendable {
8989 }
9090 }
9191
92- func processor( ) -> LogitProcessor ? {
92+ public func processor( ) -> LogitProcessor ? {
9393 if let repetitionPenalty, repetitionContextSize > 0 {
9494 return RepetitionContext (
9595 repetitionPenalty: repetitionPenalty, repetitionContextSize: repetitionContextSize)
@@ -379,6 +379,26 @@ public struct TokenIterator: Sequence, IteratorProtocol {
379379
380380/// Result of a call to ``generate(input:parameters:context:didGenerate:)``.
381381public struct GenerateResult : Sendable {
382+
383+ /// Initializes a new `GenerateResult` instance.
384+ ///
385+ /// - Parameters:
386+ /// - inputText: The input text used for generation.
387+ /// - tokens: The array of tokens generated.
388+ /// - output: The generated output string.
389+ /// - promptTime: The time taken to prompt the input.
390+ /// - generateTime: The time taken to generate the output.
391+ public init (
392+ inputText: LMInput . Text , tokens: [ Int ] , output: String , promptTime: TimeInterval ,
393+ generateTime: TimeInterval
394+ ) {
395+ self . inputText = inputText
396+ self . tokens = tokens
397+ self . output = output
398+ self . promptTime = promptTime
399+ self . generateTime = generateTime
400+ }
401+
382402 /// input (prompt, images, etc.)
383403 public let inputText : LMInput . Text
384404
0 commit comments