text-sources

Text Sources#

Add knowledge to your agent by directly pasting or typing text content. Text sources are the fastest way to add information - no file upload needed!

What are Text Sources?#

Text sources let you add plain text content directly to your agent's knowledge base. Perfect for:

  • Quick notes and policies
  • Single-page information
  • Content you want to paste from websites
  • Testing your agent with sample content
  • Short guides and instructions

How It Works#

Code
1. Enter Text → Paste or type content
   ↓
2. Immediate Chunking → ChunkManager.storeChunksWithNamespace()
   - Chunk size: 2000 characters (~500 words)
   - Namespace: "docs"
   ↓
3. Generate Embeddings → embedding-generation queue
   - Creates vector embeddings
   ↓
4. Status: Ready (30-60 seconds)

Processing Time: 30-60 seconds (much faster than file uploads!)

Step-by-Step: Adding a Text Source#

1. Navigate to Knowledge Base#

  1. Go to your agent's dashboard
  2. Click Knowledge Base tab
  3. Click Add SourceText

2. Enter Content#

Source Name (required)

  • Descriptive name for this text
  • Examples: "Return Policy", "Business Hours", "Product Features"

Text Content (required)

  • Paste or type your content
  • Max length: 100,000 characters (~25,000 words)
  • Supports multiple paragraphs and line breaks

Example content:

Code
Business Hours and Contact Information

We're open Monday through Friday, 9:00 AM to 5:00 PM EST.
Closed on weekends and major holidays.

Contact us:
- Email: support@company.com
- Phone: +1 (555) 123-4567
- Live chat: Available during business hours

Response times:
- Email: Within 24 hours
- Phone: Immediate
- Live chat: Immediate during business hours

3. Configure Settings#

Priority (optional)

  • Normal (default): Standard retrieval weight
  • High: More likely to be retrieved
  • Low: Lower retrieval priority

Mark as Price Information (checkbox)

  • Check if this contains pricing information
  • Auto-sets priority to 1.0 (highest)

4. Add and Train#

  1. Click Add Text Source
  2. Source appears in "Processing" status
  3. Click Train Agent
  4. Wait 30-60 seconds for "Ready" status

Your agent can now answer questions using this content!

Best Practices#

Content Formatting#

Do:

  • Use clear headings and sections
  • Break content into paragraphs
  • Use bullet points and numbered lists
  • Include relevant keywords
  • Keep information accurate and up-to-date

Don't:

  • Use complex formatting (tables, columns) - they won't render
  • Include HTML or Markdown tags - they'll be treated as text
  • Paste overly long content - split into multiple sources instead
  • Include outdated information
  • Use vague or ambiguous language

Content Structure#

Good structure:

Code
Topic Title

Brief introduction explaining what this covers.

Key Point 1:
- Detail A
- Detail B
- Detail C

Key Point 2:
More information here.

Contact Information:
Email: example@company.com

Bad structure:

Code
lots of info here with no structure just one big paragraph that goes on and on making it hard to read and process and retrieve relevant information because theres no clear organization or headings

Content Length#

Optimal lengths:

  • Short content (100-500 words): Single topic, policy, or FAQ answer
  • Medium content (500-2000 words): Detailed guide, multiple related topics
  • Long content (2000-10000 words): Comprehensive documentation

Too long (>10000 words)?

  • Split into multiple text sources by topic
  • Or upload as a file instead

Common Use Cases#

1. Company Policies#

Code
Return and Refund Policy

We offer a 30-day money-back guarantee on all purchases.

To request a refund:
1. Contact support within 30 days of purchase
2. Provide your order number
3. Explain the reason for return

Refunds are processed within 5-7 business days.

Exceptions:
- Digital products: 14-day return window
- Custom orders: Non-refundable
- Sale items: Final sale, no returns

2. Product Information#

Code
Premium Plan Features

The Premium plan includes:
- Unlimited messages (no monthly cap)
- Priority support (24/7 live chat)
- Advanced analytics dashboard
- Custom branding (logo, colors)
- API access for integrations
- Dedicated account manager

Pricing: $99/month (billed annually at $990/year)

Upgrade anytime from your account dashboard.

3. FAQ Content#

Code
Frequently Asked Questions

Q: How do I reset my password?
A: Click "Forgot Password" on the login page, enter your email, and follow the instructions sent to your inbox.

Q: Can I cancel my subscription anytime?
A: Yes! Cancel from your account settings. You'll retain access until the end of your billing period.

Q: Do you offer discounts for non-profits?
A: Yes! Non-profit organizations qualify for 20% off. Contact sales@company.com with proof of non-profit status.

Editing Text Sources#

