Skip to main content

Read or change what a guest said, in AI Search’s answers to “what has [guest] said about [topic]?”

Premium Intermediate AI Search

The search route behind the [benecaster_ai_search] box also answers quotes: 200 { results: [ … ], quotes: [ { guest_id, guest_name, episode_id, title, url, start, time, text } ], unavailable }. A search that names a guest gets that guest’s own words from the show’s transcripts, closest to the search. The box draws them above its episode list under In their own words.

  • When there are any: AI Search, Transcription and Guest Manager all switched on for the show; OpenAI, Google Gemini or Cohere as the provider (under Anthropic nothing is indexed, so quotes is always []); a speaker in the episode’s transcript mapped to a Guest Manager guest; and the search names that guest. Otherwise, and whenever unavailable is true, quotes is [].
  • Naming a guest: the guest’s full name as whole words (case, punctuation and a possessive ‘s ignored), or one part of a name of three letters or more that belongs to that guest alone among the show’s quoted guests. At most three guests per search.
  • What is quoted: each indexed turn of the guest’s speech (four words or more), compared with the search’s own vector, so there is no further provider call. At most 5, best first, and only a turn at least as close to the search as its fifth-best episode: quotes can be [] even when a guest is named. text is the turn’s words (about 300 characters at most, cut at a word); start is whole seconds into the episode’s base audio, time the same as m:ss or h:mm:ss.
  • Each passage is decided for the visitor: only when they may open the episode and see its transcript. A passage either refuses is left out in both hidden and locked mode. Anyone who can edit the episode passes the transcript check, so test as a member.

Box classes: benecaster-ai-search__quotes, __quotes-heading, __quote-list, __quote, __quote-text (a blockquote), __quote-source, __quote-guest, __quote-episode, __quote-time.

Code

<?php
// Show one passage per episode, so a guest's words come from as many episodes as possible.
add_filter( 'benecaster_ai_search_guest_quotes', function ( array $quotes ): array {
    $seen = [];
    return array_values( array_filter( $quotes, function ( array $quote ) use ( &$seen ): bool {
        if ( isset( $seen[ $quote['episode_id'] ] ) ) {
            return false;
        }
        return $seen[ $quote['episode_id'] ] = true;
    } ) );
} );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →