( messages: ChatCompletionRequestBody['messages'], )
| 5 | } |
| 6 | |
| 7 | function getToolCallNamesById( |
| 8 | messages: ChatCompletionRequestBody['messages'], |
| 9 | ): Map<string, string> { |
| 10 | const namesById = new Map<string, string>() |
| 11 | |
| 12 | for (const message of messages) { |
| 13 | if (message.role !== 'assistant') { |
| 14 | continue |
| 15 | } |
| 16 | for (const toolCall of message.tool_calls ?? []) { |
| 17 | if (toolCall.id && toolCall.function.name) { |
| 18 | namesById.set(toolCall.id, toolCall.function.name) |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | return namesById |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Kimi-compatible providers require two OpenAI-compatible extensions that are |
no test coverage detected