mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 09:27:21 +00:00
Generated the JSON contracts of the model answers and the Assistant Builder at compile time
This commit is contained in:
21 files changed
+150
-18
No files matched your search
@@ -0,0 +1,14 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace AIStudio.Tools.Services;
|
||||
|
||||
/// <summary>
|
||||
/// The contracts with which System.Text.Json writes what the Assistant Builder hands to its models, built at compile
|
||||
/// time.
|
||||
/// </summary>
|
||||
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata)]
|
||||
[JsonSerializable(typeof(AssistantBuilderDraftPromptData))]
|
||||
[JsonSerializable(typeof(AssistantBuilderGenerationPromptData))]
|
||||
[JsonSerializable(typeof(AssistantBuilderLauncherPromptData))]
|
||||
[JsonSerializable(typeof(AssistantBuilderRevisionPromptData))]
|
||||
internal sealed partial class AssistantBuilderPromptJsonContext : JsonSerializerContext;
|
||||
@@ -19,11 +19,12 @@ public sealed class AssistantPluginGenerationService(ToolRegistry toolRegistry,
|
||||
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(AssistantPluginGenerationService).Namespace, nameof(AssistantPluginGenerationService));
|
||||
|
||||
// Internal rather than private, so that a test can check the JSON the models get:
|
||||
internal static readonly JsonSerializerOptions UNTRUSTED_PROMPT_JSON_OPTIONS = new()
|
||||
internal static readonly JsonSerializerOptions UNTRUSTED_PROMPT_JSON_OPTIONS = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
||||
WriteIndented = true,
|
||||
};
|
||||
TypeInfoResolver = AssistantBuilderPromptJsonContext.Default,
|
||||
}.AsReadOnly();
|
||||
|
||||
private const string LUA_RESPONSE_SCHEMA_PATH = "Assistants/Builder/AssistantBuilderLuaResponse.schema.json";
|
||||
private const string DEFAULT_VERSION = "1.0.0";
|
||||
|
||||
Reference in new issue
Block a user