(system: unknown)
| 194 | } |
| 195 | |
| 196 | function flattenSystemPrompt(system: unknown): string | undefined { |
| 197 | if (!Array.isArray(system)) { |
| 198 | return typeof system === 'string' && system.length > 0 ? system : undefined |
| 199 | } |
| 200 | const text = system |
| 201 | .map(block => { |
| 202 | if (!block || typeof block !== 'object') return '' |
| 203 | return 'text' in block && typeof block.text === 'string' ? block.text : '' |
| 204 | }) |
| 205 | .filter(Boolean) |
| 206 | .join('\n\n') |
| 207 | return text.length > 0 ? text : undefined |
| 208 | } |
| 209 | |
| 210 | function anthropicMessagesToOpenAI( |
| 211 | system: unknown, |
no outgoing calls
no test coverage detected