#[non_exhaustive]pub struct UsageUpdate {
pub used: u64,
pub size: u64,
pub cost: MaybeUndefined<Cost>,
pub meta: MaybeUndefined<Map<String, Value>>,
}unstable_protocol_v2 only.Expand description
Context window and cost update for a session.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.used: u64Tokens currently in context.
size: u64Total context window size in tokens.
cost: MaybeUndefined<Cost>Cumulative session cost.
Omitted leaves the last reported cost unchanged. null clears it. A value replaces it.
meta: MaybeUndefined<Map<String, Value>>The _meta property is reserved by ACP to allow Clients and Agents to attach additional
metadata to their interactions. Omitted leaves the stored metadata unchanged. null
clears it. An object patches the stored metadata by top-level key: keys it omits are
unchanged, a key set to null is removed, and any other value replaces that key’s
stored value without merging nested objects. Beyond this patch rule, implementations
MUST NOT assign meaning to keys they do not recognize.
See protocol docs: Metadata Patches
Implementations§
Source§impl UsageUpdate
impl UsageUpdate
Sourcepub fn new(used: u64, size: u64) -> UsageUpdate
pub fn new(used: u64, size: u64) -> UsageUpdate
Builds UsageUpdate with the required fields set. Optional fields start unset or empty.
Sourcepub fn cost(self, cost: impl IntoMaybeUndefined<Cost>) -> UsageUpdate
pub fn cost(self, cost: impl IntoMaybeUndefined<Cost>) -> UsageUpdate
Sets, clears, or leaves unchanged the cumulative session cost.
Sourcepub fn meta(
self,
meta: impl IntoMaybeUndefined<Map<String, Value>>,
) -> UsageUpdate
pub fn meta( self, meta: impl IntoMaybeUndefined<Map<String, Value>>, ) -> UsageUpdate
Patches, clears, or leaves unchanged usage metadata.
A concrete object patches stored metadata by top-level key. See
apply_meta_update.
Trait Implementations§
Source§impl Clone for UsageUpdate
impl Clone for UsageUpdate
Source§fn clone(&self) -> UsageUpdate
fn clone(&self) -> UsageUpdate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UsageUpdate
impl Debug for UsageUpdate
Source§impl<'de> Deserialize<'de> for UsageUpdate
impl<'de> Deserialize<'de> for UsageUpdate
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<UsageUpdate, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<UsageUpdate, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for UsageUpdate
impl JsonSchema for UsageUpdate
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more