Made the JSON types of the runtime calls settable instead of init-only

This commit is contained in:
Thorsten Sommer committed 2026-11-02 19:12:28 +01:00
1 parent bf22cf4a78
commit c97b0f0f76
18 files changed
+34 -34

No files matched your search

@@ -5,8 +5,8 @@ namespace AIStudio.Tools;
public sealed class ContentStreamDocumentDetails public sealed class ContentStreamDocumentDetails
{ {
[JsonPropertyName("page_number")] [JsonPropertyName("page_number")]
public int? PageNumber { get; init; } public int? PageNumber { get; set; }
[JsonPropertyName("image")] [JsonPropertyName("image")]
public ContentStreamPptxImageData? Image { get; init; } public ContentStreamPptxImageData? Image { get; set; }
} }
@@ -6,5 +6,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamDocumentMetadata : ContentStreamSseMetadata public sealed class ContentStreamDocumentMetadata : ContentStreamSseMetadata
{ {
[JsonPropertyName("Document")] [JsonPropertyName("Document")]
public ContentStreamDocumentDetails? Document { get; init; } public ContentStreamDocumentDetails? Document { get; set; }
} }
@@ -7,23 +7,23 @@ namespace AIStudio.Tools;
public sealed class ContentStreamErrorDetails public sealed class ContentStreamErrorDetails
{ {
[JsonPropertyName("code")] [JsonPropertyName("code")]
public string? Code { get; init; } public string? Code { get; set; }
[JsonPropertyName("message")] [JsonPropertyName("message")]
public string? Message { get; init; } public string? Message { get; set; }
/// <summary> /// <summary>
/// The page the failure belongs to, when the failure affects a single page only. /// The page the failure belongs to, when the failure affects a single page only.
/// </summary> /// </summary>
[JsonPropertyName("page_number")] [JsonPropertyName("page_number")]
public int? PageNumber { get; init; } public int? PageNumber { get; set; }
/// <summary> /// <summary>
/// The format the runtime identified by looking at the content, e.g. when it contradicts the /// The format the runtime identified by looking at the content, e.g. when it contradicts the
/// file extension. /// file extension.
/// </summary> /// </summary>
[JsonPropertyName("detected_format")] [JsonPropertyName("detected_format")]
public string? DetectedFormat { get; init; } public string? DetectedFormat { get; set; }
/// <summary> /// <summary>
/// Gets the parsed error code. /// Gets the parsed error code.
@@ -7,5 +7,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamErrorMetadata : ContentStreamSseMetadata public sealed class ContentStreamErrorMetadata : ContentStreamSseMetadata
{ {
[JsonPropertyName("Error")] [JsonPropertyName("Error")]
public ContentStreamErrorDetails? Error { get; init; } public ContentStreamErrorDetails? Error { get; set; }
} }
@@ -7,5 +7,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPdfDetails public sealed class ContentStreamPdfDetails
{ {
[JsonPropertyName("page_number")] [JsonPropertyName("page_number")]
public int? PageNumber { get; init; } public int? PageNumber { get; set; }
} }
@@ -7,5 +7,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPdfMetadata : ContentStreamSseMetadata public sealed class ContentStreamPdfMetadata : ContentStreamSseMetadata
{ {
[JsonPropertyName("Pdf")] [JsonPropertyName("Pdf")]
public ContentStreamPdfDetails? Pdf { get; init; } public ContentStreamPdfDetails? Pdf { get; set; }
} }
@@ -5,17 +5,17 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPptxImageData public sealed class ContentStreamPptxImageData
{ {
[JsonPropertyName("id")] [JsonPropertyName("id")]
public string? Id { get; init; } public string? Id { get; set; }
[JsonPropertyName("content")] [JsonPropertyName("content")]
public string? Content { get; init; } public string? Content { get; set; }
[JsonPropertyName("segment")] [JsonPropertyName("segment")]
public int? Segment { get; init; } public int? Segment { get; set; }
[JsonPropertyName("is_end")] [JsonPropertyName("is_end")]
public bool IsEnd { get; init; } public bool IsEnd { get; set; }
[JsonPropertyName("media_type")] [JsonPropertyName("media_type")]
public string? MediaType { get; init; } public string? MediaType { get; set; }
} }
@@ -7,8 +7,8 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPresentationDetails public sealed class ContentStreamPresentationDetails
{ {
[JsonPropertyName("slide_number")] [JsonPropertyName("slide_number")]
public int? SlideNumber { get; init; } public int? SlideNumber { get; set; }
[JsonPropertyName("image")] [JsonPropertyName("image")]
public ContentStreamPptxImageData? Image { get; init; } public ContentStreamPptxImageData? Image { get; set; }
} }
@@ -7,5 +7,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPresentationMetadata : ContentStreamSseMetadata public sealed class ContentStreamPresentationMetadata : ContentStreamSseMetadata
{ {
[JsonPropertyName("Presentation")] [JsonPropertyName("Presentation")]
public ContentStreamPresentationDetails? Presentation { get; init; } public ContentStreamPresentationDetails? Presentation { get; set; }
} }
@@ -17,12 +17,12 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPromptInjectionDetails public sealed class ContentStreamPromptInjectionDetails
{ {
[JsonPropertyName("findings")] [JsonPropertyName("findings")]
public List<PromptInjectionFinding>? Findings { get; init; } public List<PromptInjectionFinding>? Findings { get; set; }
/// <summary> /// <summary>
/// How many passages were filtered. Can exceed the number of findings, because the runtime /// How many passages were filtered. Can exceed the number of findings, because the runtime
/// caps how many it reports in detail while it filters every single one. /// caps how many it reports in detail while it filters every single one.
/// </summary> /// </summary>
[JsonPropertyName("redacted_count")] [JsonPropertyName("redacted_count")]
public int RedactedCount { get; init; } public int RedactedCount { get; set; }
} }
@@ -7,5 +7,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPromptInjectionMetadata : ContentStreamSseMetadata public sealed class ContentStreamPromptInjectionMetadata : ContentStreamSseMetadata
{ {
[JsonPropertyName("PromptInjection")] [JsonPropertyName("PromptInjection")]
public ContentStreamPromptInjectionDetails? PromptInjection { get; init; } public ContentStreamPromptInjectionDetails? PromptInjection { get; set; }
} }
@@ -7,8 +7,8 @@ namespace AIStudio.Tools;
public sealed class ContentStreamSpreadsheetDetails public sealed class ContentStreamSpreadsheetDetails
{ {
[JsonPropertyName("sheet_name")] [JsonPropertyName("sheet_name")]
public string? SheetName { get; init; } public string? SheetName { get; set; }
[JsonPropertyName("row_number")] [JsonPropertyName("row_number")]
public int? RowNumber { get; init; } public int? RowNumber { get; set; }
} }
@@ -7,5 +7,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamSpreadsheetMetadata : ContentStreamSseMetadata public sealed class ContentStreamSpreadsheetMetadata : ContentStreamSseMetadata
{ {
[JsonPropertyName("Spreadsheet")] [JsonPropertyName("Spreadsheet")]
public ContentStreamSpreadsheetDetails? Spreadsheet { get; init; } public ContentStreamSpreadsheetDetails? Spreadsheet { get; set; }
} }
@@ -5,14 +5,14 @@ namespace AIStudio.Tools;
public sealed class ContentStreamSseEvent public sealed class ContentStreamSseEvent
{ {
[JsonPropertyName("content")] [JsonPropertyName("content")]
public string? Content { get; init; } public string? Content { get; set; }
[JsonPropertyName("stream_id")] [JsonPropertyName("stream_id")]
public string? StreamId { get; init; } public string? StreamId { get; set; }
[JsonPropertyName("metadata")] [JsonPropertyName("metadata")]
public ContentStreamSseMetadata? Metadata { get; init; } public ContentStreamSseMetadata? Metadata { get; set; }
[JsonPropertyName("token_count")] [JsonPropertyName("token_count")]
public int? TokenCount { get; init; } public int? TokenCount { get; set; }
} }
@@ -6,5 +6,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamTextDetails public sealed class ContentStreamTextDetails
{ {
[JsonPropertyName("line_number")] [JsonPropertyName("line_number")]
public int? LineNumber { get; init; } public int? LineNumber { get; set; }
} }
@@ -6,5 +6,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamTextMetadata : ContentStreamSseMetadata public sealed class ContentStreamTextMetadata : ContentStreamSseMetadata
{ {
[JsonPropertyName("Text")] [JsonPropertyName("Text")]
public ContentStreamTextDetails? Text { get; init; } public ContentStreamTextDetails? Text { get; set; }
} }
@@ -27,7 +27,7 @@ public sealed record VectorSearchResult(
/// <remarks> /// <remarks>
/// The vector store keeps only the pages of a chunk, cf. LocalIndexSearchService.SearchVectorsAsync. /// The vector store keeps only the pages of a chunk, cf. LocalIndexSearchService.SearchVectorsAsync.
/// </remarks> /// </remarks>
public ChunkLocation? StoredLocation { get; init; } public ChunkLocation? StoredLocation { get; set; }
/// <summary> /// <summary>
/// Where the chunk is: what the index store keeps, or the pages alone when it could not say. /// Where the chunk is: what the index store keeps, or the pages alone when it could not say.
@@ -15,17 +15,17 @@ public sealed record PromptInjectionFinding
/// Which rule matched, e.g. "instruction_override". /// Which rule matched, e.g. "instruction_override".
/// </summary> /// </summary>
[JsonPropertyName("rule_id")] [JsonPropertyName("rule_id")]
public string RuleId { get; init; } = string.Empty; public string RuleId { get; set; } = string.Empty;
/// <summary> /// <summary>
/// The rule's family, e.g. "exfiltration". /// The rule's family, e.g. "exfiltration".
/// </summary> /// </summary>
[JsonPropertyName("category")] [JsonPropertyName("category")]
public PromptInjectionFindingCategory Category { get; init; } = PromptInjectionFindingCategory.UNKNOWN; public PromptInjectionFindingCategory Category { get; set; } = PromptInjectionFindingCategory.UNKNOWN;
/// <summary> /// <summary>
/// The passage as it appeared in the content, so the user can see what was removed. /// The passage as it appeared in the content, so the user can see what was removed.
/// </summary> /// </summary>
[JsonPropertyName("snippet")] [JsonPropertyName("snippet")]
public string Snippet { get; init; } = string.Empty; public string Snippet { get; set; } = string.Empty;
} }