nub/internal/llm/event.go
Tom a97013d876 initial commit
- v 0.1.0 siehe CHANGELOG.md
2026-07-25 11:08:01 +02:00

45 lines
933 B
Go

package llm
// Modelliert nach dem expliziteren Anthropic-Schema; der OpenAI-Adapter synthetisiert.
type Event interface{ isEvent() }
type BlockStart struct {
Index int
Block Block // Block ohne Inhalt, nur Kind/ID/Name
}
type BlockDelta struct {
Index int
Text string
PartialJSON string
}
type BlockStop struct {
Index int
}
type Done struct {
Stop StopReason
Usage Usage
}
func (BlockStart) isEvent() {}
func (BlockDelta) isEvent() {}
func (BlockStop) isEvent() {}
func (Done) isEvent() {}
type StopReason string
const (
StopEnd StopReason = "end_turn"
StopToolUse StopReason = "tool_use"
StopMaxTokens StopReason = "max_tokens"
)
type Usage struct {
InputTokens int `json:"input_tokens,omitempty"`
OutputTokens int `json:"output_tokens,omitempty"`
CacheReadTokens int `json:"cache_read_tokens,omitempty"`
CacheWriteTokens int `json:"cache_write_tokens,omitempty"`
}