MCPcopy Index your code
hub / github.com/Noumena-Network/code / inferInitialToolChoiceFromPrompt

Function inferInitialToolChoiceFromPrompt

src/QueryEngine.ts:1289–1306  ·  view source on GitHub ↗
(
  prompt: string | Array<ContentBlockParam>,
  tools: Tools,
  explicitToolChoice?: BetaToolChoiceTool | BetaToolChoiceAuto,
)

Source from the content-addressed store, hash-verified

1287}
1288
1289export 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.

Callers 2

askFunction · 0.85

Calls 2

hasActionableToolsFunction · 0.85

Tested by

no test coverage detected