Hugging Face Hub — search, model detail, and GGUF download.
Hub I/O uses OLLMrpc.Client with an HTTPS socket URL. Call rpc_register() once, then connect:
OLLMhf.rpc_register();
var rpc = new OLLMrpc.Client("", "", "https://huggingface.co");
yield rpc.connect(new OLLMrpc.Request());
Param.Search becomes the query string. Result decodes as ModelArray.
var resp = yield rpc.call(new OLLMrpc.Request() {
method = "/api/models",
param = new OLLMhf.Param.Search() {
search = "mistral",
filter = "gguf",
limit = 20
},
result_type = typeof(OLLMhf.ModelArray)
});
foreach (var model in ((OLLMhf.ModelArray) resp.result[0]).items) {
stdout.printf("%s\n", model.id);
}
Put the repo ref in method. fetch_siblings fills missing file sizes.
var resp = yield rpc.call(new OLLMrpc.Request() {
method = "/api/models/author/name",
result_type = typeof(OLLMhf.Model)
});
var model = (OLLMhf.Model) resp.result[0];
yield model.fetch_siblings(rpc);
Download streams .gguf siblings to the local models tree.
var dl = new OLLMhf.Download(model);
dl.file_filter = { "model-q4_k_m.gguf" };
dl.progress.connect((n) => {
stdout.printf("%lld/%lld %s\n",
n.progress_completed, n.progress_total, n.message);
});
yield dl.start();