( blockType: string, subBlocks?: Record<string, SubBlockWithValue>, options?: EffectiveOutputOptions )
| 364 | } |
| 365 | |
| 366 | export function getEffectiveBlockOutputs( |
| 367 | blockType: string, |
| 368 | subBlocks?: Record<string, SubBlockWithValue>, |
| 369 | options?: EffectiveOutputOptions |
| 370 | ): OutputDefinition { |
| 371 | const triggerMode = options?.triggerMode ?? false |
| 372 | const preferToolOutputs = options?.preferToolOutputs ?? !triggerMode |
| 373 | const includeHidden = options?.includeHidden ?? false |
| 374 | |
| 375 | if (blockType === 'agent') { |
| 376 | const responseFormatOutputs = getResponseFormatOutputs(subBlocks, 'agent') |
| 377 | if (responseFormatOutputs) return responseFormatOutputs |
| 378 | } |
| 379 | |
| 380 | let baseOutputs: OutputDefinition |
| 381 | if (triggerMode) { |
| 382 | baseOutputs = getBlockOutputs(blockType, subBlocks, true, { includeHidden }) |
| 383 | } else if (preferToolOutputs) { |
| 384 | const blockConfig = getBlock(blockType) |
| 385 | const toolOutputs = blockConfig |
| 386 | ? (getToolOutputs(blockConfig, subBlocks, { includeHidden }) as OutputDefinition) |
| 387 | : {} |
| 388 | baseOutputs = |
| 389 | toolOutputs && Object.keys(toolOutputs).length > 0 |
| 390 | ? toolOutputs |
| 391 | : getBlockOutputs(blockType, subBlocks, false, { includeHidden }) |
| 392 | } else { |
| 393 | baseOutputs = getBlockOutputs(blockType, subBlocks, false, { includeHidden }) |
| 394 | } |
| 395 | |
| 396 | if (blockType === 'evaluator') { |
| 397 | const metricOutputs = getEvaluatorMetricOutputs(subBlocks) |
| 398 | if (metricOutputs) { |
| 399 | return { ...baseOutputs, ...metricOutputs } |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | return baseOutputs |
| 404 | } |
| 405 | |
| 406 | export function getEffectiveBlockOutputPaths( |
| 407 | blockType: string, |
no test coverage detected