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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

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 库做了一些改进,包括如下内容:

  1. 支持了获取 curl 底层错误码,在出现网络底层的问题后可以根据错误信息排查问题
  2. 支持设置 HTTP 版本,使用方法 $openai->setHttpVersion(2) ,通过设置 HTTP2 协议可以绕过 Nginx 的 proxy cache
  3. 改进了 setBaseUrl() 方法,原库是硬编码写死了 api.openai.com,发送请求前通过字符串替换设置 BaseUrl,不是很优雅
  4. 改进了 chat stream 的实现,原库直接使用了 WRITE_FUNCTION,应用层需要分割 Chunks并手工解析 Event-Stream 消息
  5. 兼容php7

使用

实例

代理

在中国无法直接访问 OpenAI 服务器,可以设置代理。

我的其他包:

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

PHP Build Version
Package Version
Requires php Version >=7.1
ext-curl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package guanhui07/open-ai contains the following files

Loading the files please wait ....