Skip to content

Commit 6428470

Browse files
authored
Refactor tool calls mapping to include index
1 parent 0ceaf20 commit 6428470

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Sources/SwiftLM/Server.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,8 +1368,9 @@ func handleChatCompletion(
13681368
case "assistant":
13691369
var formattedToolCalls: [[String: any Sendable]]? = nil
13701370
if let tc = msg.tool_calls, !tc.isEmpty {
1371-
formattedToolCalls = tc.map { call in
1371+
formattedToolCalls = tc.enumerated().map { (index, call) in
13721372
[
1373+
"index": index,
13731374
"id": call.id,
13741375
"type": call.type,
13751376
"function": [

0 commit comments

Comments
 (0)