nemo_gym.server_runtime.request_handling.model_sampling
nemo_gym.server_runtime.request_handling.model_sampling
The middleware that handles a model call’s /ng-sampling/<values|null> segment on each kind of server.
nemo_gym.core.model_call_sampling describes the values and where they come from.
Module Contents
Classes
Functions
Data
API
Give every model call a resources server makes the null segment, so it keeps its caller’s sampling.
Installed in a run that sets model_call_sampling. A resources server never runs an agent that the framework
trains, so its judges and tools keep their own sampling, or their Model Server’s sampling_overrides.
Strip an inbound /ng-sampling/ segment on an agent server and give the agent’s model calls the same one.
An environment server’s activation of the agent, or the agent’s call to itself, carries the rollout’s segment. The agent’s URL helpers then copy it onto every model URL the agent builds while handling the request.
Apply a model call’s sampling segment on a Model Server, before policy admission and capture see the call.
Values replace the request’s temperature and top_p. Their max_output_tokens caps the request’s own
output-token limit, so a smaller limit the caller set is kept. null leaves the request as its caller sent it.
Either way the segment is stripped from the path and stays the current segment while the server handles the
call. With required, a generation call without a segment fails.
Only the body of a POST to a generation route is rewritten; other routes keep their body. Responses, streamed or not, pass through unchanged.
Bases: NamedTuple
The path a request routes to after its correlation prefix, such as /v1/responses.
Split off a request path’s sampling segment, or return None for a path without one.
Raises ValueError for a malformed segment.
Split the request path into a relay’s mount path (root_path) and the path this app routes.