Prompt LibraryEngineering

LLM Streaming Response Chunk Processor Prompt

Process a streaming response into structured deltas.

The prompt

Given the streaming chunk sequence below, reconstruct the full output and emit structured deltas:
- Text deltas as they arrive.
- When a tool-call JSON completes, emit it as a parsed object.
- Detect and flag a partial tool-call at the end of the stream.
Return the reconstructed text, the list of completed tool calls, and any partial call.

Chunks (in order):
{{chunks}}

Replace the {{fields}} with your own context and tighten the rules to match your domain.

Share this prompt