v0.8.4

串流符號

最後更新

串流事件型別、串流錯誤、SSE 輔助函式與讀取上限常數。

符號

符號 簽名/內容
StreamEvent Type、TextDelta、ReasoningDelta、ToolCall、Usage、FinishReason、Err
StreamEventType text / reasoning / tool_call / usage / done / error
ToolCallDelta Index、ID、Name、Arguments、ThoughtSignature
StreamError Provider、Code、Body、Err;實作 Error() 與 Unwrap()
ErrStreamUnsupported error
OpenStream func(ctx, client *http.Client, url string, headers map[string]string, body map[string]any, label string) (*http.Response, error)
StreamChat / StreamResponses func(resp *http.Response, label string) <-chan StreamEvent
ResponsesStreamError func(label, data string) error
ScanSSE func(reader *bufio.Reader, handle func(event, data string) bool) error
TruncateFrame func(data string) string
上限常數 StreamBodyLimit 64 MiB、ErrorBodyLimit 8 KiB、ErrorFrameLimit 512 B、JSONBodyLimit 64 KiB

相關頁面

EN