(delta)
| 31 | if (hasToolCalls) return 'tool_calls' |
| 32 | if (typeof upstreamReason === 'string' && upstreamReason.length > 0) { |
| 33 | const aliases = { |
| 34 | end_turn: 'stop', |
| 35 | max_tokens: 'length', |
| 36 | tool_use: 'tool_calls' |
| 37 | } |
| 38 | const normalized = aliases[upstreamReason] || upstreamReason |
| 39 | const supported = new Set(['stop', 'length', 'tool_calls', 'content_filter', 'function_call']) |
| 40 | return supported.has(normalized) ? normalized : null |
| 41 | } |
| 42 | return upstreamCompleted ? 'stop' : null |
| 43 | } |
| 44 | |
| 45 | const writeOpenAIStreamError = (res, message, code = 'upstream_incomplete', type = 'upstream_stream_error', retryAfterSeconds = null) => { |
| 46 | const error = { message, type, code } |
| 47 | // Gemelo de anthropic.js#writeAnthropicError: con las cabeceras ya enviadas no hay |
| 48 | // Retry-After que poner, asi que la espera real viaja dentro del frame o se pierde. |
no outgoing calls
no test coverage detected