From 92f6afd5df88ae67a2365bc85fb077b9477bb83b Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Mon, 8 Sep 2025 10:55:57 -0600 Subject: [PATCH 1/3] Update the API version to the latest general release --- includes/Classifai/Providers/Azure/OpenAI.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Classifai/Providers/Azure/OpenAI.php b/includes/Classifai/Providers/Azure/OpenAI.php index 7c3f46e73..f16517f3a 100644 --- a/includes/Classifai/Providers/Azure/OpenAI.php +++ b/includes/Classifai/Providers/Azure/OpenAI.php @@ -46,14 +46,14 @@ class OpenAI extends Provider { * * @var string */ - protected $chat_completion_api_version = '2023-05-15'; + protected $chat_completion_api_version = '2024-10-21'; /** * Completion API version. * * @var string */ - protected $completion_api_version = '2023-05-15'; + protected $completion_api_version = '2024-10-21'; /** * GeminiAPI constructor. From 638e4a957b03b7bfac8d04f9fd32347b695d8b23 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Mon, 8 Sep 2025 10:56:44 -0600 Subject: [PATCH 2/3] Add a helper method to get the API version, which passes that through a filter --- includes/Classifai/Providers/Azure/OpenAI.php | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/includes/Classifai/Providers/Azure/OpenAI.php b/includes/Classifai/Providers/Azure/OpenAI.php index f16517f3a..c8ad14bfb 100644 --- a/includes/Classifai/Providers/Azure/OpenAI.php +++ b/includes/Classifai/Providers/Azure/OpenAI.php @@ -64,6 +64,25 @@ public function __construct( $feature_instance = null ) { $this->feature_instance = $feature_instance; } + /** + * Get the API version. + * + * @return string + */ + public function get_api_version(): string { + /** + * Filter the API version. + * + * @since x.x.x + * @hook classifai_azure_openai_api_version + * + * @param string $version The default API version. + * + * @return string The API version. + */ + return apply_filters( 'classifai_azure_openai_api_version', $this->chat_completion_api_version ); + } + /** * Render the provider fields. */ @@ -258,7 +277,7 @@ protected function prep_api_url( ?\Classifai\Features\Feature $feature = null ): $deployment ) { $endpoint = trailingslashit( $endpoint ) . str_replace( '{deployment-id}', $deployment, $this->chat_completion_url ); - $endpoint = add_query_arg( 'api-version', $this->chat_completion_api_version, $endpoint ); + $endpoint = add_query_arg( 'api-version', $this->get_api_version(), $endpoint ); } return $endpoint; From f3f2c1c2f607fba7c2769e65d17adebdf9550ed7 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Mon, 8 Sep 2025 11:14:18 -0600 Subject: [PATCH 3/3] Ensure content generation works --- includes/Classifai/Providers/Azure/OpenAI.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/Classifai/Providers/Azure/OpenAI.php b/includes/Classifai/Providers/Azure/OpenAI.php index c8ad14bfb..4b4acec95 100644 --- a/includes/Classifai/Providers/Azure/OpenAI.php +++ b/includes/Classifai/Providers/Azure/OpenAI.php @@ -273,7 +273,8 @@ protected function prep_api_url( ?\Classifai\Features\Feature $feature = null ): ( $feature instanceof ContentResizing || $feature instanceof ExcerptGeneration || $feature instanceof TitleGeneration || - $feature instanceof KeyTakeaways ) && + $feature instanceof KeyTakeaways || + $feature instanceof ContentGeneration ) && $deployment ) { $endpoint = trailingslashit( $endpoint ) . str_replace( '{deployment-id}', $deployment, $this->chat_completion_url );