Maxim Logo
How toLog your application

Capture your RAG pipeline

Retrieval-Augmented Generation (RAG) is a technique that enhances large language models by retrieving relevant information from external sources before generating responses.

This approach combines the power of pre-trained models with up-to-date, domain-specific knowledge, leading to more accurate and contextually appropriate outputs. To capture the RAG pipeline, you need to log it as a "Retrieval" entity. A Retrieval represents a query that fetches relevant context from a knowledge base or vector database.

const retrieval = trace.retrieval({
	id: "retrieval-id",
	name: "National Geographic survey report 2025.pdf",
});
 
retrieval.input("best places 2025")
retrieval.output([
	"Tokyo, Japan",
	"Barcelona, Spain",
	"Singapore",
	"Copenhagen, Denmark",
	"Pune, India",
	"Seoul, South Korea",
])
 
// Note: Replace 'trace.retrieval' with 'span.retrieval' when creating retrievals within an existing span

On this page

No Headings