sdkstream

package
v1.261022.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MPL-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sdkstream presents a Protocol Stage EventStream as the SDK stream types the existing client writers consume, so the client-facing output of a Stage pipeline goes through exactly the code that writes it today.

Anthropic V1 is served here from Beta events: V1 is a subset of Beta on the wire, so a Beta event is re-read as its V1 form. Content V1 cannot express is refused explicitly (see AnthropicV1Downgrade) rather than dropped.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnthropicBeta

AnthropicBeta returns events as an Anthropic Beta SDK stream. Closing the SDK stream closes events.

func AnthropicV1

AnthropicV1 returns Beta events as an Anthropic V1 SDK stream for a V1 client. A block V1 cannot express ends the stream with an error.

func AnthropicV1Downgrade

func AnthropicV1Downgrade(message *anthropic.BetaMessage) (*anthropic.Message, error)

AnthropicV1Downgrade re-reads a Beta message as its V1 form for a V1 client, keeping its wire bytes. A block V1 cannot express is an error.

func WireJSON

func WireJSON(value any) ([]byte, error)

WireJSON renders a stage event value as its wire payload. Carrier types expose the payload through RawJSON, as the SSE writers use it.

Types

type InBandError

type InBandError struct {
	Type    string
	Message string
}

InBandError is an error event carried inside a stream.

func (InBandError) Error

func (e InBandError) Error() string

type Option

type Option func(*anthropicDecoder)

Option configures a stream presentation.

func OnHeartbeat

func OnHeartbeat(f func()) Option

OnHeartbeat calls f for every stage.Heartbeat, on the goroutine reading the stream (the one writing to the client), so f may write to the client. Without it heartbeats are dropped.

Jump to

Keyboard shortcuts

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