fetcher-llm-streaming
Workflow
- Import
@ahoo-wang/fetcher-eventstreamfor side-effect prototype helpers when usingResponseextensions. - Use standalone conversion functions when prototype mutation is undesirable.
- Handle stream conversion errors explicitly with
EventStreamConvertError. - For OpenAI-style DONE termination, supply a detector function (
TerminateDetector); the ready-madeDoneDetectorlives in@ahoo-wang/fetcher-openai. - Load
references/api.mdfor pipeline details, OpenAI streaming examples, and UI update patterns.
Key Practices
- Keep parsing, termination detection, and UI state updates as separate steps.
- Use async iteration over streams to avoid buffering full responses in memory.
- When pairing with decorators, configure result extractors at the endpoint boundary.
References
references/api.md: Detailed package API, examples, and edge-case guidance. Load it only when the task needs prototype extensions, standalone stream functions, SSE structures, termination handling, OpenAI streaming examples, and React UI update snippets.
Related Skills
- $fetcher-openai-client: Use for higher-level OpenAI chat client setup.
- $fetcher-decorator-service: Use when the streaming endpoint is declared with decorators.
- $fetcher-react-hooks: Use when streaming data drives React state.