Documentation
¶
Overview ¶
Package forecastclient calls the Timestral forecast server (internal/forecastserve) over llama-swap's /upstream/<model>/v1/forecast passthrough: one JSON object in, one JSON object out. The payload is the server's own request body, so this client reads none of it; it fences the call behind the GPU lease, types the failures the pipeline files differently, and returns the answer bytes untouched. Pure net/http; no cgo, no cloud.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBadInput = errors.New("forecast input refused")
ErrBadInput marks a request the server refused as given: a 400 (the model refuses the shape, the values or the horizon) or a 413 (past the body or point caps). The wrapped message carries the server's own detail. It is the caller's request that is wrong, so no node and no retry changes it; tell it from every other failure with errors.Is.
var ErrUpstreamVanished = errors.New("forecast upstream: the upstream vanished mid-request")
ErrUpstreamVanished marks a call whose upstream went away under it: an empty-body 5xx (llama-swap's bare answer when its connection to the model drops) or an answer cut off mid-read. An unload, a swap, a restart and a crash all look like that, so it is a failed call a caller can retry, never a verdict about the series.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client posts forecast payloads to the forecast server through llama-swap on base (e.g. http://127.0.0.1:11436). The server is a threaded HTTP server that batches inside one request, so unlike whisper-server there is no single-slot lock, and no unload after a burst: the seat's ttl frees the card.
func (*Client) Forecast ¶
func (c *Client) Forecast(ctx context.Context, model string, payload []byte) (json.RawMessage, error)
Forecast posts payload (the server's request body, a JSON object) to the upstream `model` and returns the server's JSON answer verbatim. A 400 or 413 is ErrBadInput carrying the server's detail; an empty-body 5xx or a cut-off answer is ErrUpstreamVanished; a held card is the fence's lease refusal (modelaffinity.IsLeaseRefusal).
func (*Client) WithFenceWait ¶
WithFenceWait sets how long a call waits for a card a render holds and returns the client, so it chains at construction: New(...).WithFenceWait(p.gpuWait()). The client's timeout only caps it. Zero is a value, not "unset": gpu_wait_ms 0 is a single inspection of the lease.