{"id":50641332,"url":"https://github.com/pharo-llm/pharo-huggingface","last_synced_at":"2026-06-07T08:31:03.898Z","repository":{"id":351329273,"uuid":"1210523759","full_name":"pharo-llm/pharo-huggingface","owner":"pharo-llm","description":"Hugging Face API in Pharo","archived":false,"fork":false,"pushed_at":"2026-04-14T16:10:09.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-14T16:13:48.297Z","etag":null,"topics":["hugging-face","pharo","pharo-llm"],"latest_commit_sha":null,"homepage":"","language":"Smalltalk","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pharo-llm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-14T13:55:54.000Z","updated_at":"2026-04-14T15:11:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pharo-llm/pharo-huggingface","commit_stats":null,"previous_names":["pharo-llm/pharo-huggingface"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/pharo-llm/pharo-huggingface","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pharo-llm%2Fpharo-huggingface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pharo-llm%2Fpharo-huggingface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pharo-llm%2Fpharo-huggingface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pharo-llm%2Fpharo-huggingface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pharo-llm","download_url":"https://codeload.github.com/pharo-llm/pharo-huggingface/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pharo-llm%2Fpharo-huggingface/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34014821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hugging-face","pharo","pharo-llm"],"created_at":"2026-06-07T08:31:00.819Z","updated_at":"2026-06-07T08:31:03.894Z","avatar_url":"https://github.com/pharo-llm.png","language":"Smalltalk","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pharo-huggingface\n\nA complete Hugging Face client for Pharo.\n\n## Install\n\n```smalltalk\nMetacello new\n    baseline: 'HuggingFace';\n    repository: 'github://pharo-llm/pharo-huggingface:main/src';\n    load.\n```\n\nGroups: `Core`, `Hub`, `Inference`, `Tests`, `default` (= Core + Hub +\nInference), `all` (everything including tests).\n\n## Authentication\n\nThe client picks up a token from, in order:\n\n1. `HfConfiguration \u003e\u003e token:` when set explicitly\n2. `HF_TOKEN` / `HUGGINGFACE_TOKEN` / `HUGGING_FACE_HUB_TOKEN` env vars\n3. `~/.cache/huggingface/token` (written by the official `huggingface-cli login`)\n\nEverything works anonymously for public reads; writes and gated repos need a\ntoken with the appropriate scope.\n\n## Quickstart\n\n```smalltalk\n| client api |\nclient := HfClient default.       \"token picked up automatically\"\napi := client hub.\n\n\"List / search\"\napi listModels: (Dictionary new\n    at: 'search' put: 'llama';\n    at: 'limit' put: 10;\n    yourself).\n\n\"Inspect a repo\"\n(api modelInfo: 'bert-base-uncased') siblings.\n\n\"Download a single file (cached on disk, returns a FileReference)\"\napi downloadFileFrom: 'bert-base-uncased' path: 'config.json'.\n\n\"Snapshot a full revision into the cache\"\napi snapshotDownload: 'bert-base-uncased' type: #model revision: 'main'.\n\n\"Create a repo, upload a file, delete it again\"\napi createRepo: 'me/my-model' type: #model private: true.\napi uploadFile: '/tmp/model.safetensors' toRepo: 'me/my-model'.\napi deleteRepo: 'me/my-model' type: #model.\n```\n\n## Inference\n\n```smalltalk\n| chat text |\nchat := client inference\n    chatCompletion: 'meta-llama/Llama-3-8B-Instruct'\n    messages: {\n        HfChatMessage system: 'You are a concise assistant.'.\n        HfChatMessage user: 'Explain metaclasses in one sentence.' }.\ntext := client inference firstChoiceTextOf: chat.\n\nclient inference\n    textGeneration: 'gpt2'\n    prompt: 'Once upon a time'\n    options: (Dictionary new\n        at: 'max_new_tokens' put: 50;\n        at: 'temperature' put: 0.7;\n        yourself).\n\nclient inference featureExtraction: 'sentence-transformers/all-MiniLM-L6-v2' input: 'hello'.\n\n(client inference textToImage: 'stabilityai/sdxl-turbo' prompt: 'a red panda in a field')\n    writeToFile: 'out.png'.\n```\n\n## Architecture\n\n| Package                | Purpose                                                             |\n|------------------------|---------------------------------------------------------------------|\n| `HuggingFace-Core`     | Config, auth, `ZnClient` wrapper, typed error hierarchy, endpoints  |\n| `HuggingFace-Hub`      | `HfApi`, repo info classes, file download/upload, commits, cache    |\n| `HuggingFace-Inference`| Chat / text generation / embeddings / image generation              |\n| `HuggingFace-Tests`    | Offline SUnit tests (URL building, JSON parsing, cache layout, ...) |\n\nErrors all inherit from `HfError`:\n\n- `HfAuthenticationError` (HTTP 401)\n- `HfAuthorizationError`  (HTTP 403, non-gated)\n- `HfGatedRepoError`      (HTTP 403, license not accepted)\n- `HfRepositoryNotFoundError` (HTTP 404)\n- `HfRateLimitError`      (HTTP 429 — automatically retried with backoff)\n- `HfHttpError`           (any other non-2xx)\n- `HfValidationError`     (client-side input validation)\n\nThe `HfHttpClient` retries 5xx / 429 / connection failures with exponential\nbackoff (capped at 30 s, up to `HfConfiguration \u003e\u003e maxRetries`).\n\n## Cache layout\n\nIdentical to `huggingface_hub` in Python, so a folder populated by one\nclient is consumable by the other:\n\n```\n\u003ccache\u003e/\n  models--\u003cns\u003e--\u003cname\u003e/\n    blobs/\u003csha\u003e\n    refs/\u003crevision\u003e\n    snapshots/\u003csha\u003e/\u003cfilename\u003e   (symlink -\u003e ../../blobs/\u003csha\u003e)\n```\n\nSymlinks fall back to file copies on filesystems that do not support them.\n\n## Running tests\n\n```smalltalk\n(TestSuite named: 'HuggingFace-Tests')\n    addTests: (Smalltalk image allClasses\n        select: [ :c | c package name = #'HuggingFace-Tests' ]\n        thenCollect: [ :c | c buildSuite ]);\n    run.\n```\n\nOr use the Test Runner UI and select the `HuggingFace-Tests` package. The\ndefault suite runs offline; methods touching the network only execute when\na real token is configured.\n\n## License\n\nMIT — see `LICENSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpharo-llm%2Fpharo-huggingface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpharo-llm%2Fpharo-huggingface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpharo-llm%2Fpharo-huggingface/lists"}