# Using Backend Data Sources in CoPilots

FormWise **CoPilots** allow owners to attach **backend data sources** that serve as **non-AI engine reference materials** for AI responses. These sources provide **static, structured, or document-based knowledge** that the CoPilot can use when generating responses.

Unlike **front-end user uploads**, **backend data sources are pre-loaded** by the CoPilot owner and remain available across all user conversations.

***

### **1️⃣ How Backend Data Sources Work in CoPilots**

🔹 **CoPilot owners** upload **PDFs, CSVs, TXT files, or scraped URLs** to be referenced in **every conversation.**\
🔹 AI retrieves **relevant data from these sources** to substantiate responses.\
🔹 **No separate prompt field for each document**—instead, AI behavior is controlled through the **CoPilot’s instruction prompt.**

💡 **Example Use Cases:**\
✅ **A SaaS support CoPilot:** Uses **pre-uploaded documentation** to answer FAQs.\
✅ **A real estate CoPilot:** References **CSV property listings** to provide investment insights.\
✅ **A legal CoPilot:** Accesses **policy PDFs** to analyze contract terms.

<figure><img src="https://728196400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Lugni2T5TewiPeYs1ka%2Fuploads%2FUSiX3vZkc6yP313sNRFB%2Fimage.png?alt=media&#x26;token=79a7b9de-106e-4426-bd32-3774dcaf9738" alt=""><figcaption></figcaption></figure>

***

### **2️⃣ Uploading Backend Data Sources to CoPilots**

📌 **Before a CoPilot can reference a data source, the owner must upload files in the "Documents" tab inside the CoPilot builder.**

🔹 **Steps to Upload:**\
1️⃣ Navigate to the **CoPilot Builder** → Click on the **"Documents" tab.**\
2️⃣ Upload a **PDF, CSV, or TXT file** to store as a **retrievable knowledge base.**\
3️⃣ If using **web scraping**, enter a **URL** to extract webpage content.\
4️⃣ AI will now **reference these files or web content** when responding to users.

✅ **Once uploaded, these sources are always available** and don’t need to be reuploaded again and can be used for multiple CoPilots.

<figure><img src="https://728196400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Lugni2T5TewiPeYs1ka%2Fuploads%2FC3067bxt2PVDdjPeX0QB%2Fimage.png?alt=media&#x26;token=3d99bf61-92b1-46b8-88cf-00943e74ce57" alt=""><figcaption></figcaption></figure>

***

### **3️⃣ How AI Retrieves & Processes Backend Data Sources**

When a user chats with the CoPilot, AI **dynamically references** the pre-uploaded backend data, similar to a **searchable knowledge base**.

#### **Retrieval-Augmented Generation (RAG in Simple Terms)**

1️⃣ AI **retrieves** relevant information from the attached documents.\
2️⃣ AI **integrates** the retrieved content into its response.\
3️⃣ AI **does not "train" on the files**—it simply **references them when needed** for accuracy.

🚨 **If too many files are attached, AI may struggle to find relevant content, leading to slower or incomplete responses.**

***

### **4️⃣ File Size Limits & Best Practices**

#### **🔹 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, but too many large files can cause processing delays or token issues.**

#### **🔹 Avoid Overloading AI with Too Many Data Sources**

✅ **Upload only necessary reference files**—too many sources can cause **irrelevant responses or timeouts.**\
✅ **If referencing structured data (CSV), ensure column headers are clear** so AI understands the context.

📌 **Example Fix:**\
❌ **Bad:** Uploading **20 PDFs with broad information**—AI may retrieve unrelated details.\
✅ **Better:** Uploading **3-5 focused documents** with clear, relevant content for the CoPilot’s purpose.

***

### **5️⃣ Controlling AI Behavior with CoPilot Instructions**

Unlike **SmartForms**, **backend data sources in CoPilots do not have individual instruction prompts** for each file. Instead, **AI behavior is controlled via the CoPilot’s instruction prompt.**

💡 **Example Instructions:**\
📌 **For a compliance CoPilot:**\
\&#xNAN;*"Use the uploaded legal policy documents to verify whether the user’s request aligns with compliance standards."*

📌 **For a healthcare chatbot:**\
\&#xNAN;*"Reference the pre-uploaded medical guidelines before suggesting any recommendations."*

📌 **For an e-commerce CoPilot:**\
\&#xNAN;*"Pull product descriptions from the CSV file before generating marketing copy."*

🚀 **By fine-tuning the CoPilot’s instructions, you control how AI references backend data for better accuracy.**

***

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

🔹 **If a CoPilot chat times out:**\
✅ **Reduce the number of attached files.**\
✅ **Use concise, structured documents (CSV for data, PDF for text-heavy references).**\
✅ **Avoid combining too many retrieval methods** (file uploads, web scraping, web browsing).\
✅ **Refine CoPilot instructions to guide AI behavior effectively.**

***

#### **🚀 Conclusion**

Backend data sources make **CoPilots more powerful** by enabling **static, structured, and document-based references** for AI responses.

✅ **Upload files in the "Documents" tab before attaching them to the CoPilot.**\
✅ **AI retrieves relevant insights dynamically** from preloaded PDFs, CSVs, and TXT files.\
✅ **Fine-tune AI behavior using the CoPilot’s instruction prompt.**\
✅ **Follow best practices to optimize performance and prevent timeouts.**

By leveraging backend data sources, you ensure your CoPilot **delivers precise, knowledge-driven responses** without relying solely on AI-generated content. 🚀
