Documentation
¶
Overview ¶
Package requestparams applies operator-configured request parameters to translated inference requests. A virtual model or model policy may carry two parameter sets: defaults, filled in only when the client omitted the key, and forced params, which replace the client's value. Keys use Chat Completions spelling; provider adapters translate them exactly as they translate client-sent values.
Index ¶
Constants ¶
const ( MaxKeys = 64 MaxKeyLen = 64 MaxBytes = 16 << 10 )
Limits bounding a configured set, so a row cannot grow a request body without bound or stall validation.
Variables ¶
This section is empty.
Functions ¶
func ApplyChat ¶
func ApplyChat(req *core.ChatRequest, defaults, params Set) (*core.ChatRequest, error)
ApplyChat returns req with defaults filled in and params forced. The request is never mutated: the result is req itself when both sets are empty and a shallow copy otherwise.
func ApplyResponses ¶
func ApplyResponses(req *core.ResponsesRequest, defaults, params Set) (*core.ResponsesRequest, error)
ApplyResponses is ApplyChat for the Responses API. Keys keep Chat Completions spelling: any token-limit spelling sets max_output_tokens. Chat members the Responses API rejects are skipped, response_format and verbosity included: a format for this API is set through text.
Types ¶
type Overrides ¶
Overrides is everything the operator forces onto one provider attempt: the reasoning effort and both parameter sets, already merged along the route the request took.
func (Overrides) Layer ¶
Layer returns o with the deeper over applied on top: a non-empty effort replaces, and parameter sets merge per key with over winning. Precedence holds across the two sets: a key over configures as a default stops being forced by a shallower row, and one it forces stops being a shallower row's default.
type Set ¶
type Set map[string]json.RawMessage
Set maps body-level parameter names to their JSON values. A nil value in a forced set removes the key from the request.
func Merge ¶
Merge returns base with over's keys added, over winning on conflict. Sets are treated as immutable: the result shares no map with either input when both are non-empty, and is the non-empty input otherwise.