> ## Documentation Index
> Fetch the complete documentation index at: https://docs.peanutsapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge Base Fundamentals

> Upload documents and let AI extract structured data for instant lookups

<Info>
  **Time:** 15 minutes | **Level:** Advanced\
  **Prerequisites:** [Customizing Helpers](/tutorials/intermediate/customizing-helpers)
</Info>

## What You'll Learn

* Understanding the Knowledge Base concept
* Uploading documents (PDFs, Excel, images)
* How AI extracts structured data
* Querying your knowledge with Ask Peanuts
* Linking knowledge to helpers

***

## What is the Knowledge Base?

The Knowledge Base is your personal AI-powered document library. Upload price lists, catalogs, manuals, or any reference material—Peanuts extracts the data and makes it instantly searchable.

<CardGroup cols={2}>
  <Card title="Traditional Approach" icon="file-lines">
    Open PDF → Search manually → Copy data → Paste into spreadsheet
  </Card>

  <Card title="With Knowledge Base" icon="sparkles">
    Upload once → Ask questions → Get instant answers
  </Card>
</CardGroup>

***

## Uploading Your First Document

<Steps>
  <Step title="Access Knowledge Base">
    Navigate to **Settings** → **Knowledge Base** or tap the brain icon in the main menu.
  </Step>

  <Step title="Add a Document">
    Tap **Upload Document** and select your file:

    * **PDFs**: Price lists, catalogs, manuals
    * **Excel/CSV**: Spreadsheets with structured data
    * **Images**: Photos of price boards, menus, charts
  </Step>

  <Step title="Wait for Processing">
    AI analyzes your document and extracts:

    * Tables and structured data
    * Key-value pairs
    * Categories and hierarchies

    Processing takes 10-60 seconds depending on document size.
  </Step>

  <Step title="Review Extracted Data">
    Once complete, review what was extracted:

    * Check accuracy of numbers
    * Verify category assignments
    * Edit any misread values
  </Step>
</Steps>

***

## Supported Document Types

<AccordionGroup>
  <Accordion title="PDF Documents" icon="file-pdf">
    **Best for:** Price lists, product catalogs, service menus

    **Tips:**

    * Text-based PDFs work better than scanned images
    * Tables with clear headers extract most accurately
    * Multi-page documents are fully supported

    **Extraction includes:** Tables, lists, pricing structures, product hierarchies
  </Accordion>

  <Accordion title="Excel & CSV Files" icon="file-excel">
    **Best for:** Spreadsheets, data exports, inventory lists

    **Tips:**

    * Include header rows for best results
    * Named sheets help organize extracted data
    * Formulas are evaluated, not preserved

    **Extraction includes:** All data with column relationships preserved
  </Accordion>

  <Accordion title="Images" icon="image">
    **Best for:** Photos of menus, price boards, handwritten lists

    **Tips:**

    * Good lighting dramatically improves accuracy
    * Straight-on photos work better than angles
    * High resolution captures small text

    **Extraction includes:** OCR text, detected tables, structured data
  </Accordion>

  <Accordion title="Word Documents" icon="file-word">
    **Best for:** Formatted documents, reports, specifications

    **Tips:**

    * Tables in Word extract cleanly
    * Embedded images are also processed
    * Formatting helps identify structure

    **Extraction includes:** Text, tables, embedded data
  </Accordion>
</AccordionGroup>

***

## Querying Your Knowledge

Once documents are processed, use **Ask Peanuts** to query them:

<Tabs>
  <Tab title="Direct Questions">
    Ask specific questions about your uploaded data:

    ```
    "What's the price for A3 glossy prints?"
    "How much does express shipping cost for orders over $100?"
    "What's the warranty period for Model X500?"
    ```

    Peanuts searches your knowledge base and returns precise answers.
  </Tab>

  <Tab title="Comparisons">
    Compare options across your documents:

    ```
    "Compare prices between standard and premium paper"
    "Which shipping option is cheapest for 5kg packages?"
    "What's the difference between Plan A and Plan B?"
    ```
  </Tab>

  <Tab title="Calculations">
    Request calculations based on your data:

    ```
    "Calculate the cost of 500 business cards on matte paper"
    "What's the total for 3 large pizzas with extra cheese?"
    "How much for 10 hours of consulting at the senior rate?"
    ```
  </Tab>
</Tabs>

***

## How Extraction Works

<Steps>
  <Step title="Document Analysis">
    AI identifies the document type and structure—tables, lists, paragraphs, headers.
  </Step>

  <Step title="Data Extraction">
    Structured data is pulled out:

    * Product names and descriptions
    * Prices and quantities
    * Categories and subcategories
    * Conditions and notes
  </Step>

  <Step title="Schema Generation">
    A queryable schema is created:

    ```json theme={null}
    {
      "products": [
        {
          "name": "Business Cards",
          "variants": [
            { "paper": "Matte", "quantity": 100, "price": 25.00 },
            { "paper": "Glossy", "quantity": 100, "price": 30.00 }
          ]
        }
      ]
    }
    ```
  </Step>

  <Step title="Indexing">
    Data is indexed for fast natural language queries.
  </Step>
</Steps>

***

## Linking Knowledge to Helpers

Make your knowledge available within specific helpers:

<Steps>
  <Step title="Open Helper Settings">
    Go to the helper you want to enhance → **Settings** → **Knowledge**.
  </Step>

  <Step title="Select Documents">
    Choose which knowledge documents to link:

    * Link a price list to a "Quotes" helper
    * Link product specs to a "Support" helper
    * Link menus to an "Orders" helper
  </Step>

  <Step title="Use in Entries">
    When creating entries, Ask Peanuts can now reference linked knowledge:

    ```
    "Add a quote for 200 brochures, tri-fold, glossy"
    ```

    Peanuts looks up your pricing and fills in the correct amount.
  </Step>
</Steps>

***

## Best Practices

<CardGroup cols={2}>
  <Card title="Keep Documents Updated" icon="arrows-rotate">
    Upload new versions when prices or data change. Old versions are archived.
  </Card>

  <Card title="Use Clear Headers" icon="heading">
    Tables with descriptive headers extract more accurately.
  </Card>

  <Card title="Organize by Topic" icon="folder-tree">
    Upload separate documents for different product lines or services.
  </Card>

  <Card title="Review Extractions" icon="magnifying-glass">
    Always verify extracted data, especially numbers and prices.
  </Card>
</CardGroup>

***

## Exercise

<Card title="Practice: Upload Your First Price List" icon="dumbbell">
  1. Find a price list, menu, or catalog (PDF or image)
  2. Upload it to the Knowledge Base
  3. Wait for processing to complete
  4. Review the extracted data and correct any errors
  5. Ask Peanuts 3 questions about the data:
     * A specific price lookup
     * A comparison between options
     * A simple calculation

  **Success criteria:** All 3 questions return accurate answers from your document.
</Card>

***

## Key Takeaways

<Tip>
  **Remember:** The Knowledge Base transforms static documents into queryable data. Upload once, query forever—no more manual lookups.
</Tip>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Building Price Calculators" href="/tutorials/advanced/building-price-calculators" icon="calculator">
    Create dynamic pricing tools from your knowledge
  </Card>

  <Card title="Knowledge Feature" href="/features/knowledge" icon="book-open">
    Full feature documentation
  </Card>
</CardGroup>
