mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 06:08:19 +00:00
Generated the JSON contracts of visual briefings and model answers at compile time (#1151)
This commit is contained in:
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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user