[Tracker]
Update Summary: Proposing a new Discovery Engine provider plugin and a custom discovery_engine_search operation type alongside the existing VertexProvider.
Check-in Date:
Additional Collaborators:
Metadata is used by the AI Tracker. Docs and additional fields here.
[/Tracker]

Problem/Motivation

This seems so complicated, but ai_provider_google_vertex covers Vertex AI's generative side (chat, embeddings, vision) through VertexProvider, but not Discovery Engine. Google now lists Discovery Engine (Gemini Enterprise Agent Platform) as a Vertex AI capability, but its API lives on a separate REST endpoint at discoveryengine.googleapis.com with its own resource hierarchy. VertexProvider doesn't reach it.

#3570955: Search API integration proposes a Search API backend, which goes the other direction: indexing Drupal content into Vertex Search. This issue is the complementary shape, calling Discovery Engine to retrieve and summarize from a corpus already indexed there.

Proposed resolution

Add a sibling provider plugin in this module, next to VertexProvider:

src/Plugin/AiProvider/
  VertexProvider.php           (existing)
  DiscoveryEngineProvider.php  (new)

Both share google/auth and the Key-module credential pattern.

No stock drupal/ai operation covers DE's response shape (ranked results, grounded summary, citations, references), so this also adds a discovery_engine_search operation type with its own Input and Output DTOs. The provider hits :search and :answer against a configured engine.

https://discoveryengine.googleapis.com/{version}/projects/{project}/locations/{location}/collections/default_collection/engines/{engine}/servingConfigs/{serving_config}:search

https://discoveryengine.googleapis.com/{version}/projects/{project}/locations/{location}/collections/default_collection/engines/{engine}/servingConfigs/{serving_config}:answer

A few decisions worth resolving before an MR:

  1. Default endpoint version. v1 and v1beta are stable; can v1alpha be opt-in?
  2. Should the operation type live here, or in a separate package so other backends could implement it? My instinct is to keep it here for now.
  3. Naming. DiscoveryEngineProvider follows the API name, which has been stable across Google's rebrands. VertexAiSearchProvider follows the marketing name (now Gemini Enterprise Agent Platform). I lean toward the API name.

A working version runs in production at a major US city's Drupal site (happy to name privately) inside a custom search module. It works well, but feels like it belongs here. The site-specific bits (legacy citation reshaping, preset-aware Input building) are isolated and would come out before contribution. Happy to post a MR once the questions above are settled.

Target date or deadline

None.

Remaining tasks

  • Maintainer feedback on the questions above.
  • Carve down the existing implementation and post as MR.
  • Tests and documentation.

AI usage (if applicable)

[x] AI Assisted Issue
This issue was generated with AI assistance, but was reviewed and refined by the creator.

[ ] AI Assisted Code
This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.

[ ] AI Generated Code
This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.

[ ] Vibe Coded
This code was generated by an AI and has only been functionally tested.

Comments

mtift created an issue. See original summary.

mtift’s picture

Issue summary: View changes