feat: enable SSE streaming support in Anthropic handler

- Updated AnthropicHandler to check for streaming configuration before handling SSE transform.
- Modified handleStreaming to use the original request body instead of forcing stream to true.
- Adjusted the transformation logic in AnthropicToBifrost to respect the original stream setting.
- Added logging for SSE streaming configuration in the main application.
This commit is contained in:
Beyhan Ogur
2026-05-11 15:28:56 +03:00
parent f0a4e89e0f
commit c56ae7194c
10 changed files with 193 additions and 21 deletions
+1 -6
View File
@@ -143,16 +143,11 @@ func AnthropicToBifrost(rawBody []byte) ([]byte, error) {
log.Printf("[TRANSFORM] Model auto-prefixed: %s -> %s", antReq.Model, model)
}
// Force stream=false — streaming SSE responses can't be transformed back to Anthropic format.
if antReq.Stream {
log.Printf("[TRANSFORM] Stream forced to false (SSE not supported for transform)")
}
bfReq := BifrostRequest{
Model: model,
Messages: bfMessages,
MaxTokens: antReq.MaxTokens,
Stream: false,
Stream: antReq.Stream,
}
return json.Marshal(bfReq)
}