Updating Content#

  1. Find the source in the Knowledge Base list
  2. Click Edit (pencil icon)
  3. Update the text content
  4. Click Save
  5. Re-train your agent for changes to take effect

Note: Content changes aren't live until you re-train!

Changing Name or Priority#

  1. Click Edit on the source
  2. Update name, priority, or "Is Price" setting
  3. Click Save
  4. Re-train your agent

Troubleshooting#

"Content Too Long" Error#

Problem: Your text exceeds 100,000 characters

Solutions:

  • Split content into multiple text sources
  • Upload as a file instead (supports larger content)
  • Remove unnecessary information

"Agent Not Using Text Content"#

Causes:

  • Forgot to train after adding/editing
  • Source still processing
  • Questions not related to content

Solutions:

  • Click "Train Agent" button
  • Wait for "Ready" status
  • Test with questions directly from your text

"Text Content Lost After Edit"#

Prevention:

  • Copy your text before editing (backup)
  • Save frequently during editing
  • Don't close browser during save

Recovery:

  • Check if auto-save draft exists (some browsers)
  • Re-enter content if lost (no recovery available)

Examples#

Example 1: Business Hours#

Name: "Store Hours and Holidays"

Content:

Code
Store Hours

Monday - Friday: 9:00 AM - 9:00 PM
Saturday: 10:00 AM - 7:00 PM
Sunday: 11:00 AM - 6:00 PM

Holiday Hours:
- Thanksgiving: Closed
- Christmas Eve: 9:00 AM - 5:00 PM
- Christmas Day: Closed
- New Year's Day: 10:00 AM - 6:00 PM

Special summer hours (June-August):
Monday - Saturday: 9:00 AM - 10:00 PM

Expected questions:

  • "What time do you close?"
  • "Are you open on Sundays?"
  • "What are your holiday hours?"

Example 2: Shipping Policy#

Name: "Shipping and Delivery Information"

Content:

Code
Shipping Options

Standard Shipping (5-7 business days): FREE on orders $50+
Express Shipping (2-3 business days): $9.99
Overnight Shipping (1 business day): $24.99

We ship to:
- All 50 US states
- Canada (add $15 for standard)
- International (contact for rates)

Order processing:
- Orders placed before 2 PM EST ship same day
- Orders after 2 PM EST ship next business day

Tracking:
You'll receive a tracking number via email once your order ships.

Expected questions:

  • "How much is shipping?"
  • "Do you ship internationally?"
  • "When will my order arrive?"

Example 3: Product Comparison#

Name: "Plan Comparison: Basic vs Pro"

Content:

Code
Basic Plan ($29/month):
- 1,000 messages per month
- 1 agent
- Email support
- Basic analytics
- 7-day chat history

Pro Plan ($99/month):
- 10,000 messages per month
- 5 agents
- Priority support (live chat)
- Advanced analytics
- Unlimited chat history
- Custom branding
- API access

Best for:
- Basic: Small businesses, testing
- Pro: Growing businesses, teams

Expected questions:

  • "What's the difference between Basic and Pro?"
  • "How many messages do I get?"
  • "Does the Basic plan include API access?"

API Reference#

For developers adding text sources programmatically:

Endpoint: POST /api/agents/[id]/sources/text

Request:

typescript
const response = await fetch(`/api/agents/${agentId}/sources/text`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${apiKey}`
  },
  body: JSON.stringify({
    name: 'My Text Source',
    content: 'Your text content here...',
    priority: 0.8,
    isPrice: false
  })
})

Response:

json
{
  "success": true,
  "source": {
    "id": "source-uuid",
    "name": "My Text Source",
    "type": "text",
    "status": "processing"
  }
}

Limits#

PlanMax Text LengthMax SourcesProcessing Time
Free50,000 chars10 sources~30 seconds
Pro100,000 chars100 sources~30 seconds
Enterprise500,000 charsUnlimited~30 seconds

Comparison: Text vs File vs Q&A#

FeatureTextFileQ&A
SpeedFastest (instant)Medium (1-5 min)Fastest (instant)
Max Size100K chars50MBN/A (1 Q&A at a time)
ImagesNoNoYes
FormattingPlain text onlyPreserves structureSupports Q&A format
Best ForQuick notes, policiesDocuments, manualsFAQs, specific Q&A

When to use Text:

  • You have content ready to paste
  • No file available
  • Need fastest processing
  • Content is under 100K characters
  • No images needed

When to use File instead:

  • Content is in a document already
  • Need to preserve complex formatting
  • Content exceeds 100K characters
  • Have multiple pages/sections

When to use Q&A instead:

  • Explicit question-answer pairs
  • Need to attach images to answers
  • Want high retrieval priority for specific questions

Next Steps#

text-sources | AlonChat Docs