| 381 | } |
| 382 | |
| 383 | std::vector<int> GPT_OSS::get_function_name_tokens() { |
| 384 | std::vector<int> allowed; |
| 385 | |
| 386 | for (const auto& tool : tools) { |
| 387 | std::string name = tool["function"]["name"]; |
| 388 | |
| 389 | auto tokens = this->tokenizer->encode(name); |
| 390 | for (int token : tokens) { |
| 391 | allowed.push_back(token); |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | return allowed; |
| 396 | } |
| 397 | |
| 398 | void GPT_OSS::update_state(int token_id) { |
| 399 | std::string token_str = tokenizer->decode({ token_id }); |