AI Search: Implement pgvector (postgeSQL) vector db provider
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3480822. -->
Reported by: [joshhytr](https://www.drupal.org/user/3633353)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>postgreSQL is a widely used and widely available database engine that also supports vector similarity searches with the pgvector extension.</p>
<p>Given its ease of setup and wide availability across cloud providers, this seems like a low cost solution which performs acceptably on small to medium datasets.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>N/A</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Create a vdb_provider_pgvector submodule of drupal/ai in vdb_providers that implements a PgvectorProvider plugin.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<ul>
<li>Create vdb_provider_pgvector module that implements a PgvectorProvider plugin</li>
<li>Amend existing API to support pgvector's 'at query' metric type selection</li>
</ul>
<h3 id="summary-ui-changes">User interface changes</h3>
<ul>
<li>New pgvector settings form at /admin/config/ai/vdb_providers/pgvector</li>
</ul>
<h3 id="summary-api-changes">API changes</h3>
<ul>
<li>Pass metric type to vectorSearch plugin function</li>
</ul>
<h3 id="summary-data-model-changes">Data model changes</h3>
<ul>
<li>New settings schema for the pgvector vdb provider</li>
</ul>
<p>I have a proof of concept of this working. I'm creating this issue so that I can create a fork and push my work there.</p>
<p>I'll tidy that work up and run some further tests locally.</p>
<p>When it's ready for review, I'll update the issue status.</p>
issue