# Using Backend Data Sources in SmartForms

FormWise allows **SmartForm owners** to attach backend data sources to their AI-powered tools. These sources help the AI provide **more accurate, context-aware responses** by referencing **pre-uploaded documents, scraped URLs, and other structured data.**

**✅ What Can Be Used as a Backend Data Source?**

* **📂 Pre-Uploaded Files:** PDFs, CSVs, TXT files
* **🌍 Web Scraping:** Extracting content from URLs
* **🔍 Web Browsing:** Searching the web for real-time metadata
* **🔗 Multiple Prompt Steps:** Using different data sources across prompt chaining

By attaching **backend data** before user submissions, you ensure that AI responses are **aligned with your industry, niche, or proprietary knowledge.** However, **too many files or combining multiple retrieval methods** can cause **timeouts or token issues**—this guide will help you optimize performance.

***

### **1️⃣ Uploading Backend Data Sources in SmartForms**

#### **🔹 Where to Upload Backend Data Sources**

📌 **Before attaching them to a SmartForm, all backend data sources must be uploaded in the "Documents" tab inside the SmartForm builder.**

🔹 **Steps to Upload:**\
1️⃣ Go to the **SmartForm builder** → **Navigate to the "Documents" tab.**\
2️⃣ Click **"Upload Document"** and select a **PDF, CSV, or TXT file.**\
3️⃣ If you want to **scrape a URL**, enter the **URL** in the provided field.\
4️⃣ Once uploaded, these **documents & scraped URLs** are now available to reference inside your SmartForm’s **prompt instructions.**

<figure><img src="https://728196400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Lugni2T5TewiPeYs1ka%2Fuploads%2FdMfHy6UohVzcbVcmr1am%2Fimage.png?alt=media&#x26;token=1702787c-36ac-4ddb-af0c-a005474146ad" alt=""><figcaption></figcaption></figure>

***

### **2️⃣ Attaching Backend Data Sources to Prompt Steps**

Once documents are uploaded, you can **attach them to specific prompt steps** to guide how AI should use the data.

🔹 **How It Works:**\
✅ Each SmartForm **prompt step** can have its own **backend data sources** attached.\
✅ You can include **pre-uploaded documents**, **scraped URLs**, or **enable web browsing** within each step.\
✅ If using **multiple prompt steps (prompt chaining),** you can attach different **data sources at each step.**

<figure><img src="https://728196400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Lugni2T5TewiPeYs1ka%2Fuploads%2FTFA6KJvkZv11MLckB2yc%2Fimage.png?alt=media&#x26;token=9fe93f22-f0d3-46b3-84ae-d91b7fd07f79" alt=""><figcaption></figcaption></figure>

📌 **Example Use Case:**\
**Step 1:** AI pulls insights from a **pre-uploaded industry report (PDF).**\
**Step 2:** AI references a **scraped competitor website (URL) for comparisons.**\
**Step 3:** AI searches **real-time trends via web browsing** before generating the final response.

🚨 **Too many data sources in one step can overload AI processing—spread them across multiple steps when needed.**

***

### **3️⃣ Best Practices for Using Backend Data Sources**

#### **🔹 File Size Limits (Per Upload)**

📌 **Pro Plan:** **2MB max per file** (multiple files allowed).\
📌 **Agency Plan:** **20MB max per file** (multiple files allowed).

🚀 **You can attach multiple files per SmartForm, but too many large files can cause token issues and slow performance.**

#### **🔹 No Hard Limit on File Uploads, But Be Cautious**

✅ There’s **no upper limit** on the number of files you can attach.\
🚨 However, AI **only processes a certain amount of text at a time.** If too much information is loaded, **responses may be incomplete, slow, or cause a timeout.**

#### **🔹 Using Web Scraping & Web Browsing**

🚨 **Avoid combining all retrieval methods (file uploads, web scraping, and web browsing) in one step.**\
📌 **Web Scraping (URLs):** The AI **extracts content** from the webpage and **treats it like an uploaded file.**\
📌 **Web Browsing:** AI searches for **real-time metadata** from search engine results and summarizes findings.

✅ **Best Practice:** If your SmartForm **already has uploaded PDFs and CSVs, avoid adding unnecessary web browsing or web scraping** unless the request specifically needs it.

***

### **4️⃣ How Retrieval Works (RAG Explained in Simple Terms)**

When AI processes a **backend data source**, it does **not "train" on the file** but instead:\
1️⃣ **Extracts key insights** from the uploaded file or scraped URL.\
2️⃣ **Retrieves relevant portions** based on the SmartForm prompt.\
3️⃣ **Generates a response using both AI knowledge + retrieved data.**

🚀 **Think of it as a "smart document search" where the AI finds and summarizes what matters most.**

***

### **5️⃣ Customizing How AI Uses the Data (Prompt Injection in Data Sources)**

Each **backend data source** allows you to **inject a short instruction** that tells AI **how to use the uploaded content.**

🔹 **Default Instruction:**\
📌 **"Use this data to substantiate your response."**

🔹 **Best Practices for Custom Instructions:**\
✅ If analyzing **financial reports**, use: **"Use this data to generate financial summaries."**\
✅ If comparing **competitor websites**, use: **"Use this scraped data to compare industry trends."**\
✅ If referencing **a policy document**, use: **"Use this PDF to answer questions about our policies."**

📌 **Customizing this instruction ensures AI retrieves only relevant data instead of processing everything at once.**

***

### **6️⃣ Avoiding Timeouts & Optimizing Performance**

If **your SmartForm tool is timing out**, try these fixes:\
✅ **Reduce file sizes** (split large PDFs into sections).\
✅ **Limit the number of attached documents per prompt step.**\
✅ **Avoid combining multiple retrieval methods in the same step.**\
✅ **Use precise prompt instructions** to make AI focus on the right data.

📌 **Example Fix:**\
❌ **Bad:** "Analyze the entire 50-page report and summarize it."\
✅ **Better:** "Find and summarize the top 3 insights from the report."

***

#### **🚀 Conclusion**

Backend data sources make **SmartForms more powerful** by allowing AI to reference **custom documents, structured data, and real-time information.**

✅ **Upload your files first in the “Documents” tab before attaching them to SmartForm prompts.**\
✅ **Be mindful of file size limits & avoid combining too many retrieval methods in a single step.**\
✅ **Use clear prompt instructions to optimize how AI retrieves data.**

By following these best practices, you’ll ensure that **your SmartForms run efficiently and deliver high-quality AI-powered responses.** 🚀

&#x20;  4o
