Skip to content
cccskills
FreePublished on GitHub

completers

Guide for using completers — TokenCompleter and MessageCompleter for text generation during RL rollouts and evaluation. Use when the user asks about generating text, completing messages, or using completers in RL environments.

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md2.5 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Completers

Completers wrap SamplingClient for convenient text generation. Two levels of abstraction:

  • TokenCompleter — low-level, returns tokens + logprobs
  • MessageCompleter — high-level, returns parsed Message objects

Reference

Read these for details:

  • tinker_cookbook/completers.py — Implementation
  • docs/completers.mdx — Usage guide

TokenCompleter

Generates tokens from a ModelInput prompt. Used internally by RL rollouts.

from tinker_cookbook.completers import TinkerTokenCompleter, TokensWithLogprobs

completer = TinkerTokenCompleter(
    sampling_client=sc,
    max_tokens=256,
    temperature=1.0,
)

result: TokensWithLogprobs = await completer(
    model_input=prompt,
    stop=stop_sequences,  # list[str] or list[int]
)
# result.tokens: list[int]
# result.maybe_logprobs: list[float] | None

MessageCompleter

Higher-level: takes a conversation (list of Messages), returns a Message. Handles rendering and parsing internally.

from tinker_cookbook.completers import TinkerMessageCompleter

completer = TinkerMessageCompleter(
    sampling_client=sc,
    renderer=renderer,
    max_tokens=256,
    temperature=1.0,
    stop_condition=None,  # Override stop sequences
)

response_message: Message = await completer(messages=[
    {"role": "user", "content": "What is 2+2?"},
])
# response_message = {"role": "assistant", "content": "4"}

When to use which

  • TokenCompleter: RL rollouts, custom generation loops where you need logprobs and token-level control
  • MessageCompleter: Evaluation, tool-use environments, multi-turn RL where you work with Messages

Custom completers

Both are abstract base classes you can subclass for non-Tinker backends:

from tinker_cookbook.completers import TokenCompleter, MessageCompleter

class MyTokenCompleter(TokenCompleter):
    async def __call__(self, model_input, stop) -> TokensWithLogprobs:
        ...

class MyMessageCompleter(MessageCompleter):
    async def __call__(self, messages) -> Message:
        ...

Common pitfalls

  • Create a new completer (with a new SamplingClient) after saving weights
  • TokensWithLogprobs.maybe_logprobs can be None if logprobs weren't requested
  • MessageCompleter uses the renderer for both prompt construction and response parsing

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Guide for checkpointing — saving, loading, and resuming training with CheckpointRecord. Use when the user asks about saving weights, resuming training, checkpoint management, or the checkpoint lifecycle.

The English summary is being prepared. Showing the original description.

uiuc-kang-lab/rlvr_generalization_bounds5Updated May 13, 2026

ci

Free

Guide for testing conventions and CI pipelines — unit tests, integration smoke tests, pytest markers, and GitHub Actions workflows. Use when the user asks about testing, CI, running tests, or adding tests for a recipe.

The English summary is being prepared. Showing the original description.

uiuc-kang-lab/rlvr_generalization_bounds5Updated May 13, 2026

Guide for contributing to the tinker-cookbook repo — development setup, code style, type checking, PR process, and design conventions. Use when the user asks about how to contribute, set up the dev environment, code style, or project conventions.

The English summary is being prepared. Showing the original description.

uiuc-kang-lab/rlvr_generalization_bounds5Updated May 13, 2026

Guide for dataset construction — SupervisedDatasetBuilder, RLDatasetBuilder, ChatDatasetBuilder, and custom dataset creation from JSONL, HuggingFace, or conversation data. Use when the user asks about datasets, data loading, data preparation, or custom data formats.

The English summary is being prepared. Showing the original description.

uiuc-kang-lab/rlvr_generalization_bounds5Updated May 13, 2026

Set up and run knowledge distillation (on-policy, off-policy, or multi-teacher) from a teacher model to a student model using the Tinker API. Use when the user wants to distill knowledge, compress models, or train a student from a teacher.

The English summary is being prepared. Showing the original description.

uiuc-kang-lab/rlvr_generalization_bounds5Updated May 13, 2026

dpo

Free

Set up and run Direct Preference Optimization (DPO) training on preference datasets using the Tinker API. Use when the user wants to train with preference data, chosen/rejected pairs, or DPO.

The English summary is being prepared. Showing the original description.

uiuc-kang-lab/rlvr_generalization_bounds5Updated May 13, 2026

See all skills by uiuc-kang-lab

Report a problem with this skill