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
{
[JsonPropertyName("page_number")]
public int? PageNumber { get; init; }
public int? PageNumber { get; set; }
[JsonPropertyName("image")]
public ContentStreamPptxImageData? Image { get; init; }
public ContentStreamPptxImageData? Image { get; set; }
}
@@ -6,5 +6,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamDocumentMetadata : ContentStreamSseMetadata
{
[JsonPropertyName("Document")]
public ContentStreamDocumentDetails? Document { get; init; }
public ContentStreamDocumentDetails? Document { get; set; }
}
@@ -7,23 +7,23 @@ namespace AIStudio.Tools;
public sealed class ContentStreamErrorDetails
{
[JsonPropertyName("code")]
public string? Code { get; init; }
public string? Code { get; set; }
[JsonPropertyName("message")]
public string? Message { get; init; }
public string? Message { get; set; }
/// <summary>
/// The page the failure belongs to, when the failure affects a single page only.
/// </summary>
[JsonPropertyName("page_number")]
public int? PageNumber { get; init; }
public int? PageNumber { get; set; }
/// <summary>
/// The format the runtime identified by looking at the content, e.g. when it contradicts the
/// file extension.
/// </summary>
[JsonPropertyName("detected_format")]
public string? DetectedFormat { get; init; }
public string? DetectedFormat { get; set; }
/// <summary>
/// Gets the parsed error code.
@@ -7,5 +7,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamErrorMetadata : ContentStreamSseMetadata
{
[JsonPropertyName("Error")]
public ContentStreamErrorDetails? Error { get; init; }
public ContentStreamErrorDetails? Error { get; set; }
}
@@ -7,5 +7,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPdfDetails
{
[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
{
[JsonPropertyName("Pdf")]
public ContentStreamPdfDetails? Pdf { get; init; }
public ContentStreamPdfDetails? Pdf { get; set; }
}
@@ -5,17 +5,17 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPptxImageData
{
[JsonPropertyName("id")]
public string? Id { get; init; }
public string? Id { get; set; }
[JsonPropertyName("content")]
public string? Content { get; init; }
public string? Content { get; set; }
[JsonPropertyName("segment")]
public int? Segment { get; init; }
public int? Segment { get; set; }
[JsonPropertyName("is_end")]
public bool IsEnd { get; init; }
public bool IsEnd { get; set; }
[JsonPropertyName("media_type")]
public string? MediaType { get; init; }
public string? MediaType { get; set; }
}
@@ -7,8 +7,8 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPresentationDetails
{
[JsonPropertyName("slide_number")]
public int? SlideNumber { get; init; }
public int? SlideNumber { get; set; }
[JsonPropertyName("image")]
public ContentStreamPptxImageData? Image { get; init; }
public ContentStreamPptxImageData? Image { get; set; }
}
@@ -7,5 +7,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPresentationMetadata : ContentStreamSseMetadata
{
[JsonPropertyName("Presentation")]
public ContentStreamPresentationDetails? Presentation { get; init; }
public ContentStreamPresentationDetails? Presentation { get; set; }
}
@@ -17,12 +17,12 @@ namespace AIStudio.Tools;
public sealed class ContentStreamPromptInjectionDetails
{
[JsonPropertyName("findings")]
public List<PromptInjectionFinding>? Findings { get; init; }
public List<PromptInjectionFinding>? Findings { get; set; }
/// <summary>
/// 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.
/// </summary>
[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
{
[JsonPropertyName("PromptInjection")]
public ContentStreamPromptInjectionDetails? PromptInjection { get; init; }
public ContentStreamPromptInjectionDetails? PromptInjection { get; set; }
}
@@ -7,8 +7,8 @@ namespace AIStudio.Tools;
public sealed class ContentStreamSpreadsheetDetails
{
[JsonPropertyName("sheet_name")]
public string? SheetName { get; init; }
public string? SheetName { get; set; }
[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
{
[JsonPropertyName("Spreadsheet")]
public ContentStreamSpreadsheetDetails? Spreadsheet { get; init; }
public ContentStreamSpreadsheetDetails? Spreadsheet { get; set; }
}
@@ -5,14 +5,14 @@ namespace AIStudio.Tools;
public sealed class ContentStreamSseEvent
{
[JsonPropertyName("content")]
public string? Content { get; init; }
public string? Content { get; set; }
[JsonPropertyName("stream_id")]
public string? StreamId { get; init; }
public string? StreamId { get; set; }
[JsonPropertyName("metadata")]
public ContentStreamSseMetadata? Metadata { get; init; }
public ContentStreamSseMetadata? Metadata { get; set; }
[JsonPropertyName("token_count")]
public int? TokenCount { get; init; }
public int? TokenCount { get; set; }
}
@@ -6,5 +6,5 @@ namespace AIStudio.Tools;
public sealed class ContentStreamTextDetails
{
[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
{
[JsonPropertyName("Text")]
public ContentStreamTextDetails? Text { get; init; }
public ContentStreamTextDetails? Text { get; set; }
}
@@ -27,7 +27,7 @@ public sealed record VectorSearchResult(
/// <remarks>
/// The vector store keeps only the pages of a chunk, cf. LocalIndexSearchService.SearchVectorsAsync.
/// </remarks>
public ChunkLocation? StoredLocation { get; init; }
public ChunkLocation? StoredLocation { get; set; }
/// <summary>
/// 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".
/// </summary>
[JsonPropertyName("rule_id")]
public string RuleId { get; init; } = string.Empty;
public string RuleId { get; set; } = string.Empty;
/// <summary>
/// The rule's family, e.g. "exfiltration".
/// </summary>
[JsonPropertyName("category")]
public PromptInjectionFindingCategory Category { get; init; } = PromptInjectionFindingCategory.UNKNOWN;
public PromptInjectionFindingCategory Category { get; set; } = PromptInjectionFindingCategory.UNKNOWN;
/// <summary>
/// The passage as it appeared in the content, so the user can see what was removed.
/// </summary>
[JsonPropertyName("snippet")]
public string Snippet { get; init; } = string.Empty;
public string Snippet { get; set; } = string.Empty;
}