(
response: any,
toolChoice: string | { type: string; function?: { name: string }; name?: string; any?: any }
)
| 190 | let usedForcedTools: string[] = [] |
| 191 | |
| 192 | const checkForForcedToolUsage = ( |
| 193 | response: any, |
| 194 | toolChoice: string | { type: string; function?: { name: string }; name?: string; any?: any } |
| 195 | ) => { |
| 196 | if (typeof toolChoice === 'object' && response.choices[0]?.message?.tool_calls) { |
| 197 | const toolCallsResponse = response.choices[0].message.tool_calls |
| 198 | const result = trackForcedToolUsage( |
| 199 | toolCallsResponse, |
| 200 | toolChoice, |
| 201 | logger, |
| 202 | 'mistral', |
| 203 | forcedTools, |
| 204 | usedForcedTools |
| 205 | ) |
| 206 | hasUsedForcedTool = result.hasUsedForcedTool |
| 207 | usedForcedTools = result.usedForcedTools |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | let currentResponse = await mistral.chat.completions.create( |
| 212 | payload, |
no test coverage detected