pub struct Trace { /* private fields */ }Expand description
A live LLM trace that collects spans.
Traces use interior mutability via Mutex so that spans can add themselves to the trace without requiring exclusive (&mut) access. This enables the ergonomic pattern:
ⓘ
let trace = client.start_trace("chat");
let mut span = Span::new(&trace, SpanType::Generation, "llm");
span.end(); // adds to trace internally
trace.end();Implementations§
Source§impl Trace
impl Trace
pub fn session_id(self, id: impl Into<String>) -> Self
pub fn user_id(self, id: impl Into<String>) -> Self
pub fn input_text(self, input: impl Into<String>) -> Self
pub fn prompt_name(self, name: impl Into<String>) -> Self
pub fn prompt_version(self, version: impl Into<String>) -> Self
pub fn set_output(&self, output: impl Into<String>)
pub fn set_status(&self, status: TraceStatus)
pub fn end(&self)
pub fn id(&self) -> &str
pub fn name(&self) -> &str
pub fn started_at(&self) -> i64
pub fn span_count(&self) -> usize
pub fn spans(&self) -> Vec<SpanData>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Trace
impl RefUnwindSafe for Trace
impl Send for Trace
impl Sync for Trace
impl Unpin for Trace
impl UnwindSafe for Trace
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