PHP code example of shipfastlabs / toolkit-tavily

1. Go to this page and download the library: Download shipfastlabs/toolkit-tavily library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shipfastlabs / toolkit-tavily example snippets


use Shipfastlabs\Toolkit\Tavily\Tavily;

$tools = Tavily::all(); // Collection<int, Tool>

use Shipfastlabs\Toolkit\Tavily\TavilySearch;
use Shipfastlabs\Toolkit\Tavily\TavilyExtract;
use Shipfastlabs\Toolkit\Tavily\TavilyCrawl;
use Shipfastlabs\Toolkit\Tavily\TavilyMap;

$tools = [
    new TavilySearch,
    new TavilyExtract,
    new TavilyCrawl,
    new TavilyMap,
];

// config/services.php

return [

    // ... existing services ...

    'tavily' => [
        'key' => env('TAVILY_API_KEY'),
    ],

];

// config/ai.php

return [

    // ... existing laravel/ai config ...

    'toolkit' => [
        'tavily' => [
            'search' => [
                'max_results' => (int) env('TAVILY_SEARCH_MAX_RESULTS', 5),
                'search_depth' => env('TAVILY_SEARCH_DEPTH', 'basic'),
                '           'max_breadth' => (int) env('TAVILY_CRAWL_MAX_BREADTH', 20),
                'limit' => (int) env('TAVILY_CRAWL_LIMIT', 50),
                'extract_depth' => env('TAVILY_CRAWL_EXTRACT_DEPTH', 'basic'),
            ],
            'map' => [
                'max_depth' => (int) env('TAVILY_MAP_MAX_DEPTH', 1),
                'max_breadth' => (int) env('TAVILY_MAP_MAX_BREADTH', 20),
                'limit' => (int) env('TAVILY_MAP_LIMIT', 50),
            ],
        ],
    ],

];