MockSamplingClient
In-memory SamplingClient for tests.
Returns canned[i % len(canned)] per call to sample_async. Tests
that need fancy behavior can subclass; the default is enough to exercise
the loop's eval slot.
Attributes
attributecanned= canned or ['']attributename= nameattributemodel_pathstr | None= Noneattributesample_callslist[dict]= []attributelogprob_callslist[tinker.ModelInput]= []Functions
func__init__(self, *, canned=None, name='mock') -> Noneparamselfparamcannedlist[str] | None= Noneparamnamestr= 'mock'Returns
Nonefuncsample_async(self, *, prompt, params, num_samples=1, include_prompt_logprobs=False, topk_prompt_logprobs=0) -> Anyparamselfparamprompttinker.ModelInputparamparamstinker.SamplingParamsparamnum_samplesint= 1paraminclude_prompt_logprobsbool= Falseparamtopk_prompt_logprobsint= 0Returns
typing.Anyfunccompute_logprobs_async(self, prompt) -> list[float | None]paramselfparamprompttinker.ModelInputReturns
list[float | None]