pub struct RunTree {Show 14 fields
pub id: Uuid,
pub name: String,
pub run_type: RunType,
pub inputs: Value,
pub outputs: Option<Value>,
pub error: Option<String>,
pub parent_run_id: Option<Uuid>,
pub trace_id: Option<Uuid>,
pub start_time: DateTime<Utc>,
pub end_time: Option<DateTime<Utc>>,
pub metadata: HashMap<String, Value>,
pub tags: Vec<String>,
pub project_name: Option<String>,
pub serialized: Value,
}Expand description
Run tree node for tracing
Each run is a node in a tree, with optional parent and children. The entire trace forms a tree structure, with the root being the top-level call.
Fields§
§id: UuidUnique run ID (UUID v7 with timestamp)
name: StringRun name
run_type: RunTypeRun type
inputs: ValueInput data
outputs: Option<Value>Output data (set when run ends)
error: Option<String>Error message (if run failed)
parent_run_id: Option<Uuid>Parent run ID
trace_id: Option<Uuid>Trace ID (ID of the root run)
start_time: DateTime<Utc>Start time
end_time: Option<DateTime<Utc>>End time
metadata: HashMap<String, Value>Metadata
Tags
project_name: Option<String>Project name (LangSmith project)
serialized: ValueSerialized representation of the component
Implementations§
Source§impl RunTree
impl RunTree
Sourcepub fn create_child(
&self,
name: impl Into<String>,
run_type: RunType,
inputs: Value,
) -> Self
pub fn create_child( &self, name: impl Into<String>, run_type: RunType, inputs: Value, ) -> Self
Create a child run from this run
Sourcepub fn end_with_error(&mut self, error: impl Into<String>)
pub fn end_with_error(&mut self, error: impl Into<String>)
End the run with an error
Sourcepub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
pub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
Add metadata
Sourcepub fn with_project(self, project: impl Into<String>) -> Self
pub fn with_project(self, project: impl Into<String>) -> Self
Set project name
Sourcepub fn duration_ms(&self) -> Option<i64>
pub fn duration_ms(&self) -> Option<i64>
Calculate run duration in milliseconds
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RunTree
impl<'de> Deserialize<'de> for RunTree
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RunTree
impl RefUnwindSafe for RunTree
impl Send for RunTree
impl Sync for RunTree
impl Unpin for RunTree
impl UnsafeUnpin for RunTree
impl UnwindSafe for RunTree
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