Revision history for HuggingFace::API

0.2.4  2026-10-24T22:15:34+01:00

    - [2026-10-24] Accepts Cro::HTTP 0.8.11 or later. The exact 0.8.11 pin
      made zef install that release next to whatever newer Cro::HTTP was
      already present, leaving two versions side by side in one
      installation.

0.2.3  2026-10-24T18:37:20+01:00

    - [2026-10-24] Fix every API call leaving its connection open until the
      process exited. Each call builds its own Cro::HTTP::Client, which
      defaults to persistent connections, so the socket stayed cached in a
      client that was then thrown away. Enough calls (search, get-file,
      get-tokenizer, get-chat-template and friends) used up the process's
      open-file limit -- 256 on a stock macOS terminal -- after which new
      requests failed with a messageless PipelineClosedBeforeHeaders. The
      per-call client is now non-persistent, so each connection is closed
      once its response is done.
    - Requires JSON::Fast 0.21.0 or later (zef:timo). 0.19 (cpan:TIMOTIMO)
      fails its own tests under the RakuAST compiler frontend that Rakudo
      2026.09 makes the default, so installing this distribution stopped
      at that dependency.

0.2.2  2026-08-10T20:25:26+01:00
    - Fix mojibake on every text response body. Cro's body-text falls back
      to the encoding list ('utf-8', 'latin-1') when the Content-Type names
      no charset, and loops it without stopping on the first success, so the
      latin-1 attempt always overwrote the correct utf-8 decode: café came
      back as cafÃ©. search, get-file and the get-chat-template probes now
      decode the response bytes as UTF-8 themselves, with latin-1 kept only
      as a fallback for bodies utf-8 cannot decode at all.
    - This was not cosmetic: get-tokenizer-to-file, get-tokenizer-config-to-file
      and get-chat-template-to-file spurt the decoded string back out as
      UTF-8, so a latin-1 misread was written to disk permanently double-
      encoded. Byte-level BPE vocab tokens (U+0100..U+01FF) and chat
      templates are dense with exactly the characters that break.
    - huggingface.co currently sends charset=utf-8 for text files, so the
      canonical hub was unaffected; mirrors, self-hosted hubs, caching
      proxies and LFS / xet redirects (application/octet-stream, no charset)
      were not.
    - get-file-blob / get-file-to-file are unchanged — they were already
      blob-clean, and a regression test now pins that binary artefacts are
      never text-decoded.
    - Add t/05-body-encoding.rakutest: a live Cro::HTTP::Server fixture whose
      routes all answer charset-less bytes, covering the decode helper in
      isolation plus search / get-file / get-chat-template (both source
      shapes) / the *-to-file writers / get-file-blob end to end. Unlike the
      other test files this one needs no network access.

0.2.1  2026-04-29T23:44:09+01:00
    - Bump Github actions to use node 24+
    - New: get-chat-template($model-id, :$revision) — fetch a
      model's Jinja chat template, trying chat_template.jinja
      first and falling back to extracting chat_template from
      tokenizer_config.json. Modern HF uploads ship the template
      as a standalone .jinja file; older repos embed it as a
      string in the config. Returns Str (undefined) when the
      model has neither source.
    - New: get-chat-template-to-file($model-id, $output, :$revision)
      — variant that writes the resolved template to disk. Returns
      the output path on success or IO::Path (undefined) when no
      template was found, leaving the target untouched.
    - New: extract-chat-template-from-config($json) — exported sub
      that parses a tokenizer_config.json payload and returns the
      template string. Handles both the bare-string form and the
      list-of-{name, template} form (Cohere Command A and similar
      multi-template repos). Selects the entry named "default"
      when present, falling back to the first list entry.

0.2.0  2026-04-24T06:05:51+01:00
    - New: get-file($model-id, $filename, :$revision) — download
      any file from a HuggingFace repo as text. Generalises the
      existing tokenizer-only downloads to arbitrary filenames.
    - New: get-file-blob($model-id, $filename, :$revision) —
      binary-safe variant that returns a Blob. Required for
      anything that isn't UTF-8 text (ONNX weights, safetensors,
      tarballs); text decode corrupts non-UTF8 bytes.
    - New: get-file-to-file($model-id, $filename, $output,
      :$revision) — streams the file to disk, binary-safe. Used
      by LLM::Classifiers::Emotions's Build.rakumod to fetch the
      pinned go-emotions model files at install time.
    - Existing get-tokenizer / get-tokenizer-to-file /
      get-tokenizer-config / get-tokenizer-config-to-file now
      accept a :$revision parameter (default 'main' for
      back-compat). Consumers that want a reproducible install
      should pin a specific commit SHA — matters when models
      get updated and you want deterministic behaviour across
      installs.
    - All signatures add optional parameters with safe defaults;
      0.1.x callers (App-Kelpie, App-Cantina) work unchanged.
    - Version bump to 0.2.0 — new methods, no removals, no
      behaviour changes to existing ones.

0.1.1  2026-04-09T05:16:31+01:00
    - get-tokenizer-config: download tokenizer_config.json for a model
    - get-tokenizer-config-to-file: download tokenizer_config.json to a file

0.1.0  2026-04-08T01:08:13+01:00
    - Initial release
    - search: search HuggingFace models by prefix
    - get-tokenizer: download tokenizer.json for a model
