mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The forge tree held the package scaffolding and none of the generated sources — 2,435 files of APIs, Models and Infrastructure, including BaseAPI, were simply absent, so anything depending on this copy had a package that compiled to nothing usable. Generated from the current API document rather than reconciled with the other copy: a client is a function of the spec, so regenerating answers "which history wins" without anyone having to choose. .spec-lock records which document, so the next reader can tell.
46 lines
1.8 KiB
Swift
46 lines
1.8 KiB
Swift
//
|
|
// AskAnswer.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct AskAnswer: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Answer is the synthesized prose. EMPTY is a real answer here: nothing in the index matched, or synthesis was unavailable — read `degraded` and `citations` to tell those apart. It is never written without grounding. */
|
|
public var answer: String?
|
|
/** Citations are the exact regions the answer was grounded on, and they are the point: an answer is checkable only because every claim in it can be read back at a file and line. Present even when Answer is empty. */
|
|
public var citations: [Citation]?
|
|
/** Degraded is true when retrieval worked but no synthesizer was reachable. The citations are still real code, so a caller can answer from them itself; a caller that treats this like an error throws away a usable result. */
|
|
public var degraded: Bool?
|
|
/** Question is the ask, echoed back. */
|
|
public var question: String?
|
|
|
|
public init(answer: String? = nil, citations: [Citation]? = nil, degraded: Bool? = nil, question: String? = nil) {
|
|
self.answer = answer
|
|
self.citations = citations
|
|
self.degraded = degraded
|
|
self.question = question
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case answer
|
|
case citations
|
|
case degraded
|
|
case question
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(answer, forKey: .answer)
|
|
try container.encodeIfPresent(citations, forKey: .citations)
|
|
try container.encodeIfPresent(degraded, forKey: .degraded)
|
|
try container.encodeIfPresent(question, forKey: .question)
|
|
}
|
|
}
|
|
|