Skip to main content

Overview

KnowledgeBase can process raw text strings directly — no file on disk required. This is useful for ingesting API responses, user input, database records, or any text content you already have in memory. String content is automatically detected and doesn’t need a loader.

String Content as Source

Pass text strings directly in sources:

Mixed Sources (Files + Text)

Combine file paths, directories, and string content in a single KnowledgeBase:

Adding Text After Setup

Use add_text() to insert raw text into an already-initialized knowledge base:

How Detection Works

KnowledgeBase classifies a string as direct content (not a file path) when:
  • It contains newlines
  • It’s longer than 200 characters
  • It has more than 5 words without file-like patterns
  • It doesn’t match any file on disk
This means short strings that look like file paths (e.g., "report.pdf") are treated as file paths, while longer text blocks are treated as content.