TinkerTokenCompleter - Tinker Documentation
tinker_cookbook.completers.TinkerTokenCompleter
class tinker_cookbook.completers.TinkerTokenCompleter( TokenCompleter)
Token completer that uses a tinker.SamplingClient to sample actions.
completer = TinkerTokenCompleter(sampling_client, max_tokens=512)
result = await completer(model_input, stop=["<|endoftext|>"])
print(result.tokens, result.logprobs)
Fields:
- sampling_client ( tinker. SamplingClient)
- max_tokens ( int)
- temperature ( float, default:
1.0) - context_window ( int | None, default:
None)
__call__( model_input, stop, max_tokens)
Sample an action from the policy given an observation.
A per-call max_tokens override is combined with the completer's own
max_tokens by taking the minimum, and the context_window cap
(when configured) still applies on top.
Parameters:
- model_input ( tinker. ModelInput)
- stop ( StopCondition)
- max_tokens ( int | None)
Returns: TokensWithLogprobs
Back to top