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.
51 lines
2.1 KiB
Swift
51 lines
2.1 KiB
Swift
//
|
|
// ContextBundle.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct ContextBundle: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** BudgetTokens is the ceiling the caller asked for. Packing stops under it, so this is a bound and not a target. */
|
|
public var budgetTokens: Int64?
|
|
/** Query is the ask this bundle was packed for, echoed back so a cached or forwarded bundle still says what it answers. */
|
|
public var query: String?
|
|
/** Repo narrows the retrieval to one repository. Absent means every indexed repo was searched. */
|
|
public var repo: String?
|
|
/** Spans are the packed chunks, most relevant first, each expanded with the definitions it calls and its notable callers. The top match is always present even if it had to be truncated to fit, so a matched query never comes back with nothing. */
|
|
public var spans: [Span]?
|
|
/** UsedTokens is what the returned spans actually cost, by the same estimate the packer used (roughly one token per four characters — an estimate, not a tokenizer's count, so size a real window with headroom). */
|
|
public var usedTokens: Int64?
|
|
|
|
public init(budgetTokens: Int64? = nil, query: String? = nil, repo: String? = nil, spans: [Span]? = nil, usedTokens: Int64? = nil) {
|
|
self.budgetTokens = budgetTokens
|
|
self.query = query
|
|
self.repo = repo
|
|
self.spans = spans
|
|
self.usedTokens = usedTokens
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case budgetTokens
|
|
case query
|
|
case repo
|
|
case spans
|
|
case usedTokens
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(budgetTokens, forKey: .budgetTokens)
|
|
try container.encodeIfPresent(query, forKey: .query)
|
|
try container.encodeIfPresent(repo, forKey: .repo)
|
|
try container.encodeIfPresent(spans, forKey: .spans)
|
|
try container.encodeIfPresent(usedTokens, forKey: .usedTokens)
|
|
}
|
|
}
|
|
|