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/5] 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/5] 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/5] 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/5] 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/5] 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