AI Knowledge Base
Learn how to train the AI on your specific business rules and FAQs using content.json.
AI Knowledge Base (content.json)
Out of the box, Large Language Models like OpenAI or Gemini are incredibly smart, but they know absolutely nothing about your specific business. They don't know your pricing, your refund policy, or your business hours.
Instead of setting up a complex vector database or vector embeddings, the Smart AI Contact Form uses a simple, highly effective method to train the AI: the content.json file.
Locating the File
In the root folder of your script installation (the same place as your .env file), you will find a file named content.json.
This file acts as the System Prompt for the AI. Every time a user asks a question, this document is silently passed to the AI in the background, acting as its rulebook.
Editing the Knowledge Base
- Open
content.jsonin any text editor or code editor. - You will see a single JSON object with a
system_promptkey. - Replace the placeholder text with your own business rules.
Default Structure:
{
"system_prompt": "You are a helpful customer support assistant for Ionfirm. You answer questions politely and concisely. Our business hours are 9 AM to 5 PM EST. We offer web development services starting at $500. If you do not know the answer, tell the user to leave their email so a human can contact them."
}Crafting the Perfect Prompt
Because modern LLMs have massive context windows, you can write a very detailed prompt. To get the best results, we recommend structuring your prompt into three distinct sections: Identity, Rules, and Knowledge.
Here is an example of a highly effective prompt you can copy and adapt:
{
"system_prompt": "IDENTITY: You are 'Alex', the official AI support agent for [Your Company Name]. You are friendly, professional, and concise. \n\nRULES: 1. Keep answers under 3 sentences if possible. 2. Never invent pricing or features not listed in this prompt. 3. If a user is angry or asks a question you cannot answer, apologize and state that their message has been forwarded to our human team. \n\nKNOWLEDGE: \n- Pricing: Basic tier is $10/mo, Pro tier is $29/mo. \n- Refunds: We offer a 14-day money-back guarantee. \n- Contact: Our direct phone number is 1-800-555-0199. \n- Shipping: We ship physical items within 48 hours."
}⚠️ Important JSON Formatting Rules
Because content.json is a strict data format, one typo will break the script. Please keep these rules in mind when editing:
- Everything must be inside ONE set of double quotes. The entire prompt must be a single string.
- Do not use unescaped double quotes inside your prompt. If you need to quote a word, use single quotes (e.g., You are 'Alex'), or escape the double quotes with a backslash (e.g., You are "Alex").
- Line Breaks: Standard JSON does not support physical line breaks (pressing Enter). If you want to format your prompt with line breaks, use
\nto represent a new line (as seen in the example above).
💡 Pro Tip: Validate your JSON If your widget suddenly stops replying after you edit this file, it is almost certainly a JSON syntax error. Copy the contents of your file and paste it into a free validator like JSONLint.com to find the typo instantly.