streamutil

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package streamutil provides helper functions for consuming streamed text responses from agents, including delta mode, accumulated mode, and debounced streaming.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamText

func StreamText(stream core.StreamedResponse, opts StreamTextOptions) iter.Seq2[string, error]

StreamText wraps a StreamedResponse to yield text according to options.

func StreamTextAccumulated

func StreamTextAccumulated(stream core.StreamedResponse) iter.Seq2[string, error]

StreamTextAccumulated is a convenience for accumulated mode streaming.

func StreamTextDebounced

func StreamTextDebounced(stream core.StreamedResponse, debounce time.Duration) iter.Seq2[string, error]

StreamTextDebounced wraps streaming with debounce grouping.

func StreamTextDelta

func StreamTextDelta(stream core.StreamedResponse) iter.Seq2[string, error]

StreamTextDelta is a convenience for delta mode streaming.

Types

type StreamTextOptions

type StreamTextOptions struct {
	Delta    bool          // if true, yield deltas; if false, yield accumulated text
	Debounce time.Duration // group events within this window (0 = no debounce)
}

StreamTextOptions configures text streaming behavior.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL