Documentation
¶
Overview ¶
Package modelcall makes one logical model call: iteration timeout, streaming with an idle-chunk watchdog, and retries on transient failure.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyResponse = errors.New("steerloop: empty LLM response")
ErrEmptyResponse marks a reply with no text and no tool call, so a classifier can recognise it with errors.Is.
Functions ¶
This section is empty.
Types ¶
type Caller ¶
type Caller struct {
// contains filtered or unexported fields
}
func New ¶
func New(timing Timing, temperature TemperatureSource, options OptionsBuilder, classifier ErrorClassifier, logger *slog.Logger, usage UsageRecorder) *Caller
func (*Caller) Call ¶
func (c *Caller) Call(runCtx context.Context, m model.ToolCallingChatModel, msgs []*schema.Message, extra ...model.Option) (*schema.Message, error)
Call returns a complete assistant message or an error. It retries transient failures with a short backoff. It does not change msgs.
type ErrorClassifier ¶
ErrorClassifier decides whether a failed call is worth retrying. → the caller's loop.ErrorClassifier, or defaults.Classifier
type OptionsBuilder ¶
OptionsBuilder builds the per-call model options. → the caller's loop.CallOptionsBuilder, or defaults.TemperatureOnly
type TemperatureSource ¶
type TemperatureSource interface {
Temperature() float64
}
TemperatureSource gives the temperature for the next call. → state.Run
type Timing ¶
type Timing struct {
IterationTimeout time.Duration // zero: no per-call bound
DecoupleIterationTimeout bool // a call gets the full IterationTimeout even near the run's deadline
IdleChunkTimeout time.Duration
RetryAttempts int // extra attempts after a transient failure
Streaming bool
}
Timing is how long calls may take and how often they are retried.
type UsageRecorder ¶
add after TemperatureSource UsageRecorder records the tokens each call spent. → state.Run