#include <string.h>

#include "bio_internal.h"

const char *bio_operand_value(const bio_operands *ops, const char *key) {
    if (ops == NULL || key == NULL) {
        return NULL;
    }
    for (uint32_t i = 0; i < ops->count; ++i) {
        if (strcmp(ops->pairs[i].key, key) == 0) {
            return ops->pairs[i].value;
        }
    }
    return NULL;
}

void bio_context_close(bio_context *ctx) {
    if (ctx == NULL) {
        return;
    }
    if (ctx->model_loaded) {
        bio_gguf_close(&ctx->model);
        ctx->model_loaded = false;
    }
}
