Remove OpenAI SDK dependency and extend it from Drupal AI core module

Created on 26 June 2025, 2 days ago

Problem/Motivation

Currently, AmazeeAI provider is implemented using the OpenAI SDK directly, with only minor variations.

This approach has led to significant code duplication (reused by other providers), especially evident when implementing new features like function calling. In such cases, nearly identical logic had to be added in multiple places, making the codebase harder to maintain, test, and evolve.

To address this, we already have an AiProviderClientBase class as a common foundation. The proposed direction is to introduce an OpenAiBasedProviderClientBase as an intermediate abstract layer that encapsulates shared OpenAI-specific logic (e.g., request formatting, operation types, basic behavior), reducing duplication and simplifying future enhancements.

Refactoring existing OpenAI-based clients to extend from this new base class will eliminate redundant code, improve maintainability, and align these implementations with the Drupal AI core module's architecture—paving the way for better standardisation and extensibility across AI providers.

Feature request
Status

Active

Version

1.1

Component

Code

Created by

🇪🇸Spain gxleano Cáceres

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024