@@ -780,18 +780,18 @@ public func generate(
780
780
/// Represents metadata and statistics related to token generation.
781
781
///
782
782
/// Provides information about the number of tokens processed during both the prompt and generation phases, as well as the time taken for each phase.
783
- public struct GenerateCompletionInfo {
783
+ public struct GenerateCompletionInfo : Sendable {
784
784
/// The number of tokens included in the input prompt.
785
- let promptTokenCount : Int
785
+ public let promptTokenCount : Int
786
786
787
787
/// The number of tokens generated by the language model.
788
- let generationTokenCount : Int
788
+ public let generationTokenCount : Int
789
789
790
790
/// The time interval (in seconds) taken to process the input prompt.
791
- let promptTime : TimeInterval
791
+ public let promptTime : TimeInterval
792
792
793
793
/// The time interval (in seconds) taken to generate the output tokens.
794
- let generationTime : TimeInterval
794
+ public let generationTime : TimeInterval
795
795
796
796
/// The number of tokens processed per second during the prompt phase.
797
797
public var promptTokensPerSecond : Double {
@@ -802,6 +802,18 @@ public struct GenerateCompletionInfo {
802
802
public var tokensPerSecond : Double {
803
803
Double ( generationTokenCount) / generationTime
804
804
}
805
+
806
+ public init (
807
+ promptTokenCount: Int ,
808
+ generationTokenCount: Int ,
809
+ promptTime: TimeInterval ,
810
+ generationTime: TimeInterval
811
+ ) {
812
+ self . promptTokenCount = promptTokenCount
813
+ self . generationTokenCount = generationTokenCount
814
+ self . promptTime = promptTime
815
+ self . generationTime = generationTime
816
+ }
805
817
}
806
818
807
819
/// Represents the different stages or outputs of the token generation process.
0 commit comments