2026-09-04 22:14:29 +02:00
|
|
|
using System.Text.Json;
|
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace AIStudio.Tools.ToolCallingSystem.ToolCallingImplementations.WebSearch;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How the search backends read and write the JSON of their APIs.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Search APIs name their fields in snake case, so one naming policy here spares nearly every
|
|
|
|
|
/// field of every DTO a property name attribute. What is left of null is not written, which is
|
|
|
|
|
/// how a request leaves out a parameter instead of sending it empty: a search service usually
|
|
|
|
|
/// treats an empty parameter as a value rather than as an omission.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
internal static class WebSearchJson
|
|
|
|
|
{
|
2026-11-03 07:59:30 +01:00
|
|
|
public static readonly JsonSerializerOptions OPTIONS = new JsonSerializerOptions
|
2026-09-04 22:14:29 +02:00
|
|
|
{
|
|
|
|
|
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
|
|
|
|
PropertyNameCaseInsensitive = true,
|
|
|
|
|
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
2026-11-03 07:59:30 +01:00
|
|
|
TypeInfoResolver = WebSearchJsonContext.Default,
|
|
|
|
|
}.AsReadOnly();
|
2026-09-04 22:14:29 +02:00
|
|
|
}
|