pub struct CsvSourceConfig {
pub source_id: SourceId,
pub path: PathBuf,
pub anchor_column: Option<String>,
pub positive_column: Option<String>,
pub text_column: Option<String>,
pub trust: f32,
}Expand description
Configuration for a CSV-backed data source.
Two modes are supported:
-
Role mode —
anchor_columnis set (with an optionalpositive_column). Each row produces anAnchorsection fromanchor_columnand aContextsection frompositive_column(or the anchor text whenpositive_columnis absent). -
Text mode — only
text_columnis set. Each row produces both anAnchorand aContextsection from the same column (SimCSE-style).
anchor_column and text_column are mutually exclusive.
The CSV file must have a named header row. Columns are always looked up by name, so a header-free file cannot be used with this source.
Fields§
§source_id: SourceIdStable source identifier used in records and persistence keys.
path: PathBufPath to the CSV file.
anchor_column: Option<String>Column name for anchor text. Enables role mode when set.
Mutually exclusive with text_column.
positive_column: Option<String>Column name for positive/context text. Used with anchor_column.
When absent in role mode, the anchor text is reused as the context (identical-positive fallback, suitable for contrastive pre-training).
text_column: Option<String>Column name for single-text mode.
Mutually exclusive with anchor_column.
trust: f32Trust/quality score assigned to every record from this source.
Implementations§
Source§impl CsvSourceConfig
impl CsvSourceConfig
Sourcepub fn new(source_id: impl Into<SourceId>, path: impl Into<PathBuf>) -> Self
pub fn new(source_id: impl Into<SourceId>, path: impl Into<PathBuf>) -> Self
Create a config for a CSV source with the given identifier and path.
Sourcepub fn with_anchor_column(self, column: impl Into<String>) -> Self
pub fn with_anchor_column(self, column: impl Into<String>) -> Self
Set the column used as the anchor (enables role mode).
Sourcepub fn with_positive_column(self, column: impl Into<String>) -> Self
pub fn with_positive_column(self, column: impl Into<String>) -> Self
Set the column used as the positive/context (role mode only).
Sourcepub fn with_text_column(self, column: impl Into<String>) -> Self
pub fn with_text_column(self, column: impl Into<String>) -> Self
Set the column used as the single text field (enables text mode).
Sourcepub fn with_trust(self, trust: f32) -> Self
pub fn with_trust(self, trust: f32) -> Self
Override the default trust score.
Trait Implementations§
Source§impl Clone for CsvSourceConfig
impl Clone for CsvSourceConfig
Source§fn clone(&self) -> CsvSourceConfig
fn clone(&self) -> CsvSourceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CsvSourceConfig
impl RefUnwindSafe for CsvSourceConfig
impl Send for CsvSourceConfig
impl Sync for CsvSourceConfig
impl Unpin for CsvSourceConfig
impl UnsafeUnpin for CsvSourceConfig
impl UnwindSafe for CsvSourceConfig
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