pub struct BriefingBudget { /* private fields */ }Expand description
How much of a workflow’s guidance reaches the model, per case.
§Why nothing is bounded by default
The right number depends on the context window of the model a deployment runs and on what else that deployment puts in a turn. A workflow knows neither, and neither does the library, so a shipped number would be a guess made once on behalf of everybody — and it would be a guess that silently deleted the end of a workflow’s guidance for anyone whose situation it did not fit. Nothing is bounded until a deployment says so, and there is no ceiling on what it may say: a limit an adopter cannot raise is not a configurable limit.
§Why cutting is right here and wrong elsewhere
This is the adopter’s own text on its way into a prompt, not a model’s answer on its way out to a user. Shortening what a deployment wrote costs the model some guidance and is visible in what was sent; shortening what a model wrote hands a person half a sentence. And the cut is marked, so a briefing that arrives as a prefix says so rather than reading as a complete rule that happens to be shorter.
Implementations§
Source§impl BriefingBudget
impl BriefingBudget
Sourcepub const fn conservative() -> Self
pub const fn conservative() -> Self
The default: no bound at all.
Sourcepub const fn max_bytes(self) -> Option<usize>
pub const fn max_bytes(self) -> Option<usize>
The bound in force, or None when the briefing is not bounded.
Sourcepub fn apply(self, text: &str) -> String
pub fn apply(self, text: &str) -> String
Cuts text to the budget, marking the cut. Returns it unchanged when
no budget is set, which is what ships.
The marker matters more than the limit. A model shown a prefix with no sign that it is one will follow half a rule as though it were the whole rule, which is worse than never having been told the rule.
Trait Implementations§
Source§impl Clone for BriefingBudget
impl Clone for BriefingBudget
impl Copy for BriefingBudget
Source§impl Debug for BriefingBudget
impl Debug for BriefingBudget
Source§impl Default for BriefingBudget
impl Default for BriefingBudget
Source§impl<'de> Deserialize<'de> for BriefingBudget
impl<'de> Deserialize<'de> for BriefingBudget
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>,
impl Eq for BriefingBudget
Source§impl PartialEq for BriefingBudget
impl PartialEq for BriefingBudget
Source§impl Serialize for BriefingBudget
impl Serialize for BriefingBudget
impl StructuralPartialEq for BriefingBudget
Auto Trait Implementations§
impl Freeze for BriefingBudget
impl RefUnwindSafe for BriefingBudget
impl Send for BriefingBudget
impl Sync for BriefingBudget
impl Unpin for BriefingBudget
impl UnsafeUnpin for BriefingBudget
impl UnwindSafe for BriefingBudget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.