How Ask Fern works
Ask Fern is a Retrieval Augmented Generation (RAG) system that appears as a side panel on your documentation site, transforming your documentation into an intelligent, searchable knowledge base.
Visual design and behavior
Ask Fern appears as a resizable side panel on your documentation site. Users can drag to resize it or use the expand/minimize button to control their viewing experience.
Key behaviors:
- Adaptive layout – Seamlessly integrates with all Fern Docs layouts
- Persistent navigation – Side panel stays open as users browse different pages or click links provided by the AI responses
- Document-specific queries – Users can ask questions about the current page through a dropdown option
- Mobile optimization – Expands to full screen when users start typing on mobile devices
The interface maintains your site’s design language while providing a familiar chat experience that feels native to your documentation.
How it works
The main parts of the Ask Fern system are:
- Content and code indexing – Fern automatically processes your documentation pages and Fern-generated SDK code, breaking them into semantic chunks and converting each chunk into a vector using sentence embedding models. They’re stored in a database that serves as Ask Fern’s search index.
- Query processing – When users ask questions, Ask Fern vectorizes their query and searches the database to find the most relevant documentation and code chunks. If you have role-based access control configured, Ask Fern filters results based on the user’s permissions.
- Response generation – Ask Fern uses the retrieved chunks as context to generate accurate answers with citations for the user. If the initial context isn’t sufficient, it performs an additional keyword search.
Architecture diagram
Each Ask Fern user query follows these steps: