pub struct Tap { /* private fields */ }Expand description
Records LLM SDK HTTP traffic with redaction.
Tap is Clone (cheap; it shares an inner store via Arc<Mutex<...>>).
Implementations§
Source§impl Tap
impl Tap
Sourcepub fn with_capacity(history_size: usize) -> Self
pub fn with_capacity(history_size: usize) -> Self
Construct with a custom history capacity.
Sourcepub fn with_redactor(self, r: Redactor) -> Self
pub fn with_redactor(self, r: Redactor) -> Self
Override the redactor.
Sourcepub fn last(&self) -> Option<TappedCall>
pub fn last(&self) -> Option<TappedCall>
Most recent call, if any.
Sourcepub fn all(&self) -> Vec<TappedCall>
pub fn all(&self) -> Vec<TappedCall>
All recorded calls, oldest first.
Sourcepub fn record<HR, HS>(
&self,
method: impl Into<String>,
url: impl Into<String>,
request_headers: HR,
request_body: Option<Value>,
response_status: u16,
response_headers: HS,
response_body: Option<Value>,
elapsed_ms: u64,
) -> TappedCall
pub fn record<HR, HS>( &self, method: impl Into<String>, url: impl Into<String>, request_headers: HR, request_body: Option<Value>, response_status: u16, response_headers: HS, response_body: Option<Value>, elapsed_ms: u64, ) -> TappedCall
Record a request/response pair.
request_body and response_body can be None if absent. Strings
containing valid JSON will be parsed; other strings are stored as
Value::String.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tap
impl !RefUnwindSafe for Tap
impl Send for Tap
impl Sync for Tap
impl Unpin for Tap
impl UnsafeUnpin for Tap
impl !UnwindSafe for Tap
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