#[non_exhaustive]pub struct UsageUpdate {
pub used: u64,
pub size: u64,
pub cost: MaybeUndefined<Cost>,
pub meta: Option<Meta>,
}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: Option<Meta>The _meta property is reserved by ACP to allow clients and agents to attach additional
metadata to their interactions. Omitted and null are equivalent and mean no metadata.
Implementations MUST NOT assign meaning to keys they do not recognize.
See protocol docs: Extensibility
Implementations§
Source§impl UsageUpdate
impl UsageUpdate
Sourcepub fn new(used: u64, size: u64) -> Self
pub fn new(used: u64, size: u64) -> Self
Builds UsageUpdate with the required fields set; optional fields start unset or empty.
Sourcepub fn cost(self, cost: impl IntoMaybeUndefined<Cost>) -> Self
pub fn cost(self, cost: impl IntoMaybeUndefined<Cost>) -> Self
Sets, clears, or leaves unchanged the cumulative session cost.
Sourcepub fn meta(self, meta: impl IntoOption<Meta>) -> Self
pub fn meta(self, meta: impl IntoOption<Meta>) -> Self
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT assign meaning to keys they do not recognize.
See protocol docs: Extensibility
Trait Implementations§
Source§impl Clone for UsageUpdate
impl Clone for UsageUpdate
Source§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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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