kimaai_embedding_source_title

When it fires

When a post is prepared in a sync of the knowledge base, and when the Sync tab lists posts and indexed chunks. The title from the sync is stored with each chunk: the chatbot shows it under an answer as the source, and the AI reads it with the search result. The chunk’s “Context:” line starts with it when the chunk is not under a heading.

A changed title reaches the index with the post’s next sync, but only for the chunks whose text changed with it. A chunk under a heading does not contain the title, so a sync counts it as unchanged and it keeps the old one: after changing titles, run a forced sync (Force re-sync in the Sync tab, or wp kimaai vectors sync --force).

Parameters

NameTypeDescription
titlestringThe post’s title, or the file name of an attachment without a title.
postWP_PostThe post or attachment.

Returns

string: The title; an empty title becomes “(no title)”.

Example

add_filter(
  'kimaai_embedding_source_title',
  function (string $title, WP_Post $post): string {
    // Visitors see that a source opens a PDF.
    if ($post->post_type === 'attachment') {
      return 'PDF: ' . $title;
    }

    return $title;
  },
  10,
  2
);
  • kimaai_embedding_vector_metadata: changes what is stored with each chunk, the title among it.
  • kimaai_embedding_supported_sources: the sources a sync can index.

What are your feelings