ModelClient
模型客户端:把一次 IRRequest 变成 IRStreamEvent 流;providers 实现,kernel 经注入消费。
stream()
Section titled “stream()”stream(request, options?): AsyncGenerator<IRStreamEvent, void, undefined>;流式调用。实现必须把 wire 协议(SSE/delta)解析为 IRStreamEvent 序列;
可恢复错误以 {t:'error'} 事件产出而非 throw(throw 仅保留给编程性错误)。
生成器正常结束 = 流完整;消费方以 message_stop 或 error 事件为语义终点。
request
Section titled “request”options?
Section titled “options?”AsyncGenerator<IRStreamEvent, void, undefined>
本文是否有帮助?
感谢反馈,我们会持续改进这篇文章。