Documentation
¶
Overview ¶
Package media hydrates session-relative media references into provider bytes and keeps one assembled request inside its byte budget.
It never knows a session path: the application injects a Loader that resolves a reference to verified bytes, so the ai package stays free of session layout knowledge.
Index ¶
Constants ¶
const Placeholder = "[image omitted: request size budget]"
Placeholder replaces an image part the request budget evicted.
Variables ¶
var ErrRequestBudget = errors.New("coding media: request exceeds the size budget")
ErrRequestBudget means hydration and eviction could not fit the request inside the configured budget, so no provider call may be made.
Functions ¶
This section is empty.
Types ¶
type Hydrator ¶
type Hydrator struct {
// contains filtered or unexported fields
}
Hydrator fills referenced media on a copy of the session messages and evicts the oldest image parts until the request fits. The session snapshot is never mutated.
func New ¶
New returns a hydrator over loader with a request byte budget. A nil loader or a non-positive budget disables the corresponding behavior; New returns nil when loader is nil.