langchain/templates/hyde
2023-10-28 22:13:22 -07:00
..
hyde various templates improvements (#12500) 2023-10-28 22:13:22 -07:00
tests add template for hyde (#12390) 2023-10-26 17:38:35 -07:00
LICENSE add template for hyde (#12390) 2023-10-26 17:38:35 -07:00
pyproject.toml various templates improvements (#12500) 2023-10-28 22:13:22 -07:00
README.md add template for hyde (#12390) 2023-10-26 17:38:35 -07:00

HyDE

Hypothetical Document Embeddings (HyDE) are a method to improve retrieval. To do this, a hypothetical document is generated for an incoming query. That document is then embedded, and that embedding is used to look up real documents similar to that hypothetical document. The idea behind this is that the hypothetical document may be closer in the embedding space than the query. For a more detailed description, read the full paper here.

For this example, we use a simple RAG architecture, although you can easily use this technique in other more complicated architectures.