@@ -147,6 +147,7 @@ public struct FunctionCallPart: Part {
147
147
148
148
public var isThought : Bool { _isThought ?? false }
149
149
150
+ public var id : String ?
150
151
/// Constructs a new function call part.
151
152
///
152
153
/// > Note: A `FunctionCallPart` is typically received from the model, rather than created
@@ -156,7 +157,21 @@ public struct FunctionCallPart: Part {
156
157
/// - name: The name of the function to call.
157
158
/// - args: The function parameters and values.
158
159
public init ( name: String , args: JSONObject ) {
159
- self . init ( FunctionCall ( name: name, args: args) , isThought: nil , thoughtSignature: nil )
160
+ self . init ( FunctionCall ( name: name, args: args, id: nil ) , isThought: nil , thoughtSignature: nil )
161
+ }
162
+
163
+ /// Constructs a new function call part.
164
+ ///
165
+ /// > Note: A `FunctionCallPart` is typically received from the model, rather than created
166
+ /// manually.
167
+ ///
168
+ /// - Parameters:
169
+ /// - name: The name of the function to call.
170
+ /// - args: The function parameters and values.
171
+ /// - id: Unique id of the function call. If present, the returned ``FunctionResponsePart``
172
+ /// should have a matching `id` field.
173
+ public init ( name: String , args: JSONObject , id: String ? = nil ) {
174
+ self . init ( FunctionCall ( name: name, args: args, id: id) , isThought: nil , thoughtSignature: nil )
160
175
}
161
176
162
177
init ( _ functionCall: FunctionCall , isThought: Bool ? = nil , thoughtSignature: String ? = nil ) {
0 commit comments