Skip to content

Commit d10071a

Browse files
committed
fix: some more things
1 parent 324a8d2 commit d10071a

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Sources/CompilerSwiftAI/Function Calling/CompilerClient+Functions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public extension CompilerClient {
1616
/// - state: Current state of your app (as defined by the developer, only needs to conform to Encodable and Sendable)
1717
/// - token: Authorization token
1818
/// - Returns: An array of functions with Parameters that are both Decodable and Sendable
19-
func processFunction<State: AppStateProtocol, FunctionType: FunctionCallProtocol>(
19+
func processFunction<State: AppStateProtocol, FunctionType: Decodable & Sendable>(
2020
prompt: String,
2121
for state: State
2222
) async throws -> [FunctionType] {

Sources/CompilerSwiftAI/Function Calling/Function.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
/// The Function struct hold's the function call being returned from Compiler with parameters defined by in the applcation
44
public struct Function<Parameters: Decodable & Sendable>: FunctionCallProtocol {
5+
private enum CodingKeys: String, CodingKey {
6+
case id = "function"
7+
case parameters
8+
case colloquialDescription = "colloquial_response"
9+
}
10+
511
/// Function name
612
public let id: String
713

@@ -10,10 +16,10 @@ public struct Function<Parameters: Decodable & Sendable>: FunctionCallProtocol {
1016

1117
/// The description to show the user while this function is being executed.
1218
public let colloquialDescription: String
13-
14-
private enum CodingKeys: String, CodingKey {
15-
case id = "function"
16-
case parameters
17-
case colloquialDescription = "colloquial_response"
19+
20+
public init(id: String, parameters: Parameters?, colloquialDescription: String) {
21+
self.id = id
22+
self.parameters = parameters
23+
self.colloquialDescription = colloquialDescription
1824
}
1925
}

0 commit comments

Comments
 (0)