tinker_cookbook.renderers.RenderContext
class tinker_cookbook.renderers.RenderContext(**)
Context passed to render_message for rendering a single message.
Fields:
- idx (int) – Index of the message in the conversation (0-based).
- is_last (bool) – Whether this is the last message in the conversation.
- prev_message (Message | None) – The previous message in the conversation, if any. Default:
None. -
last_user_index (int) – Index of the last user message in the conversation. -1 if no user messages.
This is computed by the base build_generation_prompt/build_supervised_example and used by renderers like Qwen3.5 that need to treat assistant messages differently based on whether they come before or after the last user message. Default:
-1.