12 lines
397 B
JavaScript
12 lines
397 B
JavaScript
|
|
// Build OpenAI chat.completion.chunk. Caller supplies id/created/model so each
|
||
|
|
// translator keeps its exact id-generation + created semantics (no Date.now here).
|
||
|
|
export function buildChunk({ id, created, model }, delta, finishReason = null) {
|
||
|
|
return {
|
||
|
|
id,
|
||
|
|
object: "chat.completion.chunk",
|
||
|
|
created,
|
||
|
|
model,
|
||
|
|
choices: [{ index: 0, delta, finish_reason: finishReason }],
|
||
|
|
};
|
||
|
|
}
|