buildOpenAIChunkJSON builds a raw JSON chunk for OpenAI streaming (no SSE wrapping).
(id, model string, created int64, delta map[string]any)
| 103 | |
| 104 | // buildOpenAIChunkJSON builds a raw JSON chunk for OpenAI streaming (no SSE wrapping). |
| 105 | func buildOpenAIChunkJSON(id, model string, created int64, delta map[string]any) []byte { |
| 106 | deltaJSON, _ := json.Marshal(delta) |
| 107 | raw := fmt.Sprintf(`{"id":%q,"object":"chat.completion.chunk","created":%d,"model":%q,"choices":[{"index":0,"delta":%s,"finish_reason":null}]}`, |
| 108 | id, created, model, deltaJSON) |
| 109 | return []byte(raw) |
| 110 | } |
| 111 | |
| 112 | // --------------------------------------------------------------------------- |
| 113 | // Claude Messages streaming injection |
no outgoing calls
no test coverage detected