HyDE Query Generator (BYO-key)

Generate a hypothetical answer document for HyDE-style RAG retrieval with your own key.

Ad placeholder (leaderboard)

HyDE query generator

Short questions make poor embeddings: a five-word query rarely sits near the dense, document-shaped passages you want to retrieve. HyDE fixes this by asking an LLM to write a hypothetical answer first, then embedding that answer. This tool drafts the hypothetical document from your query and domain context using your own OpenAI key.

How it works

On generate, the tool sends one request to https://api.openai.com/v1/chat/completions asking the model to write a concise, confident passage that answers your query as if it were an excerpt from a real document in your domain. The domain context you provide is added to the prompt so the vocabulary and tone match your corpus. The request goes directly from your browser to OpenAI; copy the result and embed it in place of the raw query.

Tips and notes

  • Match the document style. Telling the model the corpus is, say, “internal HR policy documents” yields a hypothetical that retrieves better than a generic answer.
  • Keep it the length of a real chunk. A hypothetical document close in size to your indexed chunks tends to embed nearest to them.
  • It can be wrong and still work. Retrieval cares about lexical and semantic shape, not truth — the real documents you fetch are what the model finally answers from.
  • Try query plus HyDE. Embedding the concatenation of the original query and the hypothetical document sometimes beats either alone; test both on your data.
Ad placeholder (rectangle)