johadtech/deepseek-v3
Composer 安装命令:
composer require johadtech/deepseek-v3
包简介
A Laravel package for integrating DeepSeek V3 API.
README 文档
README
A robust Laravel package for integrating the DeepSeek V3 API.
Installation
Step 1: Install via Composer
Run the following command in your terminal:
composer require johadtech/deepseek-v3
Step 2: Publish the Configuration File
Once installed, publish the package configuration file using:
php artisan vendor:publish --provider="Johadtech\DeepSeekV3\Providers\DeepSeekServiceProvider" --tag="deepseek-config"
Step 3: Set Up Your API Key
Open your .env file and add the following entry:
DEEPSEEK_API_KEY=your_api_key_here
Replace your_api_key_here with your actual DeepSeek API key.
Usage
Basic Chat Completion
To send a simple chat message to DeepSeek:
use Johadtech\DeepSeekV3\Facades\DeepSeek; $response = DeepSeek::chat([ ['role' => 'user', 'content' => 'Hello'] ]); echo $response['content'];
Advanced Chat Completion with Parameters
You can also specify additional parameters for more control:
$response = DeepSeek::chat( messages: [ ['role' => 'user', 'content' => 'Explain quantum computing'] ], params: [ 'model' => 'deepseek-reasoner', 'temperature' => 0.7, 'max_tokens' => 1000 ] );
Handling Errors
Ensure you catch exceptions when making API calls:
try { $response = DeepSeek::chat([['role' => 'user', 'content' => 'Tell me a joke']]); echo $response['content']; } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
Testing
To run tests, use:
composer test
Ensure you have PHPUnit installed in your development environment.
Documentation
For full documentation, visit DeepSeek API Docs.
Contributing
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch (
feature-name). - Commit your changes.
- Submit a pull request.
License
This package is licensed under the MIT License. See the LICENSE file for details.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-09