LlmSpanBuilder

Struct LlmSpanBuilder 

Source
pub struct LlmSpanBuilder { /* private fields */ }
Expand description

Builder for creating LlmSpan instances.

Implementations§

Source§

impl LlmSpanBuilder

Source

pub fn span_id(self, id: impl Into<SpanId>) -> Self

Set span ID.

Source

pub fn trace_id(self, id: impl Into<TraceId>) -> Self

Set trace ID.

Source

pub fn parent_span_id(self, id: impl Into<SpanId>) -> Self

Set parent span ID.

Source

pub fn name(self, name: impl Into<String>) -> Self

Set span name.

Source

pub fn provider(self, provider: Provider) -> Self

Set provider.

Source

pub fn model(self, model: impl Into<String>) -> Self

Set model name.

Source

pub fn input(self, input: LlmInput) -> Self

Set input.

Source

pub fn output(self, output: LlmOutput) -> Self

Set output.

Source

pub fn token_usage(self, usage: TokenUsage) -> Self

Set token usage.

Source

pub fn cost(self, cost: Cost) -> Self

Set cost.

Source

pub fn latency(self, latency: Latency) -> Self

Set latency.

Source

pub fn metadata(self, metadata: Metadata) -> Self

Set metadata.

Source

pub fn status(self, status: SpanStatus) -> Self

Set status.

Source

pub fn attribute(self, key: impl Into<String>, value: Value) -> Self

Add an attribute.

Source

pub fn event(self, event: SpanEvent) -> Self

Add an event.

Source

pub fn build(self) -> Result<LlmSpan, &'static str>

Build the LlmSpan.

Trait Implementations§

Source§

impl Default for LlmSpanBuilder

Source§

fn default() -> LlmSpanBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.