Skip to content

Commit 46f83de

Browse files
committed
Move remaining third-party tools to AI Toolbox package
Moves Firecrawl, Mapbox, OpenMeteo, SerpApi, Tavily, and YouTubeTranscriber tools from the agent package to the dedicated toolbox package. This completes the separation of third-party integrations into their own package for better organization and maintainability. - Updates namespaces from Symfony\AI\Agent\Toolbox\Tool to Symfony\AI\Toolbox\Tool - Migrates corresponding tests with proper fixture organization - Updates demo configuration to reference new package structure
1 parent c597b0c commit 46f83de

23 files changed

+27
-27
lines changed

demo/config/packages/ai.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ services:
7575
autoconfigure: true
7676

7777
# Symfony\AI\Agent\Toolbox\Tool\Clock: ~
78-
# Symfony\AI\Agent\Toolbox\Tool\OpenMeteo: ~
79-
# Symfony\AI\Agent\Toolbox\Tool\SerpApi:
78+
# Symfony\AI\Toolbox\Tool\OpenMeteo: ~
79+
# Symfony\AI\Toolbox\Tool\SerpApi:
8080
# $apiKey: '%env(SERP_API_KEY)%'
8181
Symfony\AI\Toolbox\Tool\Wikipedia: ~
8282
Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch:

src/agent/src/Toolbox/Tool/Firecrawl.php renamed to src/toolbox/src/Tool/Firecrawl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\AI\Agent\Toolbox\Tool;
12+
namespace Symfony\AI\Toolbox\Tool;
1313

1414
use Symfony\AI\Agent\Toolbox\Attribute\AsTool;
1515
use Symfony\Contracts\HttpClient\HttpClientInterface;

src/agent/src/Toolbox/Tool/Mapbox.php renamed to src/toolbox/src/Tool/Mapbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\AI\Agent\Toolbox\Tool;
12+
namespace Symfony\AI\Toolbox\Tool;
1313

1414
use Symfony\AI\Agent\Toolbox\Attribute\AsTool;
1515
use Symfony\AI\Platform\Contract\JsonSchema\Attribute\With;

src/agent/src/Toolbox/Tool/OpenMeteo.php renamed to src/toolbox/src/Tool/OpenMeteo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\AI\Agent\Toolbox\Tool;
12+
namespace Symfony\AI\Toolbox\Tool;
1313

1414
use Symfony\AI\Agent\Toolbox\Attribute\AsTool;
1515
use Symfony\AI\Platform\Contract\JsonSchema\Attribute\With;

src/agent/src/Toolbox/Tool/SerpApi.php renamed to src/toolbox/src/Tool/SerpApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\AI\Agent\Toolbox\Tool;
12+
namespace Symfony\AI\Toolbox\Tool;
1313

1414
use Symfony\AI\Agent\Toolbox\Attribute\AsTool;
1515
use Symfony\Contracts\HttpClient\HttpClientInterface;

src/agent/src/Toolbox/Tool/Tavily.php renamed to src/toolbox/src/Tool/Tavily.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\AI\Agent\Toolbox\Tool;
12+
namespace Symfony\AI\Toolbox\Tool;
1313

1414
use Symfony\AI\Agent\Toolbox\Attribute\AsTool;
1515
use Symfony\Contracts\HttpClient\HttpClientInterface;

src/agent/src/Toolbox/Tool/YouTubeTranscriber.php renamed to src/toolbox/src/Tool/YouTubeTranscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\AI\Agent\Toolbox\Tool;
12+
namespace Symfony\AI\Toolbox\Tool;
1313

1414
use MrMySQL\YoutubeTranscript\TranscriptListFetcher;
1515
use Symfony\AI\Agent\Exception\LogicException;

src/agent/tests/Toolbox/Tool/FirecrawlTest.php renamed to src/toolbox/tests/Tool/FirecrawlTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\AI\Agent\Tests\Toolbox\Tool;
12+
namespace Symfony\AI\Toolbox\Tests\Tool;
1313

1414
use PHPUnit\Framework\Attributes\CoversClass;
1515
use PHPUnit\Framework\TestCase;
16-
use Symfony\AI\Agent\Toolbox\Tool\Firecrawl;
16+
use Symfony\AI\Toolbox\Tool\Firecrawl;
1717
use Symfony\Component\HttpClient\MockHttpClient;
1818
use Symfony\Component\HttpClient\Response\JsonMockResponse;
1919

@@ -23,7 +23,7 @@ final class FirecrawlTest extends TestCase
2323
public function testScrape()
2424
{
2525
$httpClient = new MockHttpClient([
26-
JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/firecrawl-scrape.json'),
26+
JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/firecrawl/firecrawl-scrape.json'),
2727
]);
2828

2929
$firecrawl = new Firecrawl($httpClient, 'test', 'https://127.0.0.1:3002');
@@ -39,10 +39,10 @@ public function testScrape()
3939
public function testCrawl()
4040
{
4141
$httpClient = new MockHttpClient([
42-
JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/firecrawl-crawl-wait.json'),
43-
JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/firecrawl-crawl-status.json'),
44-
JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/firecrawl-crawl-status-done.json'),
45-
JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/firecrawl-crawl.json'),
42+
JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/firecrawl/firecrawl-crawl-wait.json'),
43+
JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/firecrawl/firecrawl-crawl-status.json'),
44+
JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/firecrawl/firecrawl-crawl-status-done.json'),
45+
JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/firecrawl/firecrawl-crawl.json'),
4646
]);
4747

4848
$firecrawl = new Firecrawl($httpClient, 'test', 'https://127.0.0.1:3002');
@@ -62,7 +62,7 @@ public function testCrawl()
6262
public function testMap()
6363
{
6464
$httpClient = new MockHttpClient([
65-
JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/firecrawl-map.json'),
65+
JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/firecrawl/firecrawl-map.json'),
6666
]);
6767

6868
$firecrawl = new Firecrawl($httpClient, 'test', 'https://127.0.0.1:3002');

src/agent/tests/Toolbox/Tool/MapboxTest.php renamed to src/toolbox/tests/Tool/MapboxTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\AI\Agent\Tests\Toolbox\Tool;
12+
namespace Symfony\AI\Toolbox\Tests\Tool;
1313

1414
use PHPUnit\Framework\Attributes\CoversClass;
1515
use PHPUnit\Framework\TestCase;
16-
use Symfony\AI\Agent\Toolbox\Tool\Mapbox;
16+
use Symfony\AI\Toolbox\Tool\Mapbox;
1717
use Symfony\Component\HttpClient\MockHttpClient;
1818
use Symfony\Component\HttpClient\Response\JsonMockResponse;
1919

@@ -22,7 +22,7 @@ final class MapboxTest extends TestCase
2222
{
2323
public function testGeocodeWithSingleResult()
2424
{
25-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-geocode-single.json');
25+
$result = JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/mapbox/mapbox-geocode-single.json');
2626
$httpClient = new MockHttpClient($result);
2727

2828
$mapbox = new Mapbox($httpClient, 'test_token');
@@ -48,7 +48,7 @@ public function testGeocodeWithSingleResult()
4848

4949
public function testGeocodeWithMultipleResults()
5050
{
51-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-geocode-multiple.json');
51+
$result = JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/mapbox/mapbox-geocode-multiple.json');
5252
$httpClient = new MockHttpClient($result);
5353

5454
$mapbox = new Mapbox($httpClient, 'test_token');
@@ -83,7 +83,7 @@ public function testGeocodeWithMultipleResults()
8383

8484
public function testGeocodeWithNoResults()
8585
{
86-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-geocode-empty.json');
86+
$result = JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/mapbox/mapbox-geocode-empty.json');
8787
$httpClient = new MockHttpClient($result);
8888

8989
$mapbox = new Mapbox($httpClient, 'test_token');
@@ -99,7 +99,7 @@ public function testGeocodeWithNoResults()
9999

100100
public function testReverseGeocodeWithValidCoordinates()
101101
{
102-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-reverse-geocode.json');
102+
$result = JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/mapbox/mapbox-reverse-geocode.json');
103103
$httpClient = new MockHttpClient($result);
104104

105105
$mapbox = new Mapbox($httpClient, 'test_token');
@@ -141,7 +141,7 @@ public function testReverseGeocodeWithValidCoordinates()
141141

142142
public function testReverseGeocodeWithNoResults()
143143
{
144-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-reverse-geocode-empty.json');
144+
$result = JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/mapbox/mapbox-reverse-geocode-empty.json');
145145
$httpClient = new MockHttpClient($result);
146146

147147
$mapbox = new Mapbox($httpClient, 'test_token');

src/agent/tests/Toolbox/Tool/OpenMeteoTest.php renamed to src/toolbox/tests/Tool/OpenMeteoTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\AI\Agent\Tests\Toolbox\Tool;
12+
namespace Symfony\AI\Toolbox\Tests\Tool;
1313

1414
use PHPUnit\Framework\Attributes\CoversClass;
1515
use PHPUnit\Framework\TestCase;
16-
use Symfony\AI\Agent\Toolbox\Tool\OpenMeteo;
16+
use Symfony\AI\Toolbox\Tool\OpenMeteo;
1717
use Symfony\Component\HttpClient\MockHttpClient;
1818
use Symfony\Component\HttpClient\Response\JsonMockResponse;
1919

@@ -22,7 +22,7 @@ final class OpenMeteoTest extends TestCase
2222
{
2323
public function testCurrent()
2424
{
25-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/openmeteo-current.json');
25+
$result = JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/openmeteo/openmeteo-current.json');
2626
$httpClient = new MockHttpClient($result);
2727

2828
$openMeteo = new OpenMeteo($httpClient);
@@ -40,7 +40,7 @@ public function testCurrent()
4040

4141
public function testForecast()
4242
{
43-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/openmeteo-forecast.json');
43+
$result = JsonMockResponse::fromFile(__DIR__.'/../fixtures/Tool/openmeteo/openmeteo-forecast.json');
4444
$httpClient = new MockHttpClient($result);
4545

4646
$openMeteo = new OpenMeteo($httpClient);

0 commit comments

Comments
 (0)