Setup Guide
Follow the steps below to configure and store data using a Custom Script for MongoDB in the Generative AI Documents section.
Step 1 — Navigate to Generative AI Documents
Go to the Train → Generative AI → Documents section.
Click Upload Document to add a new data source for storage.

Step 2 — Select Custom as Content Source
In the Configure Documents to your Knowledge Base screen, choose Custom as the content source.
This option allows you to upload a Python script that fetches external data and converts it into structured JSON for Mongo storage.
Provide the required information for the script configuration.
Script Title: Enter a descriptive name for the custom script.
Example: Doctor Details Mongo
Category: Select a category to organize the indexed document.
Language: Choose the language used in the indexed content.

Step 3 — Add the Custom Script
In the Custom Indexing section, paste the Python script that retrieves and formats the external data.
The script should:
- Fetch data from the external source (API, Google Sheets, Sitemap, etc.)
- Convert the data into structured JSON
- Return the JSON output using sys.stdout.write
For Mongo storage, the response should use the data_to_save field.
This JSON output will be used by the platform to store the content in MongoDB.

Step 4 — Configure Auto Refresh (Optional)
You can enable AutoRefresh to automatically update the stored data.
Enable the AutoRefresh toggle and set the Refresh Interval (in days).
Example:
Refresh Interval: 7 days
This ensures the script runs periodically and updates the stored data with the latest information.
After entering the details, click Continue.

Step 5 — Review and Confirm Setup
Review the configuration before starting the storage process.
Verify the following:
- Script Title
- Category
- Language
- Content Source
- Indexing Configuration
- AutoRefresh settings

Once confirmed, click Save & Start Indexing.
Step 6 — Verify Document Status
After processing completes, the document will appear in the Generative AI Documents list.
The status will show:

📚 Next Steps
Once the Mongo DB indexing status shows Ready to Search, configure the agent workflow so the AI can retrieve knowledge from the indexed website content. ➡️ Continue with Mongo DB Path SetupMongo Path Setup