Replace ‘trace.retrieval’ with ‘span.retrieval’ when creating retrievals within an existing span

Schedule a demo to see how Maxim AI helps teams ship reliable agents.
Retrieval-Augmented Generation (RAG) is a technique that enhances large language models by retrieving relevant information from external sources before generating responses.
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",
])

Was this page helpful?