MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / processChunk

Function processChunk

packages/core/src/pipes/pipes.ts:503–515  ·  view source on GitHub ↗
({rawChunk}: {rawChunk: any})

Source from the content-addressed store, hash-verified

501 * @returns The processed Chunk object.
502 */
503export const processChunk = ({rawChunk}: {rawChunk: any}): Chunk => {
504 if (rawChunk.choices[0]?.delta?.content) {
505 return {type: 'content', content: rawChunk.choices[0].delta.content};
506 }
507 if (
508 rawChunk.choices[0]?.delta?.tool_calls &&
509 rawChunk.choices[0].delta.tool_calls.length > 0
510 ) {
511 const toolCall = rawChunk.choices[0].delta.tool_calls[0];
512 return {type: 'toolCall', toolCall};
513 }
514 return {type: 'unknown', rawChunk};
515};
516
517/**
518 * Checks if the given chunk is a ContentChunk.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected