pub struct ContextQueryResult {
pub frames: Vec<ContextFrame>,
pub truncated: bool,
pub dropped_estimate: Option<u32>,
}Expand description
The response to a context/query call.
Fields§
§frames: Vec<ContextFrame>§truncated: boolTrue if the provider had more candidates than fit the budget.
dropped_estimate: Option<u32>Implementations§
Source§impl ContextQueryResult
impl ContextQueryResult
Sourcepub fn total_token_cost(&self) -> u64
pub fn total_token_cost(&self) -> u64
Sum of token_cost across returned frames — must never exceed the
query’s max_tokens for a conforming provider (checked in
contextgraph-conformance, phase 3; this is the cheap client-side sanity
check any host can run today).
pub fn respects_budget(&self, max_tokens: u32) -> bool
Sourcepub fn respects_frame_limit(&self, max_frames: u32) -> bool
pub fn respects_frame_limit(&self, max_frames: u32) -> bool
Whether the provider honored the query’s max_frames cap
(SPEC.md §B4).
max_frames was part of the query contract from the beginning and was
audited by nothing: a provider returning ten thousand one-token frames
against max_frames: 8 passed every check. Frame count is a real cost
— each frame carries a title, a citation label, and rendering chrome the
token budget does not capture.
Sourcepub fn frames_with_dishonest_cost(&self) -> Vec<&str>
pub fn frames_with_dishonest_cost(&self) -> Vec<&str>
Frames whose declared token_cost does not match the canonical count
for their content (SPEC.md §B3).
Returns ids so a host’s audit report can name the offending frames rather than only the provider.
Sourcepub fn canonical_token_cost(&self) -> u64
pub fn canonical_token_cost(&self) -> u64
The sum of the canonical costs of the returned frames — what the provider’s frames actually cost, as opposed to what it claimed.
Trait Implementations§
Source§impl Clone for ContextQueryResult
impl Clone for ContextQueryResult
Source§fn clone(&self) -> ContextQueryResult
fn clone(&self) -> ContextQueryResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more