| 88 | // |
| 89 | |
| 90 | static int get_key_idx(const gguf_context * ctx, const char * key) { |
| 91 | int i = gguf_find_key(ctx, key); |
| 92 | if (i == -1) { |
| 93 | fprintf(stderr, "key %s not found in file\n", key); |
| 94 | throw std::runtime_error(format("Missing required key: %s", key)); |
| 95 | } |
| 96 | |
| 97 | return i; |
| 98 | } |
| 99 | |
| 100 | static uint32_t get_u32(const gguf_context * ctx, const std::string & key) { |
| 101 | const int i = get_key_idx(ctx, key.c_str()); |
no test coverage detected