hyperf-llm / chat
hyperf版本,支持市面主流chat引擎
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/hyperf-llm/chat
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^6|^7.5
- hyperf/config: ^3.0
- hyperf/constants: ^3.0
- hyperf/di: ^3.0
- hyperf/framework: ~3.0.0
- hyperf/http-server: ~3.0.0
- hyperf/websocket-client: ^3.0
- orhanerday/open-ai: ^4.7
- psr/simple-cache: ^1.0|^2.0|^3.0
- symfony/yaml: ^6.3|^5
Requires (Dev)
- swoole/ide-helper: ^4.5
This package is auto-updated.
Last update: 2025-10-21 10:37:06 UTC
README
安装
composer require hyperf-llm/chat
发布
php bin/hyperf.php vendor:publish hyperf-llm/chat
ChatGPT使用
llm配置项'default'设置为'ChatGpt',
$chatBean = new ChatBean();
$chatBean->setPrompt('介绍一下hyperf');
$chatBean->setModel('gpt-3.5-turbo');
$llm = LLMFactory::create();
$llm ->send($chatBean);
星火使用
llm配置项'default'设置为'Spark',
$chatBean = new SparkBean();
$chatBean->setPrompt('介绍一下hyperf');
$llm = LLMFactory::create();
$llm ->send($chatBean);
文心一言
llm配置项'default'设置为'WenXin',
$chatBean = new WenXinBean();
$chatBean->setPrompt('介绍一下hyperf');
$llm = LLMFactory::create();
return $llm ->send($chatBean);