capabilities.work

RAG Rerank And Answer

A 3-step recipe with NVIDIA NIM. We can help you get access.

Recipe · 3 steps

RAG Rerank And Answer

with NVIDIA NIM · Artificial Intelligence Management

Embed a query, rerank candidate passages, and answer grounded in the best one.

  1. Generate a dense embedding vector for the query using a NeMo Retriever embedding model with the asymmetric query input type.
  2. Score every candidate passage against the query with a cross-encoder reranker so the most relevant passage can be selected.
  3. Compose a grounded answer by giving the chat model the highest-ranked passage as system context alongside the original query.
What you'll need to have ready
  • apiKey: NVIDIA developer API key (nvapi-...) sent as a Bearer token.
  • query: The user's natural-language question.
  • passages: Candidate passage objects ({ text }) to rerank against the query.
  • embeddingModel: NeMo Retriever embedding model id.
  • rerankModel: NeMo Retriever reranker model id.
  • chatModel: LLM model id used to compose the grounded answer.
For your developer

Arazzo workflow nvidia-nim:rag-rerank-answer, 3 operations: createEmbedding → rankPassages → createChatCompletion. Specs on APIs.io.