pub struct SpanBuilder {
pub span: SpanRecord,
}Fields§
§span: SpanRecordImplementations§
Source§impl SpanBuilder
impl SpanBuilder
pub fn new(kind: TraceWeftSpanKind, name: impl Into<String>) -> Self
pub fn provider(self, provider: impl Into<String>) -> Self
pub fn model(self, model: impl Into<String>) -> Self
pub fn prompt_version(self, version: impl Into<String>) -> Self
pub fn tool_name(self, tool: impl Into<String>) -> Self
pub fn input_ref(self, blob_ref: BlobRef) -> Self
pub fn output_ref(self, blob_ref: BlobRef) -> Self
pub fn token_usage(self, usage: TokenUsage) -> Self
pub fn cost(self, cost: CostEstimate) -> Self
pub fn cache_hit(self, hit: bool) -> Self
Sourcepub fn retrieval(
self,
query_hash: impl Into<String>,
doc_refs: Vec<BlobRef>,
) -> Self
pub fn retrieval( self, query_hash: impl Into<String>, doc_refs: Vec<BlobRef>, ) -> Self
Record a retrieval query hash and the documents it returned.
Sourcepub fn attribute(self, key: impl Into<String>, value: Value) -> Self
pub fn attribute(self, key: impl Into<String>, value: Value) -> Self
Insert a single free-form attribute.
Sourcepub fn attributes(self, attrs: HashMap<String, Value>) -> Self
pub fn attributes(self, attrs: HashMap<String, Value>) -> Self
Merge a map of free-form attributes into the span.
pub fn with_parent( self, trace_id: TraceId, run_id: RunId, parent_id: SpanId, ) -> Self
pub async fn wait_for_approval(self) -> Result<HitlResponse, String>
pub async fn run<F, Fut, T, E>(self, f: F) -> Result<T, E>
Sourcepub async fn run_infallible<F, Fut, T>(self, f: F) -> T
pub async fn run_infallible<F, Fut, T>(self, f: F) -> T
Like run but for closures that don’t return Result. The
span always completes with Ok status. Replay mocking (which is keyed on
deserializing a mocked value) applies only to run, not here.
Auto Trait Implementations§
impl Freeze for SpanBuilder
impl RefUnwindSafe for SpanBuilder
impl Send for SpanBuilder
impl Sync for SpanBuilder
impl Unpin for SpanBuilder
impl UnsafeUnpin for SpanBuilder
impl UnwindSafe for SpanBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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