mbvb1223/chat-ai-multiclient
最新稳定版本:v1.0.0
Composer 安装命令:
composer require mbvb1223/chat-ai-multiclient
包简介
A PHP package to interact with OpenAI, Gemini, and Grok chat APIs
README 文档
README
A PHP package to interact with multiple chat-based AI APIs, including OpenAI, Gemini, and Grok. This library provides a unified interface to generate text responses from these services, with configurable models and extensible design.
Features
- Supports OpenAI, Gemini, and Grok (placeholder) APIs.
- Configurable AI models for each service.
- Simple factory pattern for easy client instantiation.
- Built with Guzzle HTTP client for reliable API communication.
- PSR-4 autoloading via Composer.
- PSR-12 coding standards.
Requirements
- PHP 8.1 or higher
- Composer
- API keys for the services you intend to use (e.g., OpenAI)
Installation
Use Composer to install the package:
composer require mbvb1223/chat-ai-multiclient
Usage
<?php require 'vendor/autoload.php'; use Mbvb1223\ChatAiMulticlient\ChatAiServiceFactory; // Create an OpenAI service instance $openAiService = ChatAiServiceFactory::create(ChatAiServiceFactory::OPENAI, 'your-openai-api-key'); $response = $openAiService->chat("Hello, how are you?"); echo $response;
Run the tests:
vendor/bin/phpunit
vendor/bin/phpunit --testdox // Make test results verbose using TestDox
vendor/bin/phpunit --coverage-html ./tests/Reports // Run and generate HTML report
Contributing
Contributions are welcome! Feel free to submit issues and pull requests.
License
This project is licensed under the MIT License.
Packagist
https://packagist.org/packages/mbvb1223/chat-ai-multiclient
Code coverage
https://mbvb1223.github.io/chat-ai-multiclient/
Author
Khien - phamkhien2309@gmail.com
统计信息
- 总下载量: 50
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-05