ExperimentJsonArtifactWriter
NexusLabs.Foundry.Evaluation¶
NexusLabs.Foundry.Evaluation.Experiments¶
ExperimentJsonArtifactWriter Class¶
Writes the schema-versioned deterministic Foundry experiment JSON envelope.
Inheritance System.Object 🡒 ExperimentJsonArtifactWriter
Remarks¶
Foundry-owned properties and collections use fixed ordering. Caller-owned case and output payload schemas remain caller responsibility. This writer does not claim RFC 8785 cryptographic canonicalization.
Constructors¶
ExperimentJsonArtifactWriter() Constructor¶
Initializes an experiment artifact writer that indents JSON output.
ExperimentJsonArtifactWriter(bool) Constructor¶
Initializes an experiment artifact writer with the specified indentation behavior.
Parameters¶
writeIndented System.Boolean
Whether to indent the JSON output.
Methods¶
ExperimentJsonArtifactWriter.Serialize<TCase,TOutput>(ExperimentRunOutcome<TCase,TOutput>) Method¶
Serializes an experiment outcome using reflection-based caller payload serialization.
public string Serialize<TCase,TOutput>(NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput> outcome);
Type parameters¶
TCase
The caller-owned case value type.
TOutput
The caller-owned output type.
Parameters¶
outcome NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput>
The canonical experiment outcome.
Returns¶
System.String
The JSON artifact.
ExperimentJsonArtifactWriter.Serialize<TCase,TOutput>(ExperimentRunOutcome<TCase,TOutput>, JsonSerializerOptions) Method¶
Serializes an experiment outcome using reflection-based caller payload serialization and the specified payload serializer options.
public string Serialize<TCase,TOutput>(NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput> outcome, System.Text.Json.JsonSerializerOptions? payloadSerializerOptions);
Type parameters¶
TCase
The caller-owned case value type.
TOutput
The caller-owned output type.
Parameters¶
outcome NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput>
The canonical experiment outcome.
payloadSerializerOptions System.Text.Json.JsonSerializerOptions
Serializer options applied only to caller-owned case and output values. A null value uses System.Text.Json.JsonSerializerOptions.Default.
Returns¶
System.String
The JSON artifact.
ExperimentJsonArtifactWriter.Serialize<TCase,TOutput>(ExperimentRunOutcome<TCase,TOutput>, JsonTypeInfo<TCase>, JsonTypeInfo<TOutput>) Method¶
Serializes an experiment outcome using caller-provided serialization metadata for AOT-safe case and output payloads.
public string Serialize<TCase,TOutput>(NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput> outcome, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TCase> caseTypeInfo, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TOutput> outputTypeInfo);
Type parameters¶
TCase
The caller-owned case value type.
TOutput
The caller-owned output type.
Parameters¶
outcome NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput>
The canonical experiment outcome.
caseTypeInfo System.Text.Json.Serialization.Metadata.JsonTypeInfo<TCase>
Serialization metadata for TCase.
outputTypeInfo System.Text.Json.Serialization.Metadata.JsonTypeInfo<TOutput>
Serialization metadata for TOutput.
Returns¶
System.String
The JSON artifact.
ExperimentJsonArtifactWriter.WriteAsync<TCase,TOutput>(Stream, ExperimentRunOutcome<TCase,TOutput>) Method¶
Writes an experiment outcome using reflection-based caller payload serialization.
public System.Threading.Tasks.Task WriteAsync<TCase,TOutput>(System.IO.Stream destination, NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput> outcome);
Type parameters¶
TCase
The caller-owned case value type.
TOutput
The caller-owned output type.
Parameters¶
destination System.IO.Stream
The destination stream, which remains open.
outcome NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput>
The canonical experiment outcome.
Returns¶
System.Threading.Tasks.Task
A task that completes after the artifact is flushed.
ExperimentJsonArtifactWriter.WriteAsync<TCase,TOutput>(Stream, ExperimentRunOutcome<TCase,TOutput>, JsonSerializerOptions, CancellationToken) Method¶
Writes an experiment outcome using reflection-based caller payload serialization, the specified payload serializer options, and caller cancellation.
public System.Threading.Tasks.Task WriteAsync<TCase,TOutput>(System.IO.Stream destination, NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput> outcome, System.Text.Json.JsonSerializerOptions? payloadSerializerOptions, System.Threading.CancellationToken cancellationToken);
Type parameters¶
TCase
The caller-owned case value type.
TOutput
The caller-owned output type.
Parameters¶
destination System.IO.Stream
The destination stream, which remains open.
outcome NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput>
The canonical experiment outcome.
payloadSerializerOptions System.Text.Json.JsonSerializerOptions
Serializer options applied only to caller-owned case and output values. A null value uses System.Text.Json.JsonSerializerOptions.Default.
cancellationToken System.Threading.CancellationToken
A cancellation token.
Returns¶
System.Threading.Tasks.Task
A task that completes after the artifact is flushed.
ExperimentJsonArtifactWriter.WriteAsync<TCase,TOutput>(Stream, ExperimentRunOutcome<TCase,TOutput>, JsonTypeInfo<TCase>, JsonTypeInfo<TOutput>, CancellationToken) Method¶
Writes an experiment outcome using caller-provided serialization metadata for AOT-safe case and output payloads with caller cancellation.
public System.Threading.Tasks.Task WriteAsync<TCase,TOutput>(System.IO.Stream destination, NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput> outcome, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TCase> caseTypeInfo, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TOutput> outputTypeInfo, System.Threading.CancellationToken cancellationToken);
Type parameters¶
TCase
The caller-owned case value type.
TOutput
The caller-owned output type.
Parameters¶
destination System.IO.Stream
The destination stream, which remains open.
outcome NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput>
The canonical experiment outcome.
caseTypeInfo System.Text.Json.Serialization.Metadata.JsonTypeInfo<TCase>
Serialization metadata for TCase.
outputTypeInfo System.Text.Json.Serialization.Metadata.JsonTypeInfo<TOutput>
Serialization metadata for TOutput.
cancellationToken System.Threading.CancellationToken
A cancellation token.
Returns¶
System.Threading.Tasks.Task
A task that completes after the artifact is flushed.
ExperimentJsonArtifactWriter.WriteAsync<TCase,TOutput>(Stream, ExperimentRunOutcome<TCase,TOutput>, CancellationToken) Method¶
Writes an experiment outcome using reflection-based caller payload serialization with caller cancellation.
public System.Threading.Tasks.Task WriteAsync<TCase,TOutput>(System.IO.Stream destination, NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput> outcome, System.Threading.CancellationToken cancellationToken);
Type parameters¶
TCase
The caller-owned case value type.
TOutput
The caller-owned output type.
Parameters¶
destination System.IO.Stream
The destination stream, which remains open.
outcome NexusLabs.Foundry.Evaluation.Experiments.ExperimentRunOutcome<TCase,TOutput>
The canonical experiment outcome.
cancellationToken System.Threading.CancellationToken
A cancellation token.
Returns¶
System.Threading.Tasks.Task
A task that completes after the artifact is flushed.