| 19836 | } |
| 19837 | |
| 19838 | int gguf_find_key(const struct gguf_context * ctx, const char * key) { |
| 19839 | // return -1 if key not found |
| 19840 | int keyfound = -1; |
| 19841 | |
| 19842 | const int n_kv = gguf_get_n_kv(ctx); |
| 19843 | |
| 19844 | for (int i = 0; i < n_kv; ++i) { |
| 19845 | if (strcmp(key, gguf_get_key(ctx, i)) == 0) { |
| 19846 | keyfound = i; |
| 19847 | break; |
| 19848 | } |
| 19849 | } |
| 19850 | |
| 19851 | return keyfound; |
| 19852 | } |
| 19853 | |
| 19854 | const char * gguf_get_key(const struct gguf_context * ctx, int key_id) { |
| 19855 | return ctx->kv[key_id].key.data; |
no test coverage detected