From ac29660667ca86e8fc1d06aa8e15c430cf066beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Sat, 8 Feb 2025 07:49:44 +0100 Subject: [PATCH 1/9] Add an alias for the ClientContract (#22) --- src/Resources/config/services.php | 2 ++ tests/DependencyInjection/OpenAIExtensionTest.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Resources/config/services.php b/src/Resources/config/services.php index 5f00864..67fee2f 100644 --- a/src/Resources/config/services.php +++ b/src/Resources/config/services.php @@ -6,6 +6,7 @@ use OpenAI; use OpenAI\Client; +use OpenAI\Contracts\ClientContract; use OpenAI\Factory; use Symfony\Component\HttpClient\Psr18Client; @@ -22,5 +23,6 @@ ->set(Client::class) ->factory([service(Factory::class), 'make']) + ->alias(ClientContract::class, Client::class) ->alias('openai', Client::class); }; diff --git a/tests/DependencyInjection/OpenAIExtensionTest.php b/tests/DependencyInjection/OpenAIExtensionTest.php index 1138a03..6514b13 100644 --- a/tests/DependencyInjection/OpenAIExtensionTest.php +++ b/tests/DependencyInjection/OpenAIExtensionTest.php @@ -5,6 +5,7 @@ namespace OpenAI\Symfony\Tests\DependencyInjection; use OpenAI\Client; +use OpenAI\Contracts\ClientContract; use OpenAI\Symfony\DependencyInjection\OpenAIExtension; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -13,7 +14,7 @@ final class OpenAIExtensionTest extends TestCase { - public function testService(): void + public function test_service(): void { // Using a mock to test the service configuration $httpClient = new MockHttpClient(function (string $method, string $url, array $options = []) { @@ -45,5 +46,7 @@ public function testService(): void $response = $openai->files()->delete('file.txt'); self::assertSame('file.txt', $response->id); + + self::assertSame($openai, $container->get(ClientContract::class), 'Alias for the ClientContract interface'); } } From 14c4243ef2fa66331a9ac306065b2c608c9bffcc Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Thu, 3 Apr 2025 02:33:01 -0400 Subject: [PATCH 2/9] Correct GitHub Action deprecations + Opt into Dependabot (#23) * fix: update to latest github action versions * feat: opt into Dependabot for GitHub Action health --- .github/dependabot.yml | 6 ++++++ .github/workflows/formats.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ca79ca5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/formats.yml b/.github/workflows/formats.yml index c4100ca..5440721 100644 --- a/.github/workflows/formats.yml +++ b/.github/workflows/formats.yml @@ -18,10 +18,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache dependencies - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.composer/cache/files key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8b0c196..b7f2291 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,10 +28,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache dependencies - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.composer/cache/files key: dependencies-php-${{ matrix.php }}-SF${{ matrix.symfony }}-${{ matrix.dependency-version }}-composer-${{ hashFiles('composer.json') }} From 7185af1911017fe8d9cddafe1a1636ca2900d669 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Sun, 6 Apr 2025 05:24:32 -0400 Subject: [PATCH 3/9] Run "test" workflow without startup errors. (#24) * chore: drop matrix.os to reduce matrix complexity * chore: drop symfony 6.3, add 7.2 * chore: skip php 8.1 on symfony 7.2 * chore: skip php 8.4 on symfony 5.4 * chore: skip php 8.4 on symfony 6.4 * chore: restore symfony 7.0 * chore: restore symfony 7.0, but skip 8.4 --- .github/workflows/tests.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b7f2291..512051f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,27 +4,25 @@ on: ['push', 'pull_request'] jobs: ci: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: fail-fast: true matrix: - os: [ubuntu-latest] php: [8.1, 8.2, 8.3, 8.4] - symfony: [5.4.*, 6.3.*, 6.4.*, 7.0.*] + symfony: [5.4.*, 6.4.*, 7.0.*] dependency-version: [prefer-lowest, prefer-stable] - include: - - php: "8.1" - symfony: "^5.4" - - php: "8.1" - symfony: "^6.3" - - php: "8.1" - symfony: "^6.4" exclude: - - php: "8.1" - symfony: "^7.0" - - name: Tests P${{ matrix.php }} - SF${{ matrix.symfony }} - ${{ matrix.os }} - ${{ matrix.dependency-version }} + - php: 8.1 + symfony: 7.0.* + - php: 8.4 + symfony: 5.4.* + - php: 8.4 + symfony: 6.4.* + - php: 8.4 + symfony: 7.0.* + + name: Tests P${{ matrix.php }} - SF${{ matrix.symfony }} - ubuntu-latest - ${{ matrix.dependency-version }} steps: - name: Checkout @@ -50,6 +48,7 @@ jobs: "symfony/dependency-injection:${{ matrix.symfony }}" "symfony/http-kernel:${{ matrix.symfony }}" --no-interaction --no-update + - name: Install Composer dependencies run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist From 3e981b1ade1544e83371d62c9a0657d0c4d545eb Mon Sep 17 00:00:00 2001 From: 3qdev Date: Fri, 9 May 2025 12:25:35 +0200 Subject: [PATCH 4/9] Changed underlying `openai/client` package version to 0.12.0 (#25) (#26) * Changed underlying `openai/client` package version to 0.12.0 (#25) * update require to php >=8.2 (#25) * drop php 8.1 from test matrix (#25) --- .github/workflows/tests.yml | 4 +--- CHANGELOG.md | 4 ++++ composer.json | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 512051f..d514d65 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,12 +9,10 @@ jobs: strategy: fail-fast: true matrix: - php: [8.1, 8.2, 8.3, 8.4] + php: [8.2, 8.3, 8.4] symfony: [5.4.*, 6.4.*, 7.0.*] dependency-version: [prefer-lowest, prefer-stable] exclude: - - php: 8.1 - symfony: 7.0.* - php: 8.4 symfony: 5.4.* - php: 8.4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 82286bc..45256e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## v0.12.0 (2025-05-06) +### Changed +- Changed underlying `openai/client` package version to 0.12.0 + ## v0.10.0 (2024-06-19) ### Changed - Specify header `OpenAI-Beta: assistants=v2` diff --git a/composer.json b/composer.json index 03b85fe..a4839d0 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ } ], "require": { - "php": "^8.1.0", + "php": "^8.2.0", "nyholm/psr7": "^1.8.2", - "openai-php/client": "^0.10.2", + "openai-php/client": "^0.12.0", "psr/http-client": "^1.0.3", "psr/http-factory": "^1.1.0", "symfony/config": "^5.4|^6.3|^7.1.1", From 2ce4aeee124876be90b7ac6e7c9e503d349ddb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Fri, 9 May 2025 12:28:50 +0200 Subject: [PATCH 5/9] Update CHANGELOG for v0.12.0 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45256e0..22f06ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## v0.12.0 (2025-05-06) ### Changed - Changed underlying `openai/client` package version to 0.12.0 +- Add an alias for the `ClientContract` interface ## v0.10.0 (2024-06-19) ### Changed From f62a924b735e6c5e525e726e376f46b181f81f5e Mon Sep 17 00:00:00 2001 From: Anne van de Venis Date: Mon, 19 May 2025 14:43:09 +0200 Subject: [PATCH 6/9] deps: allow openai-php/client v0.13 (#27) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a4839d0..8a72cd7 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require": { "php": "^8.2.0", "nyholm/psr7": "^1.8.2", - "openai-php/client": "^0.12.0", + "openai-php/client": "^0.13.0", "psr/http-client": "^1.0.3", "psr/http-factory": "^1.1.0", "symfony/config": "^5.4|^6.3|^7.1.1", From 6c70a13d8d7c2f9a0faab0d311871e1b886778e1 Mon Sep 17 00:00:00 2001 From: Adeniji Adekunle James Date: Fri, 4 Jul 2025 09:19:38 +0100 Subject: [PATCH 7/9] Moves model to 4o-mini as it is cheaper and typically better than 3.5 (#29) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8434328..3d6e4d3 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Finally, you may use the `openai` service to access the OpenAI API: ```php $result = $container->get('openai')->completions()->create([ - 'model' => 'gpt-3.5-turbo-instruct', + 'model' => 'gpt-4o-mini', 'prompt' => 'PHP is', ]); From 8b548efd712b48cdc8e7f88442bf1099e99c1c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen?= Date: Tue, 12 Aug 2025 11:26:55 +0200 Subject: [PATCH 8/9] Bump openai-php/client to 0.15 (#30) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8a72cd7..2cb1e96 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require": { "php": "^8.2.0", "nyholm/psr7": "^1.8.2", - "openai-php/client": "^0.13.0", + "openai-php/client": "^0.15.0", "psr/http-client": "^1.0.3", "psr/http-factory": "^1.1.0", "symfony/config": "^5.4|^6.3|^7.1.1", From 48600287744726751d61eda73a07a372de8d5ae9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 11:07:30 +0200 Subject: [PATCH 9/9] chore(deps): bump actions/checkout from 4 to 5 (#31) Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/formats.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/formats.yml b/.github/workflows/formats.yml index 5440721..d858f6a 100644 --- a/.github/workflows/formats.yml +++ b/.github/workflows/formats.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Cache dependencies uses: actions/cache@v4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d514d65..a434b17 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Cache dependencies uses: actions/cache@v4