/**
* Process streaming chunks to detect and handle system prompts
*/
async processOutputStream(args: {
part: ChunkType
streamParts: ChunkType[]
state: Record<string, any>
abort: (reason?: string) => never
tracingContext?: TracingContext
}): Promise<ChunkType | null> {
const { part, streamParts, abort, state } = args
const typeCounts = streamParts.reduce((acc, p) => {
acc[p.type] = (acc[p.type] || 0) + 1;
return acc;
}, {} as Record<string, number>);
console.log('Type counts:', typeCounts);
console.log('==================');
...
/**
* Process streaming chunks to detect and handle system prompts
*/
async processOutputStream(args: {
part: ChunkType
streamParts: ChunkType[]
state: Record<string, any>
abort: (reason?: string) => never
tracingContext?: TracingContext
}): Promise<ChunkType | null> {
const { part, streamParts, abort, state } = args
const typeCounts = streamParts.reduce((acc, p) => {
acc[p.type] = (acc[p.type] || 0) + 1;
return acc;
}, {} as Record<string, number>);
console.log('Type counts:', typeCounts);
console.log('==================');
...