( prompt: string | Array<ContentBlockParam>, tools: Tools, explicitToolChoice?: BetaToolChoiceTool | BetaToolChoiceAuto, )
| 1287 | } |
| 1288 | |
| 1289 | export function inferInitialToolChoiceFromPrompt( |
| 1290 | prompt: string | Array<ContentBlockParam>, |
| 1291 | tools: Tools, |
| 1292 | explicitToolChoice?: BetaToolChoiceTool | BetaToolChoiceAuto, |
| 1293 | ): BetaToolChoiceTool | BetaToolChoiceAuto | undefined { |
| 1294 | if (explicitToolChoice || !hasActionableTools(tools)) { |
| 1295 | return explicitToolChoice |
| 1296 | } |
| 1297 | |
| 1298 | const text = promptTextForToolObligation(prompt) |
| 1299 | if (!text.trim()) { |
| 1300 | return undefined |
| 1301 | } |
| 1302 | |
| 1303 | return TOOL_OBLIGATION_PATTERNS.some(pattern => pattern.test(text)) |
| 1304 | ? { type: 'any' } |
| 1305 | : undefined |
| 1306 | } |
| 1307 | |
| 1308 | /** |
| 1309 | * REPL-facing QueryEngine seam. |
no test coverage detected