Documentation
¶
Overview ¶
Package modeldelta carries an optional per-call sink for streamed model reasoning text through context. Transports that already consume streaming HTTP responses inside blocking calls (GetResponse) can surface reasoning deltas live to the host without changing their public signatures.
It is a leaf package so that internal/agent (which installs sinks) and the provider transports internal/anthropic and internal/openai (which invoke them) can all import it without cycles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithReasoningSink ¶
func WithReasoningSink(ctx context.Context, sink ReasoningSink) context.Context
WithReasoningSink returns a context that delivers streamed reasoning text chunks to sink during model calls made with this context.
Types ¶
type ReasoningSink ¶
type ReasoningSink func(text string)
ReasoningSink receives incremental reasoning text chunks in stream order. Implementations must be cheap and non-blocking: they are called inline from the goroutine that consumes the model's HTTP stream. Chunks may be re-sent from the start if the transport retries a failed request mid-stream; consumers reconcile via the final complete reasoning text.
func ReasoningSinkFromContext ¶
func ReasoningSinkFromContext(ctx context.Context) ReasoningSink
ReasoningSinkFromContext extracts the reasoning sink installed by WithReasoningSink, or nil when the call has no live reasoning consumer.