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.

CommentFileSizeAuthor
#3 3564086-2.png76.34 KBdanrod
#3 3564086-1.png46.94 KBdanrod
Command icon 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:

Comments

mbatterton created an issue. See original summary.

danrod’s picture

StatusFileSize
new46.94 KB
new76.34 KB

I 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.

danrod’s picture

danrod’s picture

Thanks @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.md was 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/...

danrod’s picture

Status: Needs review » Reviewed & tested by the community
danrod’s picture

Status: Reviewed & tested by the community » Needs review
danrod’s picture

Status: Needs review » Reviewed & tested by the community

I'll send this to RTBC for now and create a new issue for the CSPELL / PHPCS / PHPSTAN warnings.

scott_euser’s picture

Assigned: mbatterton » Unassigned
Status: Reviewed & tested by the community » Closed (cannot reproduce)

I 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.

- Implements EmbeddingProviderInterface for AI 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 there

- Is compatible with search_ai 2.x

Is 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.

- Supports OpenAI embedding models

These are supported since nearly the beginning of this module, see OpenAiProvider.php ::getSupportedOperationTypes() and ::embeddings()

- Leaves 1.2.x fully intact for AI 1.x users

I don't think any changes from this MR are necessary for AI 1.x compatibility.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

danrod’s picture

Hey @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.

mbatterton’s picture

Thank you @danrod and @scott_euser for reviewing this. This was created with some AI assistance, but was not blindly created with AI.

Is compatible with search_ai 2.x

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.

scott_euser’s picture

But 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