stuarttodd/openai-php-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

stuarttodd/openai-php-client

最新稳定版本:1.0.0

Composer 安装命令:

composer require stuarttodd/openai-php-client

包简介

An OpenAPI PHP Client. This is under construction, however there is some limited functionality available.

README 文档

README

An OpenAPI PHP Client. This is under construction, however there is some limited functionality available.

Composer Installation

composer require stuarttodd/openai-php-client

Chat Completions

<?php

use Stuarttodd\OpenAiPhpClient\OpenAI;

$apiKey = "YOUR_API_KEY_HERE";

$response = OpenAI::client($apiKey)
    ->chatCompletions()
    ->setConfig([
        'model' => 'gpt-3.5-turbo', // if not set, defaults to 'gpt-3.5-turbo'
        'temperature' => 0.9, // if not set, defaults to 0.7
        'message' => 'Tell me you love me' // If not set, defaults to giving you a random Chuck Norris joke
    ])
    ->fetch(function($response) { // use of closure is optional
        return json_decode($response)->choices[0]->message->content;
    }); 

echo $response; // "As an AI, I do not have the capability to feel emotions or love. However, I am here to assist you with any questions or tasks you may have."

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-07-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固