Skip to content

Commit afa7b21

Browse files
Merge branch 'symfony:main' into rate-limit-exception
2 parents 5f0225d + 7ca5522 commit afa7b21

File tree

21 files changed

+76
-20
lines changed

21 files changed

+76
-20
lines changed

.github/workflows/code-quality.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@ jobs:
6565
source .github/workflows/.utils.sh
6666
6767
echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} '(cd src/{} && $COMPOSER_UP && $PHPSTAN)'"
68+
69+
- name: Run PHPStan on examples
70+
run: |
71+
cd examples/ && $COMPOSER_UP && $PHPSTAN
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Run Examples
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
jobs:
8+
run-examples:
9+
if: github.event.label.name == 'Run examples'
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Echo Hello World
17+
run: echo "Hello World"
18+
19+
- name: Remove label
20+
uses: actions/github-script@v7
21+
with:
22+
script: |
23+
await github.rest.issues.removeLabel({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
issue_number: context.issue.number,
27+
name: 'Run examples'
28+
});

examples/composer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,19 @@
3030
"symfony/process": "^6.4 || ^7.0",
3131
"symfony/var-dumper": "^6.4 || ^7.0"
3232
},
33+
"require-dev": {
34+
"phpstan/phpstan": "^2.1"
35+
},
3336
"autoload": {
3437
"psr-4": {
3538
"Symfony\\AI\\Fixtures\\": "../fixtures/"
3639
}
3740
},
41+
"autoload-dev": {
42+
"psr-4": {
43+
"Symfony\\AI\\PHPStan\\": "../.phpstan/"
44+
}
45+
},
3846
"config": {
3947
"allow-plugins": {
4048
"codewithkyrian/platform-package-installer": true,

examples/document/splitting.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
$splitter = new TextSplitTransformer();
1919
$source = dirname(__DIR__, 2).'/fixtures/lorem.txt';
2020

21-
$documents = iterator_to_array($splitter($loader($source)));
21+
$documents = iterator_to_array($splitter->transform($loader->load($source)));
2222

2323
dump($documents);

examples/phpstan.dist.neon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
includes:
2+
- ../.phpstan/extension.neon
3+
4+
parameters:
5+
level: 6
6+
paths:
7+
- ./
8+
excludePaths:
9+
- vendor

examples/rag/cache.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
$store = new CacheStore(new ArrayAdapter());
3535

3636
// create embeddings and documents
37+
$documents = [];
3738
foreach (Movies::all() as $i => $movie) {
3839
$documents[] = new TextDocument(
3940
id: Uuid::v4(),

examples/rag/chromadb.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
$store = new Store(
3535
(new Codewithkyrian\ChromaDB\Factory())
3636
->withHost(env('CHROMADB_HOST'))
37-
->withPort(env('CHROMADB_PORT'))
37+
->withPort((int) env('CHROMADB_PORT'))
3838
->connect(),
3939
'movies',
4040
);

examples/rag/in-memory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
$store = new InMemoryStore();
3434

3535
// create embeddings and documents
36+
$documents = [];
3637
foreach (Movies::all() as $i => $movie) {
3738
$documents[] = new TextDocument(
3839
id: Uuid::v4(),

examples/rag/mariadb-gemini.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
);
4141

4242
// create embeddings and documents
43+
$documents = [];
4344
foreach (Movies::all() as $i => $movie) {
4445
$documents[] = new TextDocument(
4546
id: Uuid::v4(),

examples/rag/mariadb-openai.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
);
4040

4141
// create embeddings and documents
42+
$documents = [];
4243
foreach (Movies::all() as $i => $movie) {
4344
$documents[] = new TextDocument(
4445
id: Uuid::v4(),

0 commit comments

Comments
 (0)