| 359 | } |
| 360 | |
| 361 | void common_sampler_accept(struct common_sampler * gsmpl, llama_token token, bool accept_grammar) { |
| 362 | if (!gsmpl) { |
| 363 | return; |
| 364 | } |
| 365 | |
| 366 | const auto tm = gsmpl->tm(); |
| 367 | |
| 368 | if (gsmpl->grmr && accept_grammar) { |
| 369 | llama_sampler_accept(gsmpl->grmr, token); |
| 370 | } |
| 371 | |
| 372 | llama_sampler_accept(gsmpl->chain, token); |
| 373 | |
| 374 | gsmpl->prev.push_back(token); |
| 375 | } |
| 376 | |
| 377 | void common_sampler_reset(struct common_sampler * gsmpl) { |
| 378 | if (!gsmpl) { |