MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / makeChunk

Function makeChunk

packages/kosong/test/kimi.test.ts:987–1008  ·  view source on GitHub ↗
(
      toolCalls: MockToolCallDelta[],
      opts?: { finishReason?: string; usage?: boolean },
    )

Source from the content-addressed store, hash-verified

985 }
986
987 function makeChunk(
988 toolCalls: MockToolCallDelta[],
989 opts?: { finishReason?: string; usage?: boolean },
990 ): Record<string, unknown> {
991 const chunk: Record<string, unknown> = {
992 id: 'chatcmpl-kimi-stream',
993 object: 'chat.completion.chunk',
994 created: 1234567890,
995 model: 'kimi-k2-turbo-preview',
996 choices: [
997 {
998 index: 0,
999 delta: { tool_calls: toolCalls },
1000 finish_reason: opts?.finishReason ?? null,
1001 },
1002 ],
1003 };
1004 if (opts?.usage) {
1005 chunk['usage'] = { prompt_tokens: 10, completion_tokens: 20, total_tokens: 30 };
1006 }
1007 return chunk;
1008 }
1009
1010 async function* mockStream(
1011 chunks: Record<string, unknown>[],

Callers 1

kimi.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected