Advanced techniques for influencing AI documentation generation, including prompt engineering and LLM configuration.
AI Docs provides powerful capabilities to automate documentation, but it also offers extensive flexibility to tailor its AI behavior to your specific needs. This includes fine-tuning how the AI generates content, how it responds in chat, and even how its outputs are structured for consumption by other AI systems.
You can directly influence the core AI processes within AI Docs, from content generation to the interactive AI chat assistant.
The Retrieval Augmented Generation (RAG) chat assistant uses a systemPrompt to guide its persona, instructions, and how it synthesizes information. Customizing this prompt allows you to refine the AI's responses and interaction style.
By modifying the systemPrompt within the RAG chat endpoint configuration, you can:
For more details on the RAG chat architecture, refer to AI-Powered Generation and Deep Dive into Search & RAG.
AI Docs is designed to be model-agnostic, allowing you to integrate different Large Language Models (LLMs) and embedding models. This flexibility enables you to experiment with various models to find the best fit for your project's needs in terms of performance, cost, and output quality.
text-embedding-3-small. You can swap this for other compatible embedding models by modifying the relevant streamText calls and ensuring the necessary API keys are configured.gemini-2.5-flash.gpt-4o-mini.To swap models, you would typically:
model parameter in the streamText calls within the AI generation and RAG chat logic to point to your desired model.The system is built using the Vercel AI SDK, which simplifies integration with various AI providers.
The effectiveness of the AI chat assistant heavily relies on its ability to retrieve relevant context. You can customize the RAG pipeline to optimize how information is found and presented to the LLM.
searchRelevantChunks function determines how relevant code and documentation chunks are retrieved from Vector Search with Qdrant. You can modify parameters like topK (number of chunks to retrieve) or implement custom re-ranking logic to improve the quality of retrieved context.assembleContext function is responsible for structuring the retrieved chunks into a coherent input for the LLM. You can adjust how documentation snippets are prioritized over code, how chunks are formatted, or even introduce additional filtering to ensure the LLM receives the most pertinent information.AI Docs generates documentation that is not only human-readable but also specifically formatted for consumption by other AI systems. These specialized endpoints allow you to integrate your project's knowledge base into custom LLM workflows, chatbots, or other automated tools.
llms-full.txt EndpointThis endpoint provides the complete, concatenated content of all your generated documentation pages in a single plain text file. It's ideal for scenarios where an external AI needs a comprehensive, raw dump of your project's knowledge base for deep analysis, fine-tuning, or extensive context.
llms.txt EndpointThis endpoint provides a structured, summarized index of your documentation, designed for quick semantic lookup and integration into RAG systems. Each entry includes the page title, a direct URL, and a concise one-line description extracted from the page's content.
[Page Title](URL): One-line description. The description is automatically extracted from the beginning of each page's content, stripping markdown and code blocks.skill.md EndpointThis endpoint generates a Markdown file that acts as a comprehensive overview of your project, including its description, repository links, and a table of contents for all documentation pages. It's designed to give an external LLM a high-level understanding of your project's "skills" and available documentation.
llms.txt and llms-full.txt, and a grouped table of contents for all documentation pages. It also highlights "Quick Start" pages based on the first few documents.While the structure of these endpoints is fixed, you can significantly influence the content they serve:
doc.content that populates these endpoints.
llms.txt, ensure your generated documentation pages start with a clear, concise introductory sentence to be effectively captured as the one-line description.skill.md endpoint uses the project's name, description, and repository URL. You can update these details in Project Settings and Customization.skill.md, as well as the overall order in llms-full.txt and llms.txt.When customizing AI behavior in AI Docs, consider these best practices:
topK in RAG, as these can affect API usage.