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..d514d65 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,34 +4,30 @@ 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.*] + php: [8.2, 8.3, 8.4] + 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.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 - 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') }} @@ -50,6 +46,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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 82286bc..22f06ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ 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 +- Add an alias for the `ClientContract` interface + ## 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", 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'); } }