Skip to content

Commit 5b16f0c

Browse files
committed
fix: remove chunk string parameter from ResponseChunkProcessor interface
Plugins read the chunk via response.CurrentChunk and mutate via response.SetChunk(). The separate chunk string parameter created ambiguity for implementors. Signed-off-by: Noy Itzikowitz <nitzikow@redhat.com>
1 parent 3961398 commit 5b16f0c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

pkg/framework/interface/requesthandling/plugins.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ type ResponseProcessor interface {
5252
}
5353

5454
// ResponseChunkProcessor processes individual response body chunks as they
55-
// stream through without buffering. The framework converts the raw chunk bytes
56-
// to a string once and passes it to all chunk processors. Plugins receive the
57-
// InferenceResponse to allow header mutation.
55+
// stream through without buffering. The framework sets response.CurrentChunk
56+
// before calling plugins. Plugins read the chunk via response.CurrentChunk
57+
// and mutate it via response.SetChunk().
5858
type ResponseChunkProcessor interface {
5959
plugin.Plugin
60-
ProcessResponseChunk(ctx context.Context, cycleState *plugin.CycleState, response *InferenceResponse, chunk string, isFinal bool) error
60+
ProcessResponseChunk(ctx context.Context, cycleState *plugin.CycleState, response *InferenceResponse, isFinal bool) error
6161
}
6262

6363
type PostProcessor interface {

pkg/handlers/response.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func (s *Server) runResponseChunkProcessors(ctx context.Context, cycleState *plu
169169
verboseLogger.Info("Executing response chunk plugin", "plugin", cp.TypedName())
170170
}
171171
before := time.Now()
172-
err := cp.ProcessResponseChunk(ctx, cycleState, response, response.CurrentChunk, isFinal)
172+
err := cp.ProcessResponseChunk(ctx, cycleState, response, isFinal)
173173
metrics.RecordPluginProcessingLatency(responsePluginExtensionPoint, cp.TypedName().Type, cp.TypedName().Name, time.Since(before))
174174
if err != nil {
175175
return err

0 commit comments

Comments
 (0)