Number your context chunks
Include a number with each chunk in your context so the model can reference them.Instruct the model to cite sources
Use a system prompt that tells the model to include citation numbers in its response.Render citations in your UI
Parse the bracket notation and render citations as clickable elements. Use a regex to find citation patterns and replace them with interactive components.Next steps
- API Reference — Search endpoint parameters and options
- AI SDK Integration — Use Agentset with Vercel AI SDK for streaming responses
- Ranking — Improve citation relevance with reranking