From c6533e55e312cc83eabb8558621e49f448a5de9d Mon Sep 17 00:00:00 2001 From: yoshiaki-yamada Date: Wed, 12 Jul 2023 15:36:31 +0900 Subject: [PATCH] Add initializer to ChatFunctionCall to initialize from external with properties --- Sources/OpenAI/Public/Models/ChatQuery.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/OpenAI/Public/Models/ChatQuery.swift b/Sources/OpenAI/Public/Models/ChatQuery.swift index c0f75a75..73e7f8f2 100644 --- a/Sources/OpenAI/Public/Models/ChatQuery.swift +++ b/Sources/OpenAI/Public/Models/ChatQuery.swift @@ -61,6 +61,11 @@ public struct ChatFunctionCall: Codable, Equatable { public let name: String? /// The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. public let arguments: String? + + public init(name: String?, arguments: String?) { + self.name = name + self.arguments = arguments + } } /// See the [guide](/docs/guides/gpt/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.