@meilisearch/ai-sdk adds Meilisearch search tools to the Vercel AI SDK, letting an LLM decide when to search your data and how to use the results.
Requirements
- A Meilisearch project with at least one index containing documents
- A search API key for that project
- An API key from an LLM provider (this example uses OpenAI, but any provider supported by the AI SDK works)
Install
.env
Give an agent a search tool
search before answering. The description field tells it what the index contains and when to use it.
AI SDK demo
Next.js chatbox example application
Going further
Getting started with agentic search
Build a multi-turn chatbot with streaming responses.
Display source documents
Show users which documents an agent used to answer.
Configure guardrails
Keep agents on topic and grounded in your data.
Handle errors and fallbacks
Make your agent resilient to search and LLM failures.