diff --git a/examples/toolbox/mapbox-geocode.php b/examples/toolbox/mapbox-geocode.php index 2b43033a0..ebcbb1b17 100644 --- a/examples/toolbox/mapbox-geocode.php +++ b/examples/toolbox/mapbox-geocode.php @@ -10,8 +10,8 @@ */ use Symfony\AI\Agent\Agent; +use Symfony\AI\Agent\Bridge\Mapbox\Mapbox; use Symfony\AI\Agent\Toolbox\AgentProcessor; -use Symfony\AI\Agent\Toolbox\Tool\Mapbox; use Symfony\AI\Agent\Toolbox\Toolbox; use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory; use Symfony\AI\Platform\Message\Message; diff --git a/examples/toolbox/mapbox-reverse-geocode.php b/examples/toolbox/mapbox-reverse-geocode.php index b205b4c45..d2bdd6aad 100644 --- a/examples/toolbox/mapbox-reverse-geocode.php +++ b/examples/toolbox/mapbox-reverse-geocode.php @@ -10,8 +10,8 @@ */ use Symfony\AI\Agent\Agent; +use Symfony\AI\Agent\Bridge\Mapbox\Mapbox; use Symfony\AI\Agent\Toolbox\AgentProcessor; -use Symfony\AI\Agent\Toolbox\Tool\Mapbox; use Symfony\AI\Agent\Toolbox\Toolbox; use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory; use Symfony\AI\Platform\Message\Message; diff --git a/src/agent/src/Bridge/Mapbox/.gitattributes b/src/agent/src/Bridge/Mapbox/.gitattributes new file mode 100644 index 000000000..14c3c3594 --- /dev/null +++ b/src/agent/src/Bridge/Mapbox/.gitattributes @@ -0,0 +1,3 @@ +/Tests export-ignore +/phpunit.xml.dist export-ignore +/.git* export-ignore diff --git a/src/agent/src/Bridge/Mapbox/.github/PULL_REQUEST_TEMPLATE.md b/src/agent/src/Bridge/Mapbox/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..fcb87228a --- /dev/null +++ b/src/agent/src/Bridge/Mapbox/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +Please do not submit any Pull Requests here. They will be closed. +--- + +Please submit your PR here instead: +https://github.com/symfony/ai + +This repository is what we call a "subtree split": a read-only subset of that main repository. +We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Mapbox/.github/close-pull-request.yml b/src/agent/src/Bridge/Mapbox/.github/close-pull-request.yml new file mode 100644 index 000000000..bb5a02835 --- /dev/null +++ b/src/agent/src/Bridge/Mapbox/.github/close-pull-request.yml @@ -0,0 +1,20 @@ +name: Close Pull Request + +on: + pull_request_target: + types: [opened] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: | + Thanks for your Pull Request! We love contributions. + + However, you should instead open your PR on the main repository: + https://github.com/symfony/ai + + This repository is what we call a "subtree split": a read-only subset of that main repository. + We're looking forward to your PR there! diff --git a/src/agent/src/Bridge/Mapbox/.gitignore b/src/agent/src/Bridge/Mapbox/.gitignore new file mode 100644 index 000000000..76367ee5b --- /dev/null +++ b/src/agent/src/Bridge/Mapbox/.gitignore @@ -0,0 +1,4 @@ +vendor/ +composer.lock +phpunit.xml +.phpunit.result.cache diff --git a/src/agent/src/Bridge/Mapbox/CHANGELOG.md b/src/agent/src/Bridge/Mapbox/CHANGELOG.md new file mode 100644 index 000000000..0915f3546 --- /dev/null +++ b/src/agent/src/Bridge/Mapbox/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +0.1 +--- + + * Add the bridge diff --git a/src/agent/src/Bridge/Mapbox/LICENSE b/src/agent/src/Bridge/Mapbox/LICENSE new file mode 100644 index 000000000..bc38d714e --- /dev/null +++ b/src/agent/src/Bridge/Mapbox/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2025-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/agent/src/Toolbox/Tool/Mapbox.php b/src/agent/src/Bridge/Mapbox/Mapbox.php similarity index 99% rename from src/agent/src/Toolbox/Tool/Mapbox.php rename to src/agent/src/Bridge/Mapbox/Mapbox.php index 3da0eeb37..fca22077a 100644 --- a/src/agent/src/Toolbox/Tool/Mapbox.php +++ b/src/agent/src/Bridge/Mapbox/Mapbox.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Mapbox; use Symfony\AI\Agent\Toolbox\Attribute\AsTool; use Symfony\AI\Platform\Contract\JsonSchema\Attribute\With; diff --git a/src/agent/tests/Toolbox/Tool/MapboxTest.php b/src/agent/src/Bridge/Mapbox/Tests/MapboxTest.php similarity index 87% rename from src/agent/tests/Toolbox/Tool/MapboxTest.php rename to src/agent/src/Bridge/Mapbox/Tests/MapboxTest.php index 39063baad..84785fb04 100644 --- a/src/agent/tests/Toolbox/Tool/MapboxTest.php +++ b/src/agent/src/Bridge/Mapbox/Tests/MapboxTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Symfony\AI\Agent\Tests\Toolbox\Tool; +namespace Symfony\AI\Agent\Bridge\Mapbox\Tests; use PHPUnit\Framework\TestCase; -use Symfony\AI\Agent\Toolbox\Tool\Mapbox; +use Symfony\AI\Agent\Bridge\Mapbox\Mapbox; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\JsonMockResponse; @@ -20,7 +20,7 @@ final class MapboxTest extends TestCase { public function testGeocodeWithSingleResult() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-geocode-single.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/fixtures/geocode-single.json'); $httpClient = new MockHttpClient($result); $mapbox = new Mapbox($httpClient, 'test_token'); @@ -46,7 +46,7 @@ public function testGeocodeWithSingleResult() public function testGeocodeWithMultipleResults() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-geocode-multiple.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/fixtures/geocode-multiple.json'); $httpClient = new MockHttpClient($result); $mapbox = new Mapbox($httpClient, 'test_token'); @@ -81,7 +81,7 @@ public function testGeocodeWithMultipleResults() public function testGeocodeWithNoResults() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-geocode-empty.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/fixtures/geocode-empty.json'); $httpClient = new MockHttpClient($result); $mapbox = new Mapbox($httpClient, 'test_token'); @@ -97,7 +97,7 @@ public function testGeocodeWithNoResults() public function testReverseGeocodeWithValidCoordinates() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-reverse-geocode.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/fixtures/reverse-geocode.json'); $httpClient = new MockHttpClient($result); $mapbox = new Mapbox($httpClient, 'test_token'); @@ -139,7 +139,7 @@ public function testReverseGeocodeWithValidCoordinates() public function testReverseGeocodeWithNoResults() { - $result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/mapbox-reverse-geocode-empty.json'); + $result = JsonMockResponse::fromFile(__DIR__.'/fixtures/reverse-geocode-empty.json'); $httpClient = new MockHttpClient($result); $mapbox = new Mapbox($httpClient, 'test_token'); diff --git a/src/agent/tests/fixtures/Tool/mapbox-geocode-empty.json b/src/agent/src/Bridge/Mapbox/Tests/fixtures/geocode-empty.json similarity index 100% rename from src/agent/tests/fixtures/Tool/mapbox-geocode-empty.json rename to src/agent/src/Bridge/Mapbox/Tests/fixtures/geocode-empty.json diff --git a/src/agent/tests/fixtures/Tool/mapbox-geocode-multiple.json b/src/agent/src/Bridge/Mapbox/Tests/fixtures/geocode-multiple.json similarity index 100% rename from src/agent/tests/fixtures/Tool/mapbox-geocode-multiple.json rename to src/agent/src/Bridge/Mapbox/Tests/fixtures/geocode-multiple.json diff --git a/src/agent/tests/fixtures/Tool/mapbox-geocode-single.json b/src/agent/src/Bridge/Mapbox/Tests/fixtures/geocode-single.json similarity index 100% rename from src/agent/tests/fixtures/Tool/mapbox-geocode-single.json rename to src/agent/src/Bridge/Mapbox/Tests/fixtures/geocode-single.json diff --git a/src/agent/tests/fixtures/Tool/mapbox-reverse-geocode-empty.json b/src/agent/src/Bridge/Mapbox/Tests/fixtures/reverse-geocode-empty.json similarity index 100% rename from src/agent/tests/fixtures/Tool/mapbox-reverse-geocode-empty.json rename to src/agent/src/Bridge/Mapbox/Tests/fixtures/reverse-geocode-empty.json diff --git a/src/agent/tests/fixtures/Tool/mapbox-reverse-geocode.json b/src/agent/src/Bridge/Mapbox/Tests/fixtures/reverse-geocode.json similarity index 100% rename from src/agent/tests/fixtures/Tool/mapbox-reverse-geocode.json rename to src/agent/src/Bridge/Mapbox/Tests/fixtures/reverse-geocode.json diff --git a/src/agent/src/Bridge/Mapbox/composer.json b/src/agent/src/Bridge/Mapbox/composer.json new file mode 100644 index 000000000..eea852b01 --- /dev/null +++ b/src/agent/src/Bridge/Mapbox/composer.json @@ -0,0 +1,41 @@ +{ + "name": "symfony/ai-mapbox-tool", + "description": "Mapbox AI tool bridge for Symfony applications.", + "license": "MIT", + "type": "library", + "keywords": ["ai", "bridge", "mapbox", "agent", "tool", "geocoding"], + "authors": [ + { + "name": "Oskar Stark", + "email": "oskarstark@googlemail.com" + } + ], + "require": { + "php": ">=8.2", + "symfony/ai-agent": "@dev", + "symfony/http-client": "^7.3|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.5.13" + }, + "autoload": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Mapbox\\": "" + } + }, + "autoload-dev": { + "psr-4": { + "Symfony\\AI\\Agent\\Bridge\\Mapbox\\Tests\\": "Tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "thanks": { + "name": "symfony/ai", + "url": "https://github.com/symfony/ai" + } + }, + "minimum-stability": "dev" +} diff --git a/src/agent/src/Bridge/Mapbox/phpunit.xml.dist b/src/agent/src/Bridge/Mapbox/phpunit.xml.dist new file mode 100644 index 000000000..452f2a35c --- /dev/null +++ b/src/agent/src/Bridge/Mapbox/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + + ./Resources + ./Tests + ./vendor + + +