Generated the JSON contracts of visual briefings and model answers at compile time (#1151)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-03 14:20:41 +01:00
1 parent 24e3c22db3
commit 770c16e20a
101 files changed
+2333 -392

No files matched your search

@@ -15,10 +15,12 @@ namespace AIStudio.Assistants.SWOTAnalysis;
/// </remarks>
internal static class SwotAnalysisModeration
{
private static readonly JsonSerializerOptions JSON_OPTIONS = new()
// Internal rather than private, so that a test can check the JSON the moderator gets:
internal static readonly JsonSerializerOptions JSON_OPTIONS = new JsonSerializerOptions
{
WriteIndented = true,
};
TypeInfoResolver = SwotModerationJsonContext.Default,
}.AsReadOnly();
public static string BuildSystemPrompt(string outputLanguageInstruction) =>
$"""
@@ -138,16 +140,9 @@ internal static class SwotAnalysisModeration
};
}
private static object CreateCategoryPayload(SwotCategoryAnalysisResult analysis, string factorIdPrefix) => new
{
empty_message = analysis.EmptyMessage,
findings = analysis.Findings.Select((finding, index) => new
{
factor_id = $"{factorIdPrefix}{index + 1}",
summary = finding.Summary,
explanation = finding.Explanation,
}),
};
private static SwotModerationCategoryInput CreateCategoryPayload(SwotCategoryAnalysisResult analysis, string factorIdPrefix) => new(
analysis.EmptyMessage,
[.. analysis.Findings.Select((finding, index) => new SwotModerationFindingInput($"{factorIdPrefix}{index + 1}", finding.Summary, finding.Explanation))]);
private static SwotCategory CreateCategory(SwotModeratedCategory category) => new()
{