pub struct SystemPromptSource { /* private fields */ }Expand description
A Source that emits a fixed system-prompt string every turn.
Critical-priority, marked non-redactable so governance can’t quietly
rewrite the system prompt. The tokenizer hint defaults to
text.len() / 4; override with Self::with_estimated_tokens when you
have a tighter number from your tokenizer.
Implementations§
Source§impl SystemPromptSource
impl SystemPromptSource
Sourcepub fn new(text: impl Into<String>) -> Self
pub fn new(text: impl Into<String>) -> Self
Construct a source with the default ID "system_prompt".
Sourcepub fn with_id(self, id: impl Into<SourceId>) -> Self
pub fn with_id(self, id: impl Into<SourceId>) -> Self
Override the default SourceId (useful when wiring multiple system
prompts — e.g. a base prompt plus a user-specific personality layer —
and you want them attributed separately in the receipt).
Sourcepub fn with_estimated_tokens(self, tokens: usize) -> Self
pub fn with_estimated_tokens(self, tokens: usize) -> Self
Override the source-side token estimate. The builder always re-tokenizes ground-truth, so this is a hint only.
Trait Implementations§
Source§impl Clone for SystemPromptSource
impl Clone for SystemPromptSource
Source§fn clone(&self) -> SystemPromptSource
fn clone(&self) -> SystemPromptSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SystemPromptSource
impl Debug for SystemPromptSource
Source§impl Source for SystemPromptSource
impl Source for SystemPromptSource
Source§fn id(&self) -> SourceId
fn id(&self) -> SourceId
Stable identifier for this source. Receipts and message attribution
key off this value.
Source§fn contribute<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 BriefContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contribution>, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn contribute<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 BriefContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contribution>, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Produce zero or more
Contributions for this turn.Auto Trait Implementations§
impl Freeze for SystemPromptSource
impl RefUnwindSafe for SystemPromptSource
impl Send for SystemPromptSource
impl Sync for SystemPromptSource
impl Unpin for SystemPromptSource
impl UnsafeUnpin for SystemPromptSource
impl UnwindSafe for SystemPromptSource
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
Mutably borrows from an owned value. Read more