mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 05:27:21 +00:00
Generated the JSON contracts of providers, the runtime, and services at compile time (#1150)
This commit is contained in:
1 parent
e954881fda
commit
24e3c22db3
140 files changed
+1415
-292
No files matched your search
@@ -11,6 +11,19 @@ namespace AIStudio.Provider.OpenAI;
|
||||
/// <param name="Choices">The choices made by the AI.</param>
|
||||
public record ChatCompletionDeltaStreamLine(string Id, string Object, uint Created, string Model, string SystemFingerprint, IList<ChatCompletionChoice> Choices) : IResponseStreamLine
|
||||
{
|
||||
//
|
||||
// The properties of the parameters, declared again to be settable. The source generation of System.Text.Json
|
||||
// sets every init-only property while it creates the object, also one missing in the JSON, so its value from
|
||||
// the parameterless constructor would get lost, e.g., the empty list of choices of the line which carries the
|
||||
// usage. Keep them first and in the order of the parameters:
|
||||
//
|
||||
public string Id { get; set; } = Id;
|
||||
public string Object { get; set; } = Object;
|
||||
public uint Created { get; set; } = Created;
|
||||
public string Model { get; set; } = Model;
|
||||
public string SystemFingerprint { get; set; } = SystemFingerprint;
|
||||
public IList<ChatCompletionChoice> Choices { get; set; } = Choices;
|
||||
|
||||
public ChatCompletionDeltaStreamLine() : this(string.Empty, string.Empty, 0, string.Empty, string.Empty, [])
|
||||
{
|
||||
}
|
||||
@@ -25,7 +38,7 @@ public record ChatCompletionDeltaStreamLine(string Id, string Object, uint Creat
|
||||
/// line of its own which carries no choices -- which is why the usage is read apart from the
|
||||
/// content rather than next to it.
|
||||
/// </remarks>
|
||||
public ChatCompletionUsage? Usage { get; init; }
|
||||
public ChatCompletionUsage? Usage { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool ContainsContent() => this.Choices.Count > 0;
|
||||
|
||||
Reference in new issue
Block a user