| | | 1 | | namespace Elsa.AI.Host.Tools; |
| | | 2 | | |
| | | 3 | | internal static class GroundingToolSchemas |
| | | 4 | | { |
| | | 5 | | public static JsonObject Empty() => |
| | 0 | 6 | | new() |
| | 0 | 7 | | { |
| | 0 | 8 | | ["type"] = "object", |
| | 0 | 9 | | ["properties"] = new JsonObject() |
| | 0 | 10 | | }; |
| | | 11 | | |
| | | 12 | | public static JsonObject WithProperties(params (string Name, JsonObject Schema)[] properties) |
| | | 13 | | { |
| | 676 | 14 | | var propertyObject = new JsonObject(); |
| | 6490 | 15 | | foreach (var (name, schema) in properties) |
| | 2569 | 16 | | propertyObject[name] = schema; |
| | | 17 | | |
| | 676 | 18 | | return new JsonObject |
| | 676 | 19 | | { |
| | 676 | 20 | | ["type"] = "object", |
| | 676 | 21 | | ["properties"] = propertyObject |
| | 676 | 22 | | }; |
| | | 23 | | } |
| | | 24 | | |
| | | 25 | | public static JsonObject String(string description) => |
| | 2028 | 26 | | new() |
| | 2028 | 27 | | { |
| | 2028 | 28 | | ["type"] = "string", |
| | 2028 | 29 | | ["description"] = description |
| | 2028 | 30 | | }; |
| | | 31 | | |
| | | 32 | | public static JsonObject Integer(string description) => |
| | 226 | 33 | | new() |
| | 226 | 34 | | { |
| | 226 | 35 | | ["type"] = "integer", |
| | 226 | 36 | | ["description"] = description |
| | 226 | 37 | | }; |
| | | 38 | | |
| | | 39 | | public static JsonObject Boolean(string description) => |
| | 180 | 40 | | new() |
| | 180 | 41 | | { |
| | 180 | 42 | | ["type"] = "boolean", |
| | 180 | 43 | | ["description"] = description |
| | 180 | 44 | | }; |
| | | 45 | | |
| | | 46 | | public static JsonObject Object(string description) => |
| | 135 | 47 | | new() |
| | 135 | 48 | | { |
| | 135 | 49 | | ["type"] = "object", |
| | 135 | 50 | | ["description"] = description |
| | 135 | 51 | | }; |
| | | 52 | | } |