--------------------------------------------------------------------------- OpenAI Chat Completions streaming injection Chunks are raw JSON; the handler wraps them with "data: %s\n\n". --------------------------------------------------------------------------- InjectStream dispatches to the format-s
(dataChan <-chan []byte, rule *config.ToolCallInjectionRule, modelName string, format string)
| 26 | |
| 27 | // InjectStream dispatches to the format-specific streaming injection wrapper. |
| 28 | func InjectStream(dataChan <-chan []byte, rule *config.ToolCallInjectionRule, modelName string, format string) <-chan []byte { |
| 29 | f := GetFormat(format) |
| 30 | if f == nil { |
| 31 | return dataChan |
| 32 | } |
| 33 | return f.InjectStream(dataChan, rule, modelName) |
| 34 | } |
| 35 | |
| 36 | // InjectOpenAIStream wraps a data channel to inject tool_call chunks into a |
| 37 | // real OpenAI streaming response. |