Method AddSample
- Namespace
- LMKit.TextAnalysis.Training
- Assembly
- LM-Kit.NET.dll
AddSample(string, IEnumerable<EntityAnnotation>)
Adds a training sample from raw text content using the engine’s preferred modality.
public void AddSample(string content, IEnumerable<EntityAnnotation> annotations)
Parameters
contentstringThe textual content to analyze for PII/entities.
annotationsIEnumerable<EntityAnnotation>Ground-truth entity annotations (label + representative text) expected in
content.
Examples
dataset.AddSample(
"SSN: 123-45-6789",
new [] { new EntityAnnotation("US_SSN", "123-45-6789") });
Remarks
The content is wrapped as a text Attachment and
forwarded to AddSample(InferenceModality, Attachment, IEnumerable<EntityAnnotation>).
AddSample(Attachment, IEnumerable<EntityAnnotation>)
Adds a training sample from an Attachment using the engine’s preferred modality.
public void AddSample(Attachment content, IEnumerable<EntityAnnotation> annotations)
Parameters
contentAttachmentThe input attachment (e.g., text, image, or multimodal source) to analyze.
annotationsIEnumerable<EntityAnnotation>Ground-truth entity annotations (label + representative text) expected in
content.
Remarks
For text inputs, prefer CreateFromText(string, string). This overload delegates to AddSample(InferenceModality, Attachment, IEnumerable<EntityAnnotation>).
AddSample(InferenceModality, Attachment, IEnumerable<EntityAnnotation>)
Adds a training sample with an explicit InferenceModality.
public void AddSample(InferenceModality modality, Attachment content, IEnumerable<EntityAnnotation> annotations)
Parameters
modalityInferenceModalityThe inference modality to use for generating prompts and responses.
contentAttachmentThe content attachment to analyze.
annotationsIEnumerable<EntityAnnotation>Ground-truth entity annotations (label + representative text) expected in
content.
Examples
var attachment = Attachment.CreateFromText("Email: alice@example.com", "text");
var anns = new [] { new EntityAnnotation("EmailAddress", "alice@example.com") };
dataset.AddSample(InferenceModality.Text, attachment, anns);
Remarks
This method assembles a ShareGPT-style conversation from the configured prompts and
appends a ChatTrainingSample whose assistant response reflects the
provided annotations. When EnableModalityAugmentation is
true and modality is
Multimodal, additional samples are appended for
Text and Vision.