Download the PHP package guanhui07/open-ai without Composer
On this page you can find all versions of the php package guanhui07/open-ai. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download guanhui07/open-ai
More information about guanhui07/open-ai
Files in guanhui07/open-ai
Package open-ai
Short Description OpenAI API Client in PHP
License MIT
Homepage https://github.com/swoole-inc/open-ai
Informations about the package open-ai
OpenAI API Client in PHP
为何 fork
此库而不是向原项目发起 PR
,主要是是作者的响应时间太长,一个非常简单的 PR
经常 1-2
周的时间没有任何回复。
我们需要快速验证迭代,后续会抽时间提交给 orhanerday/open-ai
https://github.com/orhanerday/open-ai?tab=readme-ov-file#chat-as-known-as-chatgpt-api
改进
对 orhanerday/open-ai
库做了一些改进,包括如下内容:
- 支持了获取
curl
底层错误码,在出现网络底层的问题后可以根据错误信息排查问题 - 支持设置
HTTP
版本,使用方法$openai->setHttpVersion(2)
,通过设置HTTP2
协议可以绕过 Nginx 的proxy cache
- 改进了
setBaseUrl()
方法,原库是硬编码写死了api.openai.com
,发送请求前通过字符串替换设置BaseUrl
,不是很优雅 - 改进了
chat stream
的实现,原库直接使用了WRITE_FUNCTION
,应用层需要分割Chunks
并手工解析Event-Stream
消息 - 兼容php7
使用
实例
代理
在中国无法直接访问 OpenAI
服务器,可以设置代理。
socks5h://
:socks5
代理并且在对端进行DNS
解析(推荐使用)socks5://
:socks5
代理并且在本地进行DNS
解析http://
:HTTP
代理
我的其他包:
https://github.com/guanhui07/dcr 借鉴Laravel实现的 PHP Framework ,FPM模式、websocket使用的workerman、支持容器、PHP8特性attributes实现了路由注解、中间件注解、Laravel Orm等特性
https://github.com/guanhui07/redis Swoole模式下 Redis连接池
https://github.com/guanhui07/facade facade、门面 fpm模式下可使用
https://github.com/guanhui07/dcr-swoole-crontab 基于swoole实现的crontab秒级定时任务
https://github.com/guanhui07/database 基于 illuminate/database 做的连接池用于适配Swoole的协程环境
https://github.com/guanhui07/dcr-swoole 高性能PHP Framework ,Cli模式,基于Swoole实现,常驻内存,协程框架,支持容器、切面、PHP8特性attributes实现了路由注解、中间件注解、支持Laravel Orm等特性
https://github.com/guanhui07/open-ai chatgpt sdk
https://github.com/guanhui07/geohash geohash附近的人
All versions of open-ai with dependencies
ext-curl Version *