From 1c58fc20d0851aa00f35e31b08f46edbea809152 Mon Sep 17 00:00:00 2001 From: Marcello Duarte Date: Fri, 31 Jul 2026 15:45:18 +0100 Subject: [PATCH 1/2] Refresh the default model, and declare tool-selection capability Requires papi-core ^0.15. The default model llama-3.3-70b-versatile is decommissioned on 16 August 2026, as is llama-3.1-8b-instant. Moves to openai/gpt-oss-120b, the replacement Groq names. mixtral-8x7b-32768 has been dead since March 2025 and is marked as such. --- composer.json | 2 +- src/GroqProvider.php | 13 +++++++++++-- tests/Unit/GroqProviderTest.php | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index bdc2500..26aa69d 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^8.2", - "papi-ai/papi-core": "^0.14", + "papi-ai/papi-core": "^0.15", "ext-curl": "*" }, "require-dev": { diff --git a/src/GroqProvider.php b/src/GroqProvider.php index 039f963..5c1d2b0 100644 --- a/src/GroqProvider.php +++ b/src/GroqProvider.php @@ -41,14 +41,23 @@ * - llama-3.1-8b-instant (fast inference) * - mixtral-8x7b-32768 (Mixtral) * - * @see https://console.groq.com/docs/api-reference + * @see https://console.groq.com/docs/api-reference * + * The neutral `effort` option is accepted and ignored here. Groq does expose reasoning_effort on its gpt-oss models, but papi does not map it yet, so the option is accepted and ignored for now. Note it cannot be combined with tool calling or JSON mode. Ignoring it + * degrades nothing the caller was promised, which is why it is silent where an unhonourable + * `toolChoice` throws. */ class GroqProvider implements ProviderInterface { private const API_URL = 'https://api.groq.com/openai/v1/chat/completions'; + public const MODEL_GPT_OSS_120B = 'openai/gpt-oss-120b'; + public const MODEL_GPT_OSS_20B = 'openai/gpt-oss-20b'; + + /** @deprecated Decommissioned 16 August 2026. Use MODEL_GPT_OSS_120B. */ public const MODEL_LLAMA_3_3_70B = 'llama-3.3-70b-versatile'; + /** @deprecated Decommissioned 16 August 2026. Use MODEL_GPT_OSS_20B. */ public const MODEL_LLAMA_3_1_8B = 'llama-3.1-8b-instant'; + /** @deprecated Decommissioned 20 March 2025; requests fail. */ public const MODEL_MIXTRAL_8X7B = 'mixtral-8x7b-32768'; /** @@ -60,7 +69,7 @@ class GroqProvider implements ProviderInterface */ public function __construct( private readonly string $apiKey, - private readonly string $defaultModel = self::MODEL_LLAMA_3_3_70B, + private readonly string $defaultModel = self::MODEL_GPT_OSS_120B, private readonly int $defaultMaxTokens = 4096, ) { } diff --git a/tests/Unit/GroqProviderTest.php b/tests/Unit/GroqProviderTest.php index c79dd50..fbeb7d0 100644 --- a/tests/Unit/GroqProviderTest.php +++ b/tests/Unit/GroqProviderTest.php @@ -138,7 +138,7 @@ public function callThrowForStatusCode(int $httpCode, ?array $data): never $this->provider->chat([Message::user('Hello')]); - expect($this->provider->lastPayload['model'])->toBe('llama-3.3-70b-versatile'); + expect($this->provider->lastPayload['model'])->toBe('openai/gpt-oss-120b'); }); it('overrides model and options from parameters', function () { From 2912db2fee459ba12ccb694b97b068e340f8cbf6 Mon Sep 17 00:00:00 2001 From: Marcello Duarte Date: Fri, 31 Jul 2026 14:17:15 +0100 Subject: [PATCH 2/2] Declare tool-selection capability as interfaces, and forward toolChoice from Agent Parked mid-review: complete and green locally, awaiting the v0.16 release decision. --- src/GroqProvider.php | 3 ++- tests/Unit/GroqToolChoiceTest.php | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/GroqProvider.php b/src/GroqProvider.php index 5c1d2b0..e00f82e 100644 --- a/src/GroqProvider.php +++ b/src/GroqProvider.php @@ -15,6 +15,7 @@ namespace PapiAI\Groq; use Generator; +use PapiAI\Core\Contracts\NamedToolSelectableInterface; use PapiAI\Core\Contracts\ProviderInterface; use PapiAI\Core\Exception\AuthenticationException; use PapiAI\Core\Exception\ProviderException; @@ -46,7 +47,7 @@ * degrades nothing the caller was promised, which is why it is silent where an unhonourable * `toolChoice` throws. */ -class GroqProvider implements ProviderInterface +class GroqProvider implements ProviderInterface, NamedToolSelectableInterface { private const API_URL = 'https://api.groq.com/openai/v1/chat/completions'; diff --git a/tests/Unit/GroqToolChoiceTest.php b/tests/Unit/GroqToolChoiceTest.php index 90506a0..a6f45ce 100644 --- a/tests/Unit/GroqToolChoiceTest.php +++ b/tests/Unit/GroqToolChoiceTest.php @@ -12,6 +12,8 @@ declare(strict_types=1); +use PapiAI\Core\Contracts\NamedToolSelectableInterface; +use PapiAI\Core\Contracts\ToolSelectableInterface; use PapiAI\Core\Message; use PapiAI\Groq\GroqProvider; @@ -77,3 +79,10 @@ protected function request(array $payload): array ->toThrow(InvalidArgumentException::class); }); }); + +describe('GroqProvider tool-selection capability', function () { + it('declares what it can force, so callers can ask instead of catching', function () { + expect(is_subclass_of(GroqProvider::class, NamedToolSelectableInterface::class))->toBeTrue(); + expect(is_subclass_of(GroqProvider::class, ToolSelectableInterface::class))->toBeTrue(); + }); +});