pub struct TrainingExample {
pub id: Uuid,
pub context_embeddings: Vec<Vec<f32>>,
pub message_embedding: Vec<f32>,
pub labels: IntentLabels,
pub metadata: ExampleMetadata,
}Expand description
A single training example for intent classification
Contains the input embeddings, soft labels from teacher, and metadata for traceability and debugging.
Fields§
§id: UuidUnique identifier for this example
context_embeddings: Vec<Vec<f32>>Context embeddings from the last N messages
Each inner Vec represents an embedding vector for one message. Order: oldest to newest (chronological).
message_embedding: Vec<f32>Embedding of the current message to classify
labels: IntentLabelsSoft labels from teacher model
metadata: ExampleMetadataMetadata about this example
Implementations§
Source§impl TrainingExample
impl TrainingExample
Sourcepub fn new(
context_embeddings: Vec<Vec<f32>>,
message_embedding: Vec<f32>,
labels: IntentLabels,
) -> Self
pub fn new( context_embeddings: Vec<Vec<f32>>, message_embedding: Vec<f32>, labels: IntentLabels, ) -> Self
Create a new training example with minimal metadata
Sourcepub fn with_id(
id: Uuid,
context_embeddings: Vec<Vec<f32>>,
message_embedding: Vec<f32>,
labels: IntentLabels,
) -> Self
pub fn with_id( id: Uuid, context_embeddings: Vec<Vec<f32>>, message_embedding: Vec<f32>, labels: IntentLabels, ) -> Self
Create a new training example with specific ID
Sourcepub fn with_metadata(self, metadata: ExampleMetadata) -> Self
pub fn with_metadata(self, metadata: ExampleMetadata) -> Self
Set metadata for this example
Sourcepub fn embedding_dim(&self) -> usize
pub fn embedding_dim(&self) -> usize
Get the embedding dimension (from message embedding)
Sourcepub fn context_size(&self) -> usize
pub fn context_size(&self) -> usize
Get the context window size (number of context messages)
Sourcepub fn dominant_intent(&self) -> (&'static str, f32)
pub fn dominant_intent(&self) -> (&'static str, f32)
Get the dominant intent (highest probability label)
Trait Implementations§
Source§impl Clone for TrainingExample
impl Clone for TrainingExample
Source§fn clone(&self) -> TrainingExample
fn clone(&self) -> TrainingExample
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TrainingExample
impl Debug for TrainingExample
Source§impl<'de> Deserialize<'de> for TrainingExample
impl<'de> Deserialize<'de> for TrainingExample
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 TrainingExample
impl RefUnwindSafe for TrainingExample
impl Send for TrainingExample
impl Sync for TrainingExample
impl Unpin for TrainingExample
impl UnsafeUnpin for TrainingExample
impl UnwindSafe for TrainingExample
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