mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 04:47:21 +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
@@ -19,10 +19,11 @@ public abstract class AgentBase(ILogger<AgentBase> logger, SettingsManager setti
|
||||
Time = DateTimeOffset.UtcNow,
|
||||
};
|
||||
|
||||
protected static readonly JsonSerializerOptions JSON_SERIALIZER_OPTIONS = new()
|
||||
internal static readonly JsonSerializerOptions JSON_SERIALIZER_OPTIONS = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
||||
};
|
||||
TypeInfoResolver = AgentJsonContext.Default,
|
||||
}.AsReadOnly();
|
||||
|
||||
protected DataSourceService DataSourceService { get; init; } = dataSourceService;
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using AIStudio.Agents.AssistantAudit;
|
||||
|
||||
namespace AIStudio.Agents;
|
||||
|
||||
/// <summary>
|
||||
/// The contracts with which System.Text.Json reads the answers of the agents, built at compile time.
|
||||
/// </summary>
|
||||
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata)]
|
||||
[JsonSerializable(typeof(List<SelectedDataSource>))]
|
||||
[JsonSerializable(typeof(RetrievalContextValidationResult))]
|
||||
[JsonSerializable(typeof(AssistantAuditResult))]
|
||||
internal sealed partial class AgentJsonContext : JsonSerializerContext;
|
||||
@@ -8,8 +8,8 @@ public sealed record AssistantAuditResult
|
||||
/// <summary>
|
||||
/// Gets the serialized audit level returned by the model before callers normalize it to <see cref="AssistantAuditLevel"/>.
|
||||
/// </summary>
|
||||
public string Level { get; init; } = string.Empty;
|
||||
public string Summary { get; init; } = string.Empty;
|
||||
public float Confidence { get; init; }
|
||||
public List<AssistantAuditFinding> Findings { get; init; } = [];
|
||||
public string Level { get; set; } = string.Empty;
|
||||
public string Summary { get; set; } = string.Empty;
|
||||
public float Confidence { get; set; }
|
||||
public List<AssistantAuditFinding> Findings { get; set; } = [];
|
||||
}
|
||||
Reference in new issue
Block a user