class: JordanPrice\Toolbox\Tools\Crypto\CryptoTool
env vars: None
source: GitHub

Prism Integration

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])  // Pass the tool instance
    ->toolChoice(ToolChoice::Any);

$response = $prism->generate();

Publish

Optionally, you can publish the configuration file to make modifications:
# Publish just this tool
php artisan toolbox:publish crypto

# Or publish all tools
php artisan toolbox:publish --all

Methods

__invoke

Get cryptocurrency price information.
public function __invoke(string $coin, ?string $currency = 'usd'): string

Parameters

  • coin (string): The cryptocurrency to get price for (e.g., BTC, ETH)
  • currency (string): The currency to show price in (e.g., USD, EUR). Default is USD.

Returns

  • string: Formatted price information