From 378d9850b328718585488496ac91c496dbe94a63 Mon Sep 17 00:00:00 2001 From: rawnly Date: Sun, 19 Nov 2023 09:46:49 +0100 Subject: [PATCH] added shorthand initializers to `JSONObject` Item Signed-off-by: rawnly --- Sources/OpenAI/Public/Models/Chat/JSONSchema.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/OpenAI/Public/Models/Chat/JSONSchema.swift b/Sources/OpenAI/Public/Models/Chat/JSONSchema.swift index 3ef94d71..482827c5 100644 --- a/Sources/OpenAI/Public/Models/Chat/JSONSchema.swift +++ b/Sources/OpenAI/Public/Models/Chat/JSONSchema.swift @@ -44,6 +44,18 @@ public struct JSONSchema: Codable, Equatable { public let minItems: Int? public let maxItems: Int? public let uniqueItems: Bool? + + public static func string(description: String?=nil) -> Self { + return Property(type: .string, description: description) + } + + public static func boolean(description: String?=nil) -> Self { + return Property(type: .boolean, description: description) + } + + public static func number(description: String?=nil) -> Self { + return Property(type: .number, description: description) + } private enum CodingKeys: String, CodingKey { case type, description, format, items, required, pattern, const