Skip to content

Commit a34cb44

Browse files
committed
Refactor Brave tool into Bridge namespace structure
Move Brave search tool from Toolbox/Tool to new Bridge/Brave namespace: - Create Bridge/Brave directory structure with Tests and fixtures - Update namespaces and import statements - Rename fixture file from brave.json to search-results.json - Add GitHub PR template for subtree split repository - Add .gitattributes with export-ignore rules - Add .gitignore for vendor/, composer.lock, and phpunit.xml - Add GitHub Actions workflow to auto-close PRs with redirect message - Add CHANGELOG.md and LICENSE files - Add composer.json with package name symfony/brave-ai-tool - Add phpunit.xml.dist configuration - Fix code style with PHP CS Fixer - Remove old files from Toolbox/Tool location
1 parent 7736543 commit a34cb44

File tree

11 files changed

+153
-5
lines changed

11 files changed

+153
-5
lines changed
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml

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

1414
use Symfony\AI\Agent\Toolbox\Attribute\AsTool;
1515
use Symfony\AI\Platform\Contract\JsonSchema\Attribute\With;
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

src/agent/src/Bridge/Brave/LICENSE

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

1414
use PHPUnit\Framework\Attributes\CoversClass;
1515
use PHPUnit\Framework\TestCase;
16-
use Symfony\AI\Agent\Toolbox\Tool\Brave;
16+
use Symfony\AI\Agent\Bridge\Brave\Brave;
1717
use Symfony\Component\HttpClient\MockHttpClient;
1818
use Symfony\Component\HttpClient\Response\JsonMockResponse;
1919
use Symfony\Component\HttpClient\Response\MockResponse;
@@ -23,7 +23,7 @@ final class BraveTest extends TestCase
2323
{
2424
public function testReturnsSearchResults()
2525
{
26-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/brave.json');
26+
$result = JsonMockResponse::fromFile(__DIR__.'/fixtures/search-results.json');
2727
$httpClient = new MockHttpClient($result);
2828
$brave = new Brave($httpClient, 'test-api-key');
2929

@@ -40,7 +40,7 @@ public function testReturnsSearchResults()
4040

4141
public function testPassesCorrectParametersToApi()
4242
{
43-
$result = JsonMockResponse::fromFile(__DIR__.'/../../fixtures/Tool/brave.json');
43+
$result = JsonMockResponse::fromFile(__DIR__.'/fixtures/search-results.json');
4444
$httpClient = new MockHttpClient($result);
4545
$brave = new Brave($httpClient, 'test-api-key', ['extra' => 'option']);
4646

File renamed without changes.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "symfony/brave-ai-tool",
3+
"description": "Brave Search AI tool bridge for Symfony applications.",
4+
"license": "MIT",
5+
"type": "library",
6+
"keywords": [
7+
"ai",
8+
"bridge",
9+
"brave",
10+
"agent",
11+
"tool"
12+
],
13+
"authors": [
14+
{
15+
"name": "Christopher Hertel",
16+
"email": "[email protected]"
17+
},
18+
{
19+
"name": "Oskar Stark",
20+
"email": "[email protected]"
21+
}
22+
],
23+
"require": {
24+
"php": ">=8.2",
25+
"symfony/ai-agent": "@dev",
26+
"symfony/http-client": "^7.3|^8.0"
27+
},
28+
"require-dev": {
29+
"phpstan/phpstan": "^2.0",
30+
"phpunit/phpunit": "^11.5.13"
31+
},
32+
"autoload": {
33+
"psr-4": {
34+
"Symfony\\AI\\Agent\\Bridge\\Brave\\": ""
35+
}
36+
},
37+
"autoload-dev": {
38+
"psr-4": {
39+
"Symfony\\AI\\Agent\\Bridge\\Brave\\Tests\\": "Tests/"
40+
}
41+
},
42+
"config": {
43+
"sort-packages": true
44+
},
45+
"extra": {
46+
"thanks": {
47+
"name": "symfony/ai",
48+
"url": "https://github.com/symfony/ai"
49+
}
50+
},
51+
"minimum-stability": "dev"
52+
}

0 commit comments

Comments
 (0)