* Determines the appropriate model for a block
(log: BlockLog)
| 102 | * Determines the appropriate model for a block |
| 103 | */ |
| 104 | function getModelForBlock(log: BlockLog): string { |
| 105 | // Try to get model from output first |
| 106 | if (log.output?.model?.trim()) { |
| 107 | return log.output.model |
| 108 | } |
| 109 | |
| 110 | // Try to get model from input |
| 111 | const inputModel = log.input?.model |
| 112 | if (typeof inputModel === 'string' && inputModel.trim()) { |
| 113 | return inputModel |
| 114 | } |
| 115 | |
| 116 | // Use block type specific defaults |
| 117 | const blockType = log.blockType |
| 118 | if (blockType === 'agent' || blockType === 'router' || blockType === 'evaluator') { |
| 119 | return TOKENIZATION_CONFIG.defaults.model |
| 120 | } |
| 121 | |
| 122 | // Final fallback |
| 123 | return TOKENIZATION_CONFIG.defaults.model |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Processes multiple block logs for streaming tokenization |
no outgoing calls
no test coverage detected