Prompt Research

Rewrite a Follow-Up Question as a YouTube Search Query

Turns a follow-up question plus the conversation into a specific standalone query for a YouTube video search and returns only {"query": ...} as JSON.

  • 🤖 Any chat LLM
  • 🗂️ Research

Last verified: write-up checked

Prompt by ItzCrazyKns (ItzCrazyKns/Perplexica) · Original source (opens in a new tab)

Rewrite a Follow-Up Question as a YouTube Search Query — prompt preview

The prompt

prompt
You will be given a conversation below and a follow up question. You need to rephrase the follow-up question so it is a standalone question that can be used by the LLM to search Youtube for videos.
You need to make sure the rephrased question agrees with the conversation and is relevant to the conversation.
Make sure to make the querey standalone and not something very broad, use context from the answers in the conversation to make it specific so user can get best video search results.
Output only the rephrased query in query key JSON format. Do not include any explanation or additional text.

What it is

Turns a follow-up question plus the conversation into a specific standalone query for a YouTube video search and returns only {"query": ...} as JSON. The examples on this page are copied from the same source file; we did not run them. The prompt text comes from the Perplexica repository (MIT licence, Copyright (c) 2026 ItzCrazyKns). Licence: https://github.com/ItzCrazyKns/Perplexica/blob/master/LICENSE. Original author: ItzCrazyKns (ItzCrazyKns/Perplexica). Changes by FoxaMind: JavaScript template-literal quotes removed and escaped backticks unescaped; ${...} placeholders keep the source syntax.

Who it's for

  • Developers adding video search to a chat app

يحوّل سؤال المتابعة مع المحادثة إلى استعلام مستقل ومحدد للبحث عن فيديوهات يوتيوب، ويعيد {"query": ...} فقط بصيغة JSON.

Examples

Few-shot pairs from the same source file

Prompt
prompt
user: <conversation>
</conversation>
<follow_up>
How does a car work?
</follow_up>
assistant: {"query":"How does a car work?"}

user: <conversation>
</conversation>
<follow_up>
What is the theory of relativity?
</follow_up>
assistant: {"query":"Theory of relativity"}

user: <conversation>
</conversation>
<follow_up>
How does an AC work?
</follow_up>
assistant: {"query":"AC working"}

Expected output: Few-shot messages as defined in the source file (videoSearchFewShots). Not run by us.

Tips

  • The source file also defines three few-shot message pairs for this prompt; they are shown in the example here.
  • The source text spells the word "query" as "querey" once; it is kept as is in the prompt body.