概念
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
| API | Returns | Pick it when |
|---|---|---|
| Retrieve | Chunks, scores and sources | You build the prompt and call the model |
| RetrieveAndGenerate | An answer with citations | You want grounded answers in one call |
- 1The question arrives.
- 2Lambda decomposes or routes it, adds filters and calls Retrieve on one or more knowledge bases.
- 3Retrieved chunks, reranked, go into the prompt. Guardrails check the prompt and the answer.
- 4The answer returns with citations.
分步说明
- 1The question arrives.
- 2Lambda decomposes or routes it, adds filters and calls Retrieve on one or more knowledge bases.
- 3Retrieved chunks, reranked, go into the prompt. Guardrails check the prompt and the answer.
- 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.
本任务内容 · 3.2
- Provisioned vs on-demand resources
- IaC for ML: CloudFormation, CDK and Service Catalog
- Containers for ML: images, ECR and own containers
- ECS, EKS and Batch for ML workloads
- SageMaker endpoints in a VPC
- Auto scaling endpoints and choosing metrics
- Scaling GPU and LLM workloads
Knowledge Bases
- Retrieval pipelines
- Agent state and memory management
- Agentic workflow infrastructure