Skip to content

Commit 2c9f193

Browse files
committed
feature #947 [Agent][Mapbox] Add symfony/ai-mapbox-tool (OskarStark)
This PR was squashed before being merged into the main branch. Discussion ---------- [Agent][Mapbox] Add `symfony/ai-mapbox-tool` | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | yes | Issues | Follows #944 | License | MIT ### Needs - [ ] A new repo `symfony/ai-mapbox-tool` - [ ] Add Packagist configuration - [ ] Create a new label `Mapbox` - [x] Create a recipe in `symfony/recipes` - [ ] Merge the recipe symfony/recipes#1485 Commits ------- 2289425 [Agent][Mapbox] Add `symfony/ai-mapbox-tool`
2 parents 1f2a8f1 + 2289425 commit 2c9f193

17 files changed

+144
-10
lines changed

examples/toolbox/mapbox-geocode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
*/
1111

1212
use Symfony\AI\Agent\Agent;
13+
use Symfony\AI\Agent\Bridge\Mapbox\Mapbox;
1314
use Symfony\AI\Agent\Toolbox\AgentProcessor;
14-
use Symfony\AI\Agent\Toolbox\Tool\Mapbox;
1515
use Symfony\AI\Agent\Toolbox\Toolbox;
1616
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
1717
use Symfony\AI\Platform\Message\Message;

examples/toolbox/mapbox-reverse-geocode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
*/
1111

1212
use Symfony\AI\Agent\Agent;
13+
use Symfony\AI\Agent\Bridge\Mapbox\Mapbox;
1314
use Symfony\AI\Agent\Toolbox\AgentProcessor;
14-
use Symfony\AI\Agent\Toolbox\Tool\Mapbox;
1515
use Symfony\AI\Agent\Toolbox\Toolbox;
1616
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
1717
use Symfony\AI\Platform\Message\Message;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/Tests export-ignore
2+
/phpunit.xml.dist export-ignore
3+
/.git* export-ignore
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
4+
Please submit your PR here instead:
5+
https://github.com/symfony/ai
6+
7+
This repository is what we call a "subtree split": a read-only subset of that main repository.
8+
We're looking forward to your PR there!
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Close Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: superbrothers/close-pull-request@v3
12+
with:
13+
comment: |
14+
Thanks for your Pull Request! We love contributions.
15+
16+
However, you should instead open your PR on the main repository:
17+
https://github.com/symfony/ai
18+
19+
This repository is what we call a "subtree split": a read-only subset of that main repository.
20+
We're looking forward to your PR there!
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml
4+
.phpunit.result.cache
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG
2+
=========
3+
4+
0.1
5+
---
6+
7+
* Add the bridge
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2025-present Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

src/agent/src/Toolbox/Tool/Mapbox.php renamed to src/agent/src/Bridge/Mapbox/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\Agent\Bridge\Mapbox;
1313

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

src/agent/tests/Toolbox/Tool/MapboxTest.php renamed to src/agent/src/Bridge/Mapbox/Tests/MapboxTest.php

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

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

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\AI\Agent\Toolbox\Tool\Mapbox;
15+
use Symfony\AI\Agent\Bridge\Mapbox\Mapbox;
1616
use Symfony\Component\HttpClient\MockHttpClient;
1717
use Symfony\Component\HttpClient\Response\JsonMockResponse;
1818

1919
final class MapboxTest extends TestCase
2020
{
2121
public function testGeocodeWithSingleResult()
2222
{
23-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-geocode-single.json');
23+
$result = JsonMockResponse::fromFile(__DIR__.'/fixtures/geocode-single.json');
2424
$httpClient = new MockHttpClient($result);
2525

2626
$mapbox = new Mapbox($httpClient, 'test_token');
@@ -46,7 +46,7 @@ public function testGeocodeWithSingleResult()
4646

4747
public function testGeocodeWithMultipleResults()
4848
{
49-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-geocode-multiple.json');
49+
$result = JsonMockResponse::fromFile(__DIR__.'/fixtures/geocode-multiple.json');
5050
$httpClient = new MockHttpClient($result);
5151

5252
$mapbox = new Mapbox($httpClient, 'test_token');
@@ -81,7 +81,7 @@ public function testGeocodeWithMultipleResults()
8181

8282
public function testGeocodeWithNoResults()
8383
{
84-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-geocode-empty.json');
84+
$result = JsonMockResponse::fromFile(__DIR__.'/fixtures/geocode-empty.json');
8585
$httpClient = new MockHttpClient($result);
8686

8787
$mapbox = new Mapbox($httpClient, 'test_token');
@@ -97,7 +97,7 @@ public function testGeocodeWithNoResults()
9797

9898
public function testReverseGeocodeWithValidCoordinates()
9999
{
100-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-reverse-geocode.json');
100+
$result = JsonMockResponse::fromFile(__DIR__.'/fixtures/reverse-geocode.json');
101101
$httpClient = new MockHttpClient($result);
102102

103103
$mapbox = new Mapbox($httpClient, 'test_token');
@@ -139,7 +139,7 @@ public function testReverseGeocodeWithValidCoordinates()
139139

140140
public function testReverseGeocodeWithNoResults()
141141
{
142-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-reverse-geocode-empty.json');
142+
$result = JsonMockResponse::fromFile(__DIR__.'/fixtures/reverse-geocode-empty.json');
143143
$httpClient = new MockHttpClient($result);
144144

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

0 commit comments

Comments
 (0)