Skip to main content
The RolloutEngine provides an abstraction for model inference across different backends (OpenAI, vLLM, etc.).

RolloutEngine

Base class for all rollout engines.

Methods

get_model_response

Generate a model response for the given messages.
list[dict]
List of chat messages in OpenAI format.
str
Unique identifier for tracking requests.
dict
Additional sampling parameters (temperature, top_p, max_tokens, etc.).
ModelOutput
Model output containing text, tokens, and metadata.

wake_up

Initialize or warm up the engine (implementation-specific).

sleep

Shutdown or clean up the engine (implementation-specific).

ModelOutput

Dataclass containing model generation output.

Fields

str | None
Complete generated text (may include reasoning).
str | None
Content portion of the response (excluding reasoning).
str | None
Reasoning or thought process (if model supports it).
list[ToolCall] | None
List of tool calls made by the model.
list[int] | None
Token IDs for the input prompt.
list[int] | None
Token IDs for the completion.
dict[str, list] | None
Multimodal inputs (e.g., images).
list[float] | None
Log probabilities for completion tokens.
list[float] | None
Log probabilities for prompt tokens (aligned to prompt_ids).
int
default:"0"
Length of prompt in tokens.
int
default:"0"
Length of completion in tokens.
str | None
Reason generation stopped (“stop”, “length”, etc.).

Methods


OpenAIEngine

Rollout engine using OpenAI-compatible APIs.

Constructor

str
Base URL for the API endpoint.
str
API key for authentication.
str
Model identifier.

Example: Basic Usage


Example: Batch Generation