---
title: "Creating a vector store connector"
manual: "AI Assistant"
version: "main"
source: "Developers/Extending/CreatingVectorStoreConnector.rst"
rendered: "2026-10-03T14:54:45+00:00"
---

# Creating a vector store connector {#creating-vector-store-connector}

Vector store connectors integrate vector databases into AI Assistant. They are
resolved through `VectorStoreConnectorRegistry` by their identifier and are
configured through vector store connection records.

## Responsibilities {#responsibilities}

-   expose a stable connector identifier;
-   write vector documents;
-   search vectors;
-   delete all chunks belonging to a source hash;
-   create or validate collections if supported;
-   preserve metadata payloads;
-   map backend responses to core DTOs.

## Identifier {#identifier}

The identifier is stored in the vector store connection record.

```php
public function getIdentifier(): string
{
    return 'vendor.vector_store';
}
```

## Required capabilities {#required-capabilities}

A vector store connector should support at least:

-   collection-aware writes;
-   similarity search with configurable `max_retrieval_results` and score threshold;
-   payload metadata storage;
-   deletion by source hash;
-   stable document IDs.

## Deletion by source hash {#deletion-by-source-hash}

Deletion by source hash is required for re-indexing and cleanup. The connector
must delete all vector chunks that belong to the same source in the selected
collection and vector store.

```php
use Madj2k\AiCore\Connection\Configuration\VectorStoreConnectionConfigurationInterface;
use Madj2k\AiCore\Connection\VectorStore\DTO\VectorCollection;
use Madj2k\AiCore\Connection\VectorStore\DTO\VectorDeleteResult;

public function deleteBySourceHash(
    VectorStoreConnectionConfigurationInterface $connection,
    VectorCollection $collection,
    string $sourceHash
): VectorDeleteResult {
    // Delete all points with payload.source_hash = $sourceHash.
}
```

## Service registration {#service-registration}

```yaml
services:
  Vendor\Extension\Connection\VectorStore\MyVectorStoreConnector:
    tags:
      - name: 'aiassistant.connection.vector_store_connector'
```

## Configuration usage {#configuration-usage}

After registration, create a vector store connection record with
`connector_identifier` set to the connector identifier.

Example:

```text
connector_identifier = vendor.vector_store
```
