AI framework 2.x introduces new provider and capability interfaces, which are not compatible with the existing 1.2.x OpenAI provider.
This issue introduces a new 2.0.x development branch that:
- Implements EmbeddingProviderInterface for AI 2.x
- Is compatible with search_ai 2.x
- Supports OpenAI embedding models
- Leaves 1.2.x fully intact for AI 1.x users
This is an embeddings-only provider to support AI Search and vector indexing use cases.
AI 2.x separates capabilities explicitly. This initial implementation focuses on embeddings to support Search AI and vector databases. Text generation can be added incrementally without affecting the search use case. A new major branch avoids breaking existing AI 1.x installations.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3564086-2.png | 76.34 KB | danrod |
| #3 | 3564086-1.png | 46.94 KB | danrod |
Issue fork ai_provider_openai-3564086
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 2.0.x-compatibility
changes, plain diff MR !58
- 3564086-add-ai-2.x
changes, plain diff MR !57
Comments
Comment #3
danrodI tested this with the latest DEV release of AI 2.x in order to work on the issue Fix PHPStan issues on AI CKEditor and the CKEditor AI functionality seems to work as expected (please see the attached screenshots), this will require more testing, but so far it looks ok.
I'll leave this to "Needs Review" for an extra review by another user.
Comment #4
danrodComment #7
danrodThanks @mbatterton , I tested the new MR 58 and worked as expected (tested the AI Chatbox and the AI Assistants in the CKEditor), the addition of the
CHANGELOG-2.0.mdwas a nice touch for those who want to upgrade to the AI 2.x framework.What about the CSPELL / PHPCS / PHPSTAN issues? Shall we fix them in this same MR? https://git.drupalcode.org/issue/ai_provider_openai-3564086/-/pipelines/...
Comment #8
danrodComment #9
danrodComment #10
danrodI'll send this to RTBC for now and create a new issue for the CSPELL / PHPCS / PHPSTAN warnings.
Comment #11
scott_euser commentedI don't understand this one at all sorry. Could it be AI generated? @danrod when you tested what did you test with? Maybe there is a branch on AI core module that isn't described in the issue summary? I'm leaning towards 'Closed (cannot reproduce)' without more evidence as I can confirm heavily using this module with both AI Search 1.x and 2.x.
Seems like an AI hallucination as there is no such interface https://git.drupalcode.org/project/ai/-/tree/2.0.x/src?ref_type=heads, e.g. where is this
use Drupal\ai\Embedding\EmbeddingProviderInterface;coming from, I don't see an Embedding folder thereIs this meant to be ai_search? If so, as is AI Provider OpenAI is compatible with ai_search. https://www.drupal.org/project/search_ai is a 404 not found.
These are supported since nearly the beginning of this module, see OpenAiProvider.php ::getSupportedOperationTypes() and ::embeddings()
I don't think any changes from this MR are necessary for AI 1.x compatibility.
Comment #13
danrodHey @scott_euser I tested with the AI 2.0.x DEV release: https://www.drupal.org/project/ai/releases/2.0.x-dev since I can't use the 1.2.x or 1.3.x releases for the AI 2.0.x release (which right now is in the works), so I used this MR to provide OpenAI support for this new AI 2.0.x DEV release.
I can provide more details if needed.
Comment #14
mbatterton commentedThank you @danrod and @scott_euser for reviewing this. This was created with some AI assistance, but was not blindly created with AI.
Was my typo - my apologies.
I would very much like to see my efforts moved forward, as this works really well for us, and I would value any feedback and would be happy to fix the CSPELL / PHPCS / PHPSTAN issues if this is not going to be closed.
Comment #15
scott_euser commentedBut you really need to provide clear steps to reproduce the issue. As per my reply it works perfectly fine as is as far as I can see (and I am heavily using AI Search with both 1x and 2x branches combined with OpenAI for embeddings). This code references non existent code in AI module as far as I can tell, so rather than improving this this seems to be likely to make things worse and break things, would like to be convinced otherwise if you can provide clear steps and evidence.
Sorry to be a pain but I can't merge it without that.
Thanks!
Scott