forecastclient

package
v0.209.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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 New

func New(base string, timeout time.Duration) *Client

New builds a client. timeout bounds one request, the cold load of the model included.

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

func (c *Client) WithFenceWait(d time.Duration) *Client

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.

Jump to

Keyboard shortcuts

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