MCPcopy Index your code
hub / github.com/anomalyco/opencode / chunk

Function chunk

packages/opencode/test/lib/llm-server.ts:69–81  ·  view source on GitHub ↗
(input: { delta?: Record<string, unknown>; finish?: string; usage?: Usage })

Source from the content-addressed store, hash-verified

67}
68
69function chunk(input: { delta?: Record<string, unknown>; finish?: string; usage?: Usage }) {
70 return {
71 id: "chatcmpl-test",
72 object: "chat.completion.chunk",
73 choices: [
74 {
75 delta: input.delta ?? {},
76 ...(input.finish ? { finish_reason: input.finish } : {}),
77 },
78 ],
79 ...(input.usage ? { usage: tokens(input.usage) } : {}),
80 } satisfies Line
81}
82
83function role() {
84 return chunk({ delta: { role: "assistant" } })

Callers 6

roleFunction · 0.85
textLineFunction · 0.85
reasonLineFunction · 0.85
finishLineFunction · 0.85
toolStartLineFunction · 0.85
toolArgsLineFunction · 0.85

Calls 1

tokensFunction · 0.70

Tested by

no test coverage detected