#[non_exhaustive]pub struct UsageUpdate {
pub used: u64,
pub size: u64,
pub cost: Option<Cost>,
pub meta: Option<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: Option<Cost>Cumulative session cost (optional).
Omitted and null are equivalent and mean no cost is reported.
meta: Option<Map<String, Value>>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 make assumptions about values at these keys.
See protocol docs: Extensibility
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 IntoOption<Cost>) -> UsageUpdate
pub fn cost(self, cost: impl IntoOption<Cost>) -> UsageUpdate
Cumulative session cost (optional).
Sourcepub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> UsageUpdate
pub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> UsageUpdate
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
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