modelclient

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package modelclient defines engine-facing model client interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRequest

type ChatRequest struct {
	Messages []message.Message
	Tools    []openai.Tool
}

ChatRequest is the engine-facing request shape for chat model calls.

type ChatResponse

type ChatResponse struct {
	Content   string
	HasChoice bool
}

ChatResponse is the engine-facing non-streaming response shape.

type ChatStream

type ChatStream interface {
	Recv() (StreamDelta, error)
	Close() error
}

ChatStream is a parsed model stream.

type ChatStreamer

type ChatStreamer interface {
	ChatStream(ctx context.Context, req ChatRequest) (ChatStream, error)
	ProtocolWarnings(messages []message.Message) []ProtocolWarning
	Model() string
	ModelRef() coremodel.ModelRef
}

ChatStreamer is the streaming model client surface used by the loop.

type ChunkParseError

type ChunkParseError struct {
	Err error
}

ChunkParseError wraps a malformed provider chunk. Streams use this for non-fatal parse errors so the loop can skip the bad chunk and keep reading.

func (ChunkParseError) Error

func (e ChunkParseError) Error() string

func (ChunkParseError) Unwrap

func (e ChunkParseError) Unwrap() error

type ProtocolWarning

type ProtocolWarning struct {
	Kind         string
	Message      string
	Provider     string
	Model        string
	Field        string
	MessageIndex int
}

ProtocolWarning describes a non-fatal protocol metadata diagnostic.

type StreamDelta

type StreamDelta struct {
	Role         string
	Content      string
	Refusal      string
	ToolCalls    []openai.ToolCall
	FinishReason openai.FinishReason
	Usage        *openai.Usage
	HasChoice    bool

	MessageExtra     message.Extra
	ToolCallExtra    map[int]message.Extra
	ContentPartExtra map[int]message.Extra
	ContentParts     []message.ContentPart
}

StreamDelta is the engine-facing parsed view of one streaming chunk.

type Summarizer

type Summarizer interface {
	Chat(ctx context.Context, req ChatRequest) (ChatResponse, error)
	Model() string
	ModelRef() coremodel.ModelRef
}

Summarizer is the non-streaming model client surface used by compaction.

Jump to

Keyboard shortcuts

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