Struct StepIo
pub struct StepIo { /* private fields */ }Expand description
How a tool call’s step reports its input and output: what is scrubbed first, and how much is kept.
use adam_llm_agent::{StepIo, REDACTED_MARKER};
// Scrub a value this process holds, and keep less than the contract allows.
let io = StepIo::default()
.redact(|text| text.replace("hunter2-hunter2", REDACTED_MARKER))
.output_max(2048);Implementations§
§impl StepIo
impl StepIo
pub fn off() -> StepIo
pub fn off() -> StepIo
Send neither the input nor the output of a call: its step is a label and a state, as it was before ADR 0011.
pub fn redact(
self,
redact: impl Fn(&str) -> String + Send + Sync + 'static,
) -> StepIo
pub fn redact( self, redact: impl Fn(&str) -> String + Send + Sync + 'static, ) -> StepIo
Scrub every string of a call’s arguments (and every key) and of its result with redact
before they are sent. It sees one string at a time and must return it with what is secret
replaced (by REDACTED_MARKER, say); it is called on every call of every
tool, so it should be
cheap, and it must not fail.
pub fn input_max(self, bytes: usize) -> StepIo
pub fn input_max(self, bytes: usize) -> StepIo
Keep at most bytes of a call’s input once serialized (default and ceiling:
[STEP_INPUT_MAX_BYTES]).
pub fn output_max(self, bytes: usize) -> StepIo
pub fn output_max(self, bytes: usize) -> StepIo
Keep at most bytes of a call’s output (default and ceiling: [STEP_OUTPUT_MAX_BYTES]).
pub fn shown_input(&self, arguments: &Value) -> Option<Map<String, Value>>
pub fn shown_input(&self, arguments: &Value) -> Option<Map<String, Value>>
What the report that starts a call’s step says of arguments: scrubbed by the redactor, then
cut to the contract’s bounds, exactly as StepEvent::input
carries it. None when a step would carry none (the switch is off, or the arguments are not
an object with a member). For a host that shows a call outside a step (ADR 0047 slice 5: the
call a person is asked to approve), so it shows no more than the step would.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StepIo
impl !UnwindSafe for StepIo
impl Freeze for StepIo
impl Send for StepIo
impl Sync for StepIo
impl Unpin for StepIo
impl UnsafeUnpin for StepIo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].