定制 maximerenou/pi-chat 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

maximerenou/pi-chat

最新稳定版本:0.0.2

Composer 安装命令:

composer require maximerenou/pi-chat

包简介

Pi client

README 文档

README

License Latest Stable Version PHP version cURL extension required

This is an unofficial PHP client for Pi chatbot (from Inflection AI). It doesn't require authentication.

This package isn't actively maintained and may be unstable due to Inflection AI's Cloudflare configuration.

This package is stricly meant for educational purpose. Use at your own risks.

Installation

composer require maximerenou/pi-chat

Demo

Clone this repo, run composer install and run examples/chat.php to test it.

Prompt Demo

Usage

use MaximeRenou\PiChat\Client as PiChat;
use MaximeRenou\PiChat\Prompt;

$chatbot = new PiChat();

$conversation = $chatbot->createConversation();

// $answer - full answer
$answer = $conversation->ask(new Prompt("Hello World"));
Real-time / progressive answer

You may pass a function as second argument to get real-time progression:

// $current_answer - incomplete answer
// $tokens - last tokens received
$final_answer = $conversation->ask($prompt, function ($current_answer, $tokens) {
    echo $tokens;
});
Resume a conversation

If you want to resume a previous conversation, you can retrieve its identifiers:

// Get current identifiers
$identifiers = $conversation->getIdentifiers();

// ...
// Resume conversation with $identifiers parameter
$conversation = $chatbot->resumeConversation($identifiers);
Error handling

The code throws exceptions when it receives an error from Pi. You can therefore use a try/catch block to handle errors.

Disclaimer

This code is for educational purpose only. Using Pi outside pi.ai may violate Inflection AI terms.

统计信息

  • 总下载量: 49
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 25
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 25
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-05-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固