sse

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package sse provides SSE (Server-Sent Events) decoding for Kilo Gateway's non-standard streaming protocol with concatenated data:, reasoning, and fragmented tool_calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType

type EventType string

EventType represents the type of SSE event

const (
	EventContentDelta  EventType = "content_delta"
	EventThinkingDelta EventType = "thinking_delta"
	EventToolUseStart  EventType = "tool_use_start"
	EventToolUseDelta  EventType = "tool_use_delta"
	EventComplete      EventType = "complete"
	EventError         EventType = "error"
)

type KiloDecoder

type KiloDecoder struct {
	// contains filtered or unexported fields
}

KiloDecoder handles Kilo Gateway's non-standard SSE (concatenated data:, reasoning, fragmented tool_calls)

func NewKiloDecoder

func NewKiloDecoder() *KiloDecoder

NewKiloDecoder creates a new KiloDecoder instance.

func (*KiloDecoder) Parse

func (d *KiloDecoder) Parse(body io.Reader) <-chan SSEEvent

Parse reads SSE events from the body and returns a channel of SSE events.

type SSECompleteResponse

type SSECompleteResponse struct {
	FinishReason message.FinishReason
	Usage        TokenUsage
}

SSECompleteResponse contains the final response data

type SSEEvent

type SSEEvent struct {
	Type     EventType
	Content  string
	Thinking string
	ToolCall *message.ToolCall
	Error    error
	Response *SSECompleteResponse
}

SSEEvent represents a decoded SSE event

type TokenUsage

type TokenUsage struct {
	InputTokens  int64
	OutputTokens int64
	TotalTokens  int64
}

TokenUsage represents token usage information

Jump to

Keyboard shortcuts

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