{"id":20484344,"url":"https://github.com/maximerenou/php-pi-chat","last_synced_at":"2025-04-13T14:42:14.240Z","repository":{"id":161800050,"uuid":"636441440","full_name":"maximerenou/php-pi-chat","owner":"maximerenou","description":"PHP client for Pi.ai chatbot (Inflection AI)","archived":false,"fork":false,"pushed_at":"2024-03-24T21:15:01.000Z","size":339,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-25T06:42:53.538Z","etag":null,"topics":["ai","chatbot","inflection-ai","pi"],"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}},"created_at":"2023-05-04T21:21:34.000Z","updated_at":"2024-04-04T19:27:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"94de1b76-41d9-4abc-99ab-90e6cdf09dc6","html_url":"https://github.com/maximerenou/php-pi-chat","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximerenou%2Fphp-pi-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximerenou%2Fphp-pi-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximerenou%2Fphp-pi-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximerenou%2Fphp-pi-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maximerenou","download_url":"https://codeload.github.com/maximerenou/php-pi-chat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248731593,"owners_count":21152835,"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","inflection-ai","pi"],"created_at":"2024-11-15T16:21:37.667Z","updated_at":"2025-04-13T14:42:14.215Z","avatar_url":"https://github.com/maximerenou.png","language":"PHP","readme":"# Pi chatbot 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-pi-chat)](https://packagist.org/packages/maximerenou/pi-chat)\n[![PHP version](https://img.shields.io/packagist/dependency-v/maximerenou/pi-chat/php)](https://packagist.org/packages/maximerenou/pi-chat)\n[![cURL extension required](https://img.shields.io/packagist/dependency-v/maximerenou/pi-chat/ext-curl)](https://packagist.org/packages/maximerenou/pi-chat)\n\nThis is an unofficial PHP client for **Pi** chatbot (from **Inflection AI**). It doesn't require authentication.\n\n\u003e This package isn't actively maintained and may be unstable due to Inflection AI's Cloudflare configuration.\n\n\u003e This package is stricly meant for educational purpose. Use at your own risks.\n\n## Installation\n\n    composer require maximerenou/pi-chat\n\n## Demo\n\nClone this repo, run `composer install` and run `examples/chat.php` to test it.\n\n![Prompt Demo](examples/demo.gif)\n\n## Usage\n\n```php\nuse MaximeRenou\\PiChat\\Client as PiChat;\nuse MaximeRenou\\PiChat\\Prompt;\n\n$chatbot = new PiChat();\n\n$conversation = $chatbot-\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 = $chatbot-\u003eresumeConversation($identifiers);\n```\n\n\u003c/details\u003e \n\n\u003cdetails\u003e\n  \u003csummary\u003eError handling\u003c/summary\u003e\n\nThe code throws exceptions when it receives an error from Pi. You can therefore use a try/catch block to handle errors.\n\n\u003c/details\u003e\n\n---------------------------------------\n\n#### Disclaimer\n\nThis code is for educational purpose only. Using Pi outside pi.ai may violate Inflection AI terms.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximerenou%2Fphp-pi-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaximerenou%2Fphp-pi-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximerenou%2Fphp-pi-chat/lists"}