Skip to content

Commit d828788

Browse files
committed
feature #634 [Agent][Brave] Add symfony/ai-brave-tool (OskarStark)
This PR was squashed before being merged into the main branch. Discussion ---------- [Agent][Brave] Add `symfony/ai-brave-tool` | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | yes | Issues | Closes #625 | License | MIT ### Needs - [ ] A new repo `symfony/ai-brave-tool` - [ ] Add Packagist configuration - [ ] Create a new label `Brave` - [x] Create a recipe in `symfony/recipes` - [ ] Merge the recipe symfony/recipes#1451 Commits ------- c3acf10 [Agent][Brave] Add `symfony/ai-brave-tool`
2 parents b24a508 + c3acf10 commit d828788

File tree

18 files changed

+162
-19
lines changed

18 files changed

+162
-19
lines changed

.github/build-packages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Symfony\Component\Finder\Finder;
1010

1111
$finder = (new Finder())
12-
->in([__DIR__.'/../src/*/', __DIR__.'/../examples/', __DIR__.'/../demo/'])
12+
->in([__DIR__.'/../src/*/', __DIR__.'/../src/*/src/Bridge/*/', __DIR__.'/../examples/', __DIR__.'/../demo/'])
1313
->depth(0)
1414
->name('composer.json')
1515
;

.github/workflows/code-quality.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
echo COMPOSER_UP='composer update --no-progress --no-interaction --no-scripts --ansi --ignore-platform-req=ext-mongodb' >> $GITHUB_ENV
3333
echo PHPSTAN='vendor/bin/phpstan' >> $GITHUB_ENV
3434
35-
PACKAGES=$(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*" -printf '%h\n' | sed 's/^src\///' | grep -Ev "examples" | sort | tr '\n' ' ')
35+
PACKAGES=$(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*" -not -path "*/Bridge/*" -printf '%h\n' | sed 's/^src\///' | grep -Ev "examples" | sort | tr '\n' ' ')
3636
echo "Packages: $PACKAGES"
3737
echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
3838

.github/workflows/integration-tests.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ jobs:
6565
- name: Install root dependencies
6666
uses: ramsey/composer-install@v3
6767

68-
- name: Install examples dependencies
68+
- name: Build root packages
69+
run: php .github/build-packages.php
70+
71+
- name: Install root dependencies
6972
uses: ramsey/composer-install@v3
7073
with:
7174
working-directory: examples
7275

73-
- name: Link examples
74-
working-directory: examples
75-
run: ../link
76-
7776
- name: Run commands examples
77+
working-directory: examples
7878
run: |
79-
php examples/commands/stores.php
80-
php examples/commands/message-stores.php
79+
php commands/stores.php
80+
php commands/message-stores.php
8181
8282
demo:
8383
runs-on: ubuntu-latest

examples/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"symfony/ai-chat": "@dev",
2222
"symfony/ai-platform": "@dev",
2323
"symfony/ai-store": "@dev",
24+
"symfony/ai-brave-tool": "@dev",
2425
"symfony/cache": "^7.3|^8.0",
2526
"symfony/clock": "^7.3|^8.0",
2627
"symfony/console": "^7.3|^8.0",

examples/toolbox/brave.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\Brave\Brave;
1314
use Symfony\AI\Agent\Toolbox\AgentProcessor;
14-
use Symfony\AI\Agent\Toolbox\Tool\Brave;
1515
use Symfony\AI\Agent\Toolbox\Tool\Clock;
1616
use Symfony\AI\Agent\Toolbox\Tool\Scraper;
1717
use Symfony\AI\Agent\Toolbox\Toolbox;

link

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ if (!is_dir("$pathToProject/vendor/symfony")) {
3838
$sfPackages = array();
3939

4040
$filesystem = new Filesystem();
41-
$directories = glob(__DIR__.'/src/*', GLOB_ONLYDIR | GLOB_NOSORT);
41+
$braces = array('*', '*/src/Bridge/*');
42+
$directories = array_merge(...array_values(array_map(function ($part) {
43+
return glob(__DIR__.'/src/'.$part, GLOB_ONLYDIR | GLOB_NOSORT);
44+
}, $braces)));
4245

4346
foreach ($directories as $dir) {
4447
if ($filesystem->exists($composer = "$dir/composer.json")) {

src/agent/phpstan.dist.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ parameters:
66
paths:
77
- src/
88
- tests/
9+
excludePaths:
10+
- src/Bridge/*/vendor/
911
ignoreErrors:
1012
-
1113
message: "#^Method .*::test.*\\(\\) has no return type specified\\.$#"
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!

0 commit comments

Comments
 (0)