Agreed, reranking example is a bit confusing. I guess the goal was to show that you CAN easily use reranking if you want. A more practical reranking example is to use in combination with "prompt extensions" -- first ask LLM to hallucinate/speculate an answer without any context, then call retriever twice: 1 - for the original user question, 2 - for the hallucinated/speculated answer; then take output from both retriever calls and send them to the reranker. This technique often yields better results.
Watch more Firebase Genkit → goo.gle/Firebase-Genkit
Cool!
I don't understand the rerank method? Your calling some discoveryengine api? What are you trying ot achieve exactly?
Agreed, reranking example is a bit confusing. I guess the goal was to show that you CAN easily use reranking if you want. A more practical reranking example is to use in combination with "prompt extensions" -- first ask LLM to hallucinate/speculate an answer without any context, then call retriever twice: 1 - for the original user question, 2 - for the hallucinated/speculated answer; then take output from both retriever calls and send them to the reranker. This technique often yields better results.
مرحبا