hbb/cmer-llm-chat 问题修复 & 功能扩展

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

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

hbb/cmer-llm-chat

最新稳定版本:v1.0.4

Composer 安装命令:

composer require hbb/cmer-llm-chat

包简介

Cmer Group LLM Chat PHP SDK

README 文档

README

创贸集团的LLM聊天服务PHP SDK
负责发起聊天请求。
请求参数参考文档地址:https://apihub.cmer.com/docs/llm-chat.html

安装

composer require hbb/cmer-llm-chat

使用

<?php

require_once "vendor/autoload.php";

$apikey="xxxxxxxxxx";
$client = new \Hbb\CmerLlmChat\CmerClient($apikey);
# 修改超时时间,默认60秒
$client->timeout=300;
# 组装请求体参数
$messages = [
    ['role' => 'system', 'content' => "You are now the marketing customer service of 深圳创贸集团"],
    ['role' => 'user', 'content' => '创贸集团有多少技术?'],
    ['role' => 'assistant', 'content' => '创贸集团有200+技术。'],
    ['role' => 'user', 'content' => '今天天气怎么样']
];
$payload = new \Hbb\CmerLlmChat\models\ChatModel($messages);
# 修改模型名称,豆包,Gpt,Claude
# todo 更多参数请查看 \Hbb\CmerLlmChat\CmerClient 类
$payload->model = "gpt-3.5-turbo-0125";
$payload->supplier = "azure";
# 发送请求
$response = $client->chat($payload);
print_r($response->getBody()->getContents());

# 发送流式请求
$payload->stream = true;
$response = $client->chat($payload);
$body = $response->getBody();
while (!$body->eof()) {
    echo $body->read(1024);
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-17