{"id":15165981,"url":"https://github.com/maximerenou/php-hugging-chat","last_synced_at":"2025-09-30T21:30:46.128Z","repository":{"id":156483030,"uuid":"633034627","full_name":"maximerenou/php-hugging-chat","owner":"maximerenou","description":"🚧 Deprecated 🚧 HuggingChat PHP client (OpenAssistant's LLaMA)","archived":true,"fork":false,"pushed_at":"2023-05-05T10:18:26.000Z","size":86,"stargazers_count":17,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T04:35:42.423Z","etag":null,"topics":["ai","chatbot","huggingchat","huggingface","llama","openassistant"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/maximerenou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-26T16:31:28.000Z","updated_at":"2024-12-24T06:11:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"b5f3ff43-7596-4360-a4da-69b4b474b059","html_url":"https://github.com/maximerenou/php-hugging-chat","commit_stats":{"total_commits":11,"total_committers":3,"mean_commits":"3.6666666666666665","dds":0.2727272727272727,"last_synced_commit":"3da93fa2bd05f0cca9e14d186987a9fd168e1208"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximerenou%2Fphp-hugging-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximerenou%2Fphp-hugging-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximerenou%2Fphp-hugging-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximerenou%2Fphp-hugging-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maximerenou","download_url":"https://codeload.github.com/maximerenou/php-hugging-chat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234782893,"owners_count":18885808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ai","chatbot","huggingchat","huggingface","llama","openassistant"],"created_at":"2024-09-27T04:21:46.506Z","updated_at":"2025-09-30T21:30:40.747Z","avatar_url":"https://github.com/maximerenou.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![HuggingChat + PHP](logo.png)\n\n# HuggingChat client\n\n[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT)\n[![Latest Stable Version](https://img.shields.io/github/v/release/maximerenou/php-hugging-chat)](https://packagist.org/packages/maximerenou/hugging-chat)\n[![PHP version](https://img.shields.io/packagist/dependency-v/maximerenou/hugging-chat/php)](https://packagist.org/packages/maximerenou/hugging-chat)\n[![cURL extension required](https://img.shields.io/packagist/dependency-v/maximerenou/hugging-chat/ext-curl)](https://packagist.org/packages/maximerenou/hugging-chat)\n\nThis is an unofficial PHP client for **HuggingChat** (OpenAssistant's LLaMA model).\n\n\u003e HuggingChat API [is evolving fast](https://huggingface.co/spaces/huggingchat/chat-ui/commits/main) with recurring breaking changes. I try to keep up with it, but it may not always work as expected. Feel free to open an issue if you encounter any problem.\n\n## Installation\n\n    composer require maximerenou/hugging-chat\n\n## Demo\n\nRun `examples/chat.php` to test it.\n\n![Prompt Demo](examples/demo.gif)\n\n## Usage\n\n```php\nuse MaximeRenou\\HuggingChat\\Client as HuggingChat;\nuse MaximeRenou\\HuggingChat\\Prompt;\n\n$ai = new HuggingChat();\n\n$conversation = $ai-\u003ecreateConversation();\n\n// $answer - full answer\n$answer = $conversation-\u003eask(new Prompt(\"Hello World\"));\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eReal-time / progressive answer\u003c/summary\u003e\n\nYou may pass a function as second argument to get real-time progression:\n\n```php\n// $current_answer - incomplete answer\n// $tokens - last tokens received\n$final_answer = $conversation-\u003eask($prompt, function ($current_answer, $tokens) {\n    echo $tokens;\n});\n```\n\n\u003c/details\u003e \n\n\u003cdetails\u003e\n  \u003csummary\u003eResume a conversation\u003c/summary\u003e  \n\nIf you want to resume a previous conversation, you can retrieve its identifiers:\n\n```php\n// Get current identifiers\n$identifiers = $conversation-\u003egetIdentifiers();\n\n// ...\n// Resume conversation with $identifiers parameter\n$conversation = $ai-\u003eresumeConversation($identifiers);\n```\n\n\u003c/details\u003e \n\n\u003cdetails\u003e\n  \u003csummary\u003eUse another model\u003c/summary\u003e\n\nYou can use a specific model:\n\n```php\n$conversation = $ai-\u003ecreateConversation(\"bigcode/starcoder\");\n```\n\nDefault is OpenAssistant.\n\n\u003c/details\u003e \n\n\u003cdetails\u003e\n  \u003csummary\u003eGenerate a conversation's summary\u003c/summary\u003e\n\nUseful to give a title to a conversation.\n\n```php\n// Question asked: \"Who's Einstein?\"\n// ...\n$summary = $conversation-\u003egetSummary();\n// Result: Famous genius mathematician.\n```\n\n\u003c/details\u003e \n\n\u003cdetails\u003e\n  \u003csummary\u003eTurn on/off data sharing\u003c/summary\u003e\n\nHuggingChat share your conversations to improve the model. You can turn on/off data sharing:\n\n```php\n$conversation-\u003eenableSharing(); // on\n\n$conversation-\u003edisableSharing(); // off (module default)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eDelete a conversation\u003c/summary\u003e\n\n```php\n$conversation-\u003edelete();\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eHandle HuggingChat errors\u003c/summary\u003e\n\nThe code throws exceptions when it receives an error from HuggingChat. You can therefore use a try/catch block to handle errors.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eAnswers are sometimes malformed (or dumb)\u003c/summary\u003e\n\nAnswers quality depends on the model you're using.\n\n\u003c/details\u003e\n\n---------------------------------------\n\n#### Disclaimer\n\nUsing HuggingChat outside huggingface.co/chat may violate HuggingFace terms. Use it at your own risk.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximerenou%2Fphp-hugging-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaximerenou%2Fphp-hugging-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximerenou%2Fphp-hugging-chat/lists"}