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.
114 lines
4.6 KiB
Swift
114 lines
4.6 KiB
Swift
//
|
|
// O11yO11yLLMObservation.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct O11yO11yLLMObservation: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** CompletionTokens is the output token count. */
|
|
public var completionTokens: Int64?
|
|
/** ID is the observation's id (the span id). */
|
|
public var id: String?
|
|
/** LatencyMs is how long it took, in milliseconds. */
|
|
public var latencyMs: Double?
|
|
/** Model is the model that served it. */
|
|
public var model: String?
|
|
/** Name is the observation's name. */
|
|
public var name: String?
|
|
/** ParentID is the parent observation, when the span has one. */
|
|
public var parentObservationId: String?
|
|
/** PromptTokens is the input token count. */
|
|
public var promptTokens: Int64?
|
|
/** Provider is the model's provider. */
|
|
public var provider: String?
|
|
/** ServiceName is the app that emitted it. */
|
|
public var serviceName: String?
|
|
/** SessionID is the conversation the observation belongs to. */
|
|
public var sessionId: String?
|
|
/** StartTime is when the observation started. */
|
|
public var startTime: Date?
|
|
/** StatusCode is the observation's status, e.g. OK, ERROR. */
|
|
public var statusCode: String?
|
|
/** TotalCost is the observation's cost. */
|
|
public var totalCost: Double?
|
|
/** TotalTokens is the sum of prompt and completion tokens. */
|
|
public var totalTokens: Int64?
|
|
/** TraceID is the trace the observation belongs to. */
|
|
public var traceId: String?
|
|
/** Type is the observation kind, e.g. chat, embeddings, tool. */
|
|
public var type: String?
|
|
/** UserID is the end user the observation is attributed to. */
|
|
public var userId: String?
|
|
|
|
public init(completionTokens: Int64? = nil, id: String? = nil, latencyMs: Double? = nil, model: String? = nil, name: String? = nil, parentObservationId: String? = nil, promptTokens: Int64? = nil, provider: String? = nil, serviceName: String? = nil, sessionId: String? = nil, startTime: Date? = nil, statusCode: String? = nil, totalCost: Double? = nil, totalTokens: Int64? = nil, traceId: String? = nil, type: String? = nil, userId: String? = nil) {
|
|
self.completionTokens = completionTokens
|
|
self.id = id
|
|
self.latencyMs = latencyMs
|
|
self.model = model
|
|
self.name = name
|
|
self.parentObservationId = parentObservationId
|
|
self.promptTokens = promptTokens
|
|
self.provider = provider
|
|
self.serviceName = serviceName
|
|
self.sessionId = sessionId
|
|
self.startTime = startTime
|
|
self.statusCode = statusCode
|
|
self.totalCost = totalCost
|
|
self.totalTokens = totalTokens
|
|
self.traceId = traceId
|
|
self.type = type
|
|
self.userId = userId
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case completionTokens
|
|
case id
|
|
case latencyMs
|
|
case model
|
|
case name
|
|
case parentObservationId
|
|
case promptTokens
|
|
case provider
|
|
case serviceName
|
|
case sessionId
|
|
case startTime
|
|
case statusCode
|
|
case totalCost
|
|
case totalTokens
|
|
case traceId
|
|
case type
|
|
case userId
|
|
}
|
|
|
|
// 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(id, forKey: .id)
|
|
try container.encodeIfPresent(latencyMs, forKey: .latencyMs)
|
|
try container.encodeIfPresent(model, forKey: .model)
|
|
try container.encodeIfPresent(name, forKey: .name)
|
|
try container.encodeIfPresent(parentObservationId, forKey: .parentObservationId)
|
|
try container.encodeIfPresent(promptTokens, forKey: .promptTokens)
|
|
try container.encodeIfPresent(provider, forKey: .provider)
|
|
try container.encodeIfPresent(serviceName, forKey: .serviceName)
|
|
try container.encodeIfPresent(sessionId, forKey: .sessionId)
|
|
try container.encodeIfPresent(startTime, forKey: .startTime)
|
|
try container.encodeIfPresent(statusCode, forKey: .statusCode)
|
|
try container.encodeIfPresent(totalCost, forKey: .totalCost)
|
|
try container.encodeIfPresent(totalTokens, forKey: .totalTokens)
|
|
try container.encodeIfPresent(traceId, forKey: .traceId)
|
|
try container.encodeIfPresent(type, forKey: .type)
|
|
try container.encodeIfPresent(userId, forKey: .userId)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension O11yO11yLLMObservation: Identifiable {}
|