Skip to main content
Aikeedo turns uploaded documents and links into embeddings, then searches them when answering questions. By default those vectors are kept as JSON files in the configured storage. A vector store plugin replaces that with a real vector database.

The interface

The data shape

An Ai\Domain\ValueObjects\Embedding wraps a list of chunks, each an EmbeddingMap with the text and its vector:
search() returns a ranked list in the same shape the default store produces:
The content values are what ends up in the model’s context, so return the text, not just IDs.

The search context

The context tells you where to search: a namespace to isolate one tenant or assistant, and the dataset unit IDs that are attached to the current conversation. Respect both, or one customer’s knowledge base will leak into another’s answers.

Implementation

src/AcmeVectors.php
Create collections lazily, on the first write, and make creation idempotent. Vector dimensions depend on the embedding model the installation uses, so read the dimension from the first vector you receive rather than hardcoding it.

Register it

src/Plugin.php
The store appears under Settings → Vector databases, and the selected key is stored in option.embeddings.adapter. If that key can’t be resolved, Aikeedo falls back to its built-in file store.

Settings page

Declare a route at /admin/settings/vector-databases/acme-vectors, and set extra.default_url to it. Useful fields: enable toggle, endpoint, API key, collection prefix, and a switch for per-assistant collections.

Operational notes

  • Switching stores doesn’t migrate data. Existing knowledge bases must be re-indexed after a switch. Say so on your settings page.
  • Deletes matter. When a document is removed, remove() must delete its vectors, or answers will cite deleted content.
  • Fail soft on search. If the database is unreachable, returning an empty array degrades the answer. Throwing breaks the chat.
  • Watch the payload size. Store the chunk text, since search results must return it.

Testing

Upload a document to a knowledge base and confirm vectors appear in your database.
Ask a question that the document answers, and check the answer cites it.
Re-upload the same document and confirm chunks are replaced, not duplicated.
Delete the document and confirm its vectors are gone.
Two knowledge bases don’t see each other’s content.