Skip to content

Commit 36f51bb

Browse files
committed
Fix unit test
1 parent 2ad4e6d commit 36f51bb

3 files changed

Lines changed: 216 additions & 108 deletions

File tree

Tool/Sources/OpenAIService/Models.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,25 @@ public struct ChatMessage: Equatable, Codable {
2525
self.arguments = arguments
2626
}
2727
}
28-
28+
2929
public struct ToolCall: Codable, Equatable, Identifiable {
3030
public var id: String
3131
public var type: String
3232
public var function: FunctionCall
3333
public var response: ToolCallResponse
34-
public init(id: String, type: String, function: FunctionCall) {
34+
public init(
35+
id: String,
36+
type: String,
37+
function: FunctionCall,
38+
response: ToolCallResponse? = nil
39+
) {
3540
self.id = id
3641
self.type = type
3742
self.function = function
38-
response = .init(id: id, content: "", summary: nil)
43+
self.response = response ?? .init(id: id, content: "", summary: nil)
3944
}
4045
}
41-
46+
4247
public struct ToolCallResponse: Codable, Equatable {
4348
public var id: String
4449
public var content: String
@@ -67,7 +72,7 @@ public struct ChatMessage: Equatable, Codable {
6772
case webpage
6873
case other
6974
}
70-
75+
7176
public var title: String
7277
public var subTitle: String
7378
public var uri: String
@@ -164,3 +169,4 @@ public struct ReferenceKindFallback: FallbackValueProvider {
164169
public struct ChatMessageRoleFallback: FallbackValueProvider {
165170
public static var defaultValue: ChatMessage.Role { .user }
166171
}
172+

0 commit comments

Comments
 (0)