mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The projection these were generated from predated the compute migration, so they described /v1/visor — which the API serves at zero paths now. No /v1/visor path survives here.
96 lines
3.5 KiB
Swift
96 lines
3.5 KiB
Swift
//
|
|
// ModelStat.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct ModelStat: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** tokens it answered with */
|
|
public var completionTokens: Int64?
|
|
/** what this model cost, in cents */
|
|
public var costCents: Int64?
|
|
/** share of total spend, 0..100 */
|
|
public var costPct: Double?
|
|
/** share of its calls that failed, 0..1 */
|
|
public var errorRate: Double?
|
|
/** calls to it that did not succeed */
|
|
public var errors: Int64?
|
|
/** the model this row is about, or \"other\" for the fold */
|
|
public var model: String?
|
|
/** >0 only on the \"other\" fold */
|
|
public var modelCount: Int64?
|
|
/** median latency, null when no spans carry it */
|
|
public var p50Ms: Double?
|
|
/** 95th-percentile latency, null when unknown */
|
|
public var p95Ms: Double?
|
|
/** 99th-percentile latency, null when unknown */
|
|
public var p99Ms: Double?
|
|
/** tokens sent to it */
|
|
public var promptTokens: Int64?
|
|
/** who serves it */
|
|
public var provider: String?
|
|
/** calls to this model in the window */
|
|
public var requests: Int64?
|
|
/** prompt plus completion */
|
|
public var totalTokens: Int64?
|
|
|
|
public init(completionTokens: Int64? = nil, costCents: Int64? = nil, costPct: Double? = nil, errorRate: Double? = nil, errors: Int64? = nil, model: String? = nil, modelCount: Int64? = nil, p50Ms: Double? = nil, p95Ms: Double? = nil, p99Ms: Double? = nil, promptTokens: Int64? = nil, provider: String? = nil, requests: Int64? = nil, totalTokens: Int64? = nil) {
|
|
self.completionTokens = completionTokens
|
|
self.costCents = costCents
|
|
self.costPct = costPct
|
|
self.errorRate = errorRate
|
|
self.errors = errors
|
|
self.model = model
|
|
self.modelCount = modelCount
|
|
self.p50Ms = p50Ms
|
|
self.p95Ms = p95Ms
|
|
self.p99Ms = p99Ms
|
|
self.promptTokens = promptTokens
|
|
self.provider = provider
|
|
self.requests = requests
|
|
self.totalTokens = totalTokens
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case completionTokens
|
|
case costCents
|
|
case costPct
|
|
case errorRate
|
|
case errors
|
|
case model
|
|
case modelCount
|
|
case p50Ms
|
|
case p95Ms
|
|
case p99Ms
|
|
case promptTokens
|
|
case provider
|
|
case requests
|
|
case totalTokens
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(completionTokens, forKey: .completionTokens)
|
|
try container.encodeIfPresent(costCents, forKey: .costCents)
|
|
try container.encodeIfPresent(costPct, forKey: .costPct)
|
|
try container.encodeIfPresent(errorRate, forKey: .errorRate)
|
|
try container.encodeIfPresent(errors, forKey: .errors)
|
|
try container.encodeIfPresent(model, forKey: .model)
|
|
try container.encodeIfPresent(modelCount, forKey: .modelCount)
|
|
try container.encodeIfPresent(p50Ms, forKey: .p50Ms)
|
|
try container.encodeIfPresent(p95Ms, forKey: .p95Ms)
|
|
try container.encodeIfPresent(p99Ms, forKey: .p99Ms)
|
|
try container.encodeIfPresent(promptTokens, forKey: .promptTokens)
|
|
try container.encodeIfPresent(provider, forKey: .provider)
|
|
try container.encodeIfPresent(requests, forKey: .requests)
|
|
try container.encodeIfPresent(totalTokens, forKey: .totalTokens)
|
|
}
|
|
}
|
|
|