Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ jobs:
source .github/workflows/.utils.sh

echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} '(cd src/{} && $COMPOSER_UP && $PHPSTAN)'"

- name: Run PHPStan on examples
run: |
cd examples/ && $COMPOSER_UP && $PHPSTAN
8 changes: 8 additions & 0 deletions examples/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,19 @@
"symfony/process": "^6.4 || ^7.0",
"symfony/var-dumper": "^6.4 || ^7.0"
},
"require-dev": {
"phpstan/phpstan": "^2.1"
},
"autoload": {
"psr-4": {
"Symfony\\AI\\Fixtures\\": "../fixtures/"
}
},
"autoload-dev": {
"psr-4": {
"Symfony\\AI\\PHPStan\\": "../.phpstan/"
}
},
"config": {
"allow-plugins": {
"codewithkyrian/platform-package-installer": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/document/splitting.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
$splitter = new TextSplitTransformer();
$source = dirname(__DIR__, 2).'/fixtures/lorem.txt';

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

dump($documents);
9 changes: 9 additions & 0 deletions examples/phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
includes:
- ../.phpstan/extension.neon

parameters:
level: 6
paths:
- ./
excludePaths:
- vendor
1 change: 1 addition & 0 deletions examples/rag/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
$store = new CacheStore(new ArrayAdapter());

// create embeddings and documents
$documents = [];
foreach (Movies::all() as $i => $movie) {
$documents[] = new TextDocument(
id: Uuid::v4(),
Expand Down
2 changes: 1 addition & 1 deletion examples/rag/chromadb.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
$store = new Store(
(new Codewithkyrian\ChromaDB\Factory())
->withHost(env('CHROMADB_HOST'))
->withPort(env('CHROMADB_PORT'))
->withPort((int) env('CHROMADB_PORT'))
->connect(),
'movies',
);
Expand Down
1 change: 1 addition & 0 deletions examples/rag/in-memory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
$store = new InMemoryStore();

// create embeddings and documents
$documents = [];
foreach (Movies::all() as $i => $movie) {
$documents[] = new TextDocument(
id: Uuid::v4(),
Expand Down
1 change: 1 addition & 0 deletions examples/rag/mariadb-gemini.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
);

// create embeddings and documents
$documents = [];
foreach (Movies::all() as $i => $movie) {
$documents[] = new TextDocument(
id: Uuid::v4(),
Expand Down
1 change: 1 addition & 0 deletions examples/rag/mariadb-openai.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
);

// create embeddings and documents
$documents = [];
foreach (Movies::all() as $i => $movie) {
$documents[] = new TextDocument(
id: Uuid::v4(),
Expand Down
1 change: 1 addition & 0 deletions examples/rag/mongodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
);

// create embeddings and documents
$documents = [];
foreach (Movies::all() as $movie) {
$documents[] = new TextDocument(
id: Uuid::v4(),
Expand Down
1 change: 1 addition & 0 deletions examples/rag/pinecone.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
$store = new Store(Pinecone::client(env('PINECONE_API_KEY'), env('PINECONE_HOST')));

// create embeddings and documents
$documents = [];
foreach (Movies::all() as $movie) {
$documents[] = new TextDocument(
id: Uuid::v4(),
Expand Down
1 change: 1 addition & 0 deletions examples/rag/qdrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
$store->setup();

// create embeddings and documents
$documents = [];
foreach (Movies::all() as $movie) {
$documents[] = new TextDocument(
id: Uuid::v4(),
Expand Down
2 changes: 1 addition & 1 deletion examples/vertexai/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function adc_aware_http_client(): HttpClientInterface
{
$credentials = ApplicationDefaultCredentials::getCredentials(['https://www.googleapis.com/auth/cloud-platform']);
$httpClient = HttpClient::create([
'auth_bearer' => $credentials?->fetchAuthToken()['access_token'] ?? null,
'auth_bearer' => $credentials->fetchAuthToken()['access_token'] ?? null,
]);

if ($httpClient instanceof LoggerAwareInterface) {
Expand Down