ladderlore
请求新指南
  • 输入服务名称,例如 S3 或 IAM。

概念

Retrieval pipelines

Retrieve or RetrieveAndGenerate, and when to build your own pipeline in Lambda.

本课尚未翻译,暂以英文显示。

  • Retrieve

    Returns
    Chunks, scores and sources
    Pick it when
    You build the prompt and call the model
  • RetrieveAndGenerate

    Returns
    An answer with citations
    Pick it when
    You want grounded answers in one call
The two query APIs.
Question
Lambda pipeline
Knowledge bases
Foundation model with Guardrails
Answer with citations
  1. 1The question arrives.
  2. 2Lambda decomposes or routes it, adds filters and calls Retrieve on one or more knowledge bases.
  3. 3Retrieved chunks, reranked, go into the prompt. Guardrails check the prompt and the answer.
  4. 4The answer returns with citations.
A custom pipeline adds routing and checks around retrieval.

分步说明

  1. 1The question arrives.
  2. 2Lambda decomposes or routes it, adds filters and calls Retrieve on one or more knowledge bases.
  3. 3Retrieved chunks, reranked, go into the prompt. Guardrails check the prompt and the answer.
  4. 4The answer returns with citations.

是什么

Two APIs query a knowledge base. Retrieve returns chunks with text, source and score, and nothing more, so you control the prompt and the model. RetrieveAndGenerate retrieves and then calls a model, and returns an answer with citations. It also supports query decomposition (orchestration configuration with QUERY_DECOMPOSITION), which breaks a complex question into sub-queries, and a guardrail in its generation configuration. Citations need the output format instructions placeholder in a custom prompt template.

是什么

A custom pipeline in AWS Lambda is for needs the managed call cannot meet. It can route a question to one of several knowledge bases by intent, decompose a question, add metadata filters from the user context, merge and rerank results, and then call the model through Converse. Apply Guardrails to the final prompt and the answer with the guardrail settings in Converse or with the ApplyGuardrail API, so retrieved text cannot slip past your rules. A guardrail on a knowledge base node in Bedrock Flows only applies when it uses RetrieveAndGenerate.

是什么

Choose the simplest path that works. RetrieveAndGenerate for a quick, grounded answer. Retrieve plus your own model call when you need control over the prompt, the model or the output. A custom pipeline when routing, several stores or extra steps are part of the requirement.

要记住

  • Retrieve: chunks and scores only. RetrieveAndGenerate: an answer with citations.
  • Query decomposition splits a complex question into sub-queries.
  • Metadata filters narrow retrieval to the right documents.
  • Custom pipeline in Lambda: routing across knowledge bases, merge, rerank, then generate.

要记住

  • Guardrails: in generation configuration, or ApplyGuardrail for a custom pipeline.

考试中

  • “Need the source passages and then use your own prompt and model” points to Retrieve.
  • “A grounded answer with citations in one call” points to RetrieveAndGenerate.
  • “Multi-part questions retrieve poorly” points to query decomposition.
  • “Route each question to the right knowledge base by topic” points to a custom pipeline, for example in Lambda.