𝗗𝗼𝗰𝘂𝘀𝗮𝘂𝗿𝘂𝘀 𝘁𝗼 𝗪𝗼𝗿𝗱𝗣𝗿𝗲𝘀𝘀: 𝗧𝗵𝗿𝗲𝗲 𝗪𝗮𝘆𝘀 𝘁𝗼 𝗕𝘂𝗶𝗹𝗱 𝗔𝗜 𝗖𝗵𝗮𝘁
I built three different AI chat architectures. Each one solves a different problem.
The goal is not to find the best tech. The goal is to match the tech to your target user.
𝟭. 𝗧𝗵𝗲 𝗦𝘁𝗮𝘁𝗶𝗰 𝗜𝗻𝗱𝗲𝘅 (𝗗𝗼𝗰𝘂𝘀𝗮𝘂𝗿𝘂𝘀 + 𝗩𝗲𝗿𝗰𝗲𝗹) This approach uses a JSON file inside a static site. A build step turns your markdown files into a single index. The search runs in memory using a serverless function.
• Best for: Documentation sites you own. • Pros: Zero extra infrastructure. It is fast and cheap. • Cons: It does not scale. It works for small amounts of text only.
𝟮. 𝗧𝗵𝗲 𝗦𝗰𝗮𝗹𝗮𝗯𝗹𝗲 𝗦𝗲𝗿𝘃𝗶𝗰𝗲 (𝗡𝗲𝗼𝗻 + 𝗽𝗴𝘃𝗲𝗰𝘁𝗼𝗿) This uses a Postgres database with vector support. It uses real semantic search to find data quickly.
• Best for: SaaS products with many users. • Pros: It handles massive amounts of data. It supports multi-user accounts and history. • Cons: It requires managed infrastructure and more operational work.
𝟯. 𝗧𝗵𝗲 𝗗𝗿𝗼𝗽-𝗶𝗻 𝗣𝗹𝘂𝗴𝗶𝗻 (𝗪𝗼𝗿𝗱𝗣𝗿𝗲𝘀𝘀) This version puts the vectors directly into the WordPress database. It uses PHP to perform a brute-force search over the text chunks.
• Best for: Clients who want a simple WordPress plugin. • Pros: No extra setup. It works on any WordPress host. It stays within the site database. • Cons: It is slower for very large datasets.
𝗞𝗲𝘆 𝗧𝗮𝗸𝗲𝗮𝘄𝗮𝘆𝘀:
- Match architecture to deployment. A WordPress plugin that requires a separate database is not a useful plugin.
- Start small. A static JSON index proves your user experience works before you build complex databases.
- Brute-force search is fine for small sites. For a few thousand passages, it is fast enough. Do not use complex vector engines until you must.
- Keep your code flexible. Use an interface for your vector store. This allows you to switch from JSON to Postgres without rewriting your app.
- Security matters. Encrypt API keys at every layer. Use a bring-your-own-key model so you do not handle sensitive user data.
Source: https://dev.to/kaidanov/from-docusaurus-mai-to-a-wordpress-ai-chat-with-vectors-41ba