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.
41 lines
1.9 KiB
Swift
41 lines
1.9 KiB
Swift
//
|
|
// Provenance.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Provenance: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Backend is the leg that contributed this match: \"index\" (lexical), \"vector\" (semantic), \"code\" (the org's repositories) or \"rerank\" (the cross-encoder pass, whose Score is the relevance it assigned). It is the same name that leg reports itself under in Fusion.Backends, so a hit can be traced to a status. */
|
|
public var backend: String?
|
|
/** Rank is this document's 1-based position in THAT leg's own result list, before fusion — 1 is the leg's best hit. It is the only input to the fused score: RRF adds 1/(60+rank) per leg, which is why a document two legs ranked second beats one a single leg ranked first. */
|
|
public var rank: Int64?
|
|
/** Score is the leg's NATIVE score, on that leg's own scale, reported for explanation and never used in ranking — the scales are incomparable (a cosine similarity against a term-match count), which is why fusion works on ranks. The vector leg reports Qdrant's cosine similarity; the lexical leg exposes no per-row score and reports 0, meaning \"unscored\", not \"scored zero\". */
|
|
public var score: Double?
|
|
|
|
public init(backend: String? = nil, rank: Int64? = nil, score: Double? = nil) {
|
|
self.backend = backend
|
|
self.rank = rank
|
|
self.score = score
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case backend
|
|
case rank
|
|
case score
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(backend, forKey: .backend)
|
|
try container.encodeIfPresent(rank, forKey: .rank)
|
|
try container.encodeIfPresent(score, forKey: .score)
|
|
}
|
|
}
|
|
|