定制 jordan-price/toolbox 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jordan-price/toolbox

Composer 安装命令:

composer require jordan-price/toolbox

包简介

A Laravel package providing various tools including calculator, weather, email, time, and cryptocurrency tools

README 文档

README

A collection of AI-powered tools designed to work with Laravel applications.

Features

  • Weather: Get real-time weather data and forecasts
  • Time: Handle time operations and timezone conversions
  • Crypto: Fetch cryptocurrency price information
  • Email: Send emails with ease
  • Eloquent: Execute database queries using natural language

Installation

You can install the package via composer:

composer require jordan-price/toolbox

Publish the configuration file:

php artisan vendor:publish --tag="toolbox-config"

Configuration

After installation, you can configure the package in your .env file:

# Weather Tool (optional)
WEATHER_API_KEY=your_api_key

Usage

Weather

Get real-time weather data:

use JordanPrice\Toolbox\Tools\Weather\WeatherTool;
use EchoLabs\Prism\Prism;
use EchoLabs\Prism\Enums\Provider;
use EchoLabs\Prism\Enums\ToolChoice;

$weatherTool = new WeatherTool();

$prism = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-5-sonnet-latest')
    ->withPrompt('What is the weather in London?')
    ->withTools([$weatherTool])  // Pass the tool instance
    ->toolChoice(ToolChoice::Any);

$response = $prism->generate();

Time

Handle time operations:

use JordanPrice\Toolbox\Tools\Time\TimeTool;
use EchoLabs\Prism\Prism;
use EchoLabs\Prism\Enums\Provider;
use EchoLabs\Prism\Enums\ToolChoice;

$timeTool = new TimeTool();

$prism = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-5-sonnet-latest')
    ->withPrompt('What time is it in New York?')
    ->withTools([$timeTool])
    ->toolChoice(ToolChoice::Any);

$response = $prism->generate();

Crypto

Get cryptocurrency prices:

use JordanPrice\Toolbox\Tools\Crypto\CryptoTool;
use EchoLabs\Prism\Prism;
use EchoLabs\Prism\Enums\Provider;
use EchoLabs\Prism\Enums\ToolChoice;

$cryptoTool = new CryptoTool();

$prism = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-5-sonnet-latest')
    ->withPrompt('What is the current price of Bitcoin?')
    ->withTools([$cryptoTool])
    ->toolChoice(ToolChoice::Any);

$response = $prism->generate();

Email

Send emails:

use JordanPrice\Toolbox\Tools\Email\EmailTool;
use EchoLabs\Prism\Prism;
use EchoLabs\Prism\Enums\Provider;
use EchoLabs\Prism\Enums\ToolChoice;

$emailTool = new EmailTool();

$prism = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-5-sonnet-latest')
    ->withPrompt('Send a welcome email to user@example.com')
    ->withTools([$emailTool])
    ->toolChoice(ToolChoice::Any);

$response = $prism->generate();

Eloquent

Execute database queries:

use JordanPrice\Toolbox\Tools\Eloquent\EloquentTool;
use EchoLabs\Prism\Prism;
use EchoLabs\Prism\Enums\Provider;
use EchoLabs\Prism\Enums\ToolChoice;

$eloquentTool = new EloquentTool();

$prism = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-5-sonnet-latest')
    ->withPrompt('Find all active users')
    ->withTools([$eloquentTool])
    ->toolChoice(ToolChoice::Any);

$response = $prism->generate();

Contributing

Please see CONTRIBUTING.md for details.

Security

If you discover any security related issues, please email security@bestie.ai instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-29