pub struct DataRecord {
pub id: RecordId,
pub source: SourceId,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub quality: QualityScore,
pub taxonomy: Vec<TaxonomyValue>,
pub sections: Vec<RecordSection>,
pub meta_prefix: Option<KvpPrefixSampler>,
}Expand description
Canonical record payload produced by a DataSource.
Fields§
§id: RecordIdStable record identifier (used for splits and determinism).
source: SourceIdSource identifier that produced this record.
created_at: DateTime<Utc>Canonical creation time for the record (used for ordering/metadata).
updated_at: DateTime<Utc>Last update time for the record (used for refresh decisions).
quality: QualityScoreTrust/quality score used to weight sampling.
taxonomy: Vec<TaxonomyValue>Free-form tags (e.g., source id, year, date) used for filtering/recipes.
sections: Vec<RecordSection>Structured content sections used by sampling recipes.
meta_prefix: Option<KvpPrefixSampler>Optional metadata prefix policy for KVP sampling (key-value headers injected into text).
Implementations§
Source§impl DataRecord
impl DataRecord
Sourcepub fn from_text(
id: impl Into<RecordId>,
source: impl Into<SourceId>,
text: impl Into<String>,
) -> Self
pub fn from_text( id: impl Into<RecordId>, source: impl Into<SourceId>, text: impl Into<String>, ) -> Self
Create a record with a single SectionRole::Context section from a plain text string.
The id and source are set to the same value. Use DataRecord::from_text_with_role
to assign a different role, or construct the struct directly for full control.
§Example
use triplets_core::DataRecord;
let record = DataRecord::from_text("doc-0", "my_corpus", "The quick brown fox.");
assert_eq!(record.id.as_str(), "doc-0");
assert_eq!(record.sections[0].text, "The quick brown fox.");Sourcepub fn from_text_with_role(
id: impl Into<RecordId>,
source: impl Into<SourceId>,
text: impl Into<String>,
role: SectionRole,
) -> Self
pub fn from_text_with_role( id: impl Into<RecordId>, source: impl Into<SourceId>, text: impl Into<String>, role: SectionRole, ) -> Self
Create a record with a single section of the given role from a plain text string.
§Example
use triplets_core::{DataRecord, SectionRole};
let record = DataRecord::from_text_with_role(
"doc-0", "my_corpus", "What is the capital of France?", SectionRole::Anchor,
);
assert_eq!(record.sections[0].role, SectionRole::Anchor);Trait Implementations§
Source§impl Clone for DataRecord
impl Clone for DataRecord
Source§fn clone(&self) -> DataRecord
fn clone(&self) -> DataRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DataRecord
impl Debug for DataRecord
Source§impl<'de> Deserialize<'de> for DataRecord
impl<'de> Deserialize<'de> for DataRecord
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>,
Auto Trait Implementations§
impl Freeze for DataRecord
impl RefUnwindSafe for DataRecord
impl Send for DataRecord
impl Sync for DataRecord
impl Unpin for DataRecord
impl UnsafeUnpin for DataRecord
impl UnwindSafe for DataRecord
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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