The Knowledge Base is a crucial component of Moonlit Platform, serving as a repository for your domain knowledge. It consists of two main sections:

  1. Documents: For hosting large unstructured data
  2. Variables: For storing constant values that can be referenced in prompts

Adding Documents

There are three primary methods to add documents to your Knowledge Base:

  1. Upload files
  2. Import a single web page
  3. Import a sitemap

When adding documents, Moonlit scans the content and chunks it into smaller pieces, creating a system known as Retrieval Augmented Generation (RAGS).

Testing Your Knowledge Base

Before using your documents in apps, you can test them directly in the Knowledge Base:

  1. Click the "Test" button
  2. Enter a query
  3. An AI agent will semantically search the document chunks and provide a structured response with relevant information and citations

Using Knowledge Base in Apps

To utilize your Knowledge Base in Moonlit apps:

  1. Go to the Studio page and create a new app
  2. Add the "Retrieve Knowledge" function
  3. Configure the function with your query and select the appropriate store
  4. Enable "agentic retrieval" for more reliable results

The "Retrieve Knowledge" function typically precedes a chat model step in content generation workflows.

Research Agents

Moonlit offers a fourth method for populating documents through Research Agents, which will be covered in a separate lesson.

Key Takeaways

  • The Knowledge Base consists of Documents and Variables sections
  • Documents can be added through file upload, single web page import, or sitemap import
  • Content is chunked for efficient retrieval
  • Testing allows you to query your Knowledge Base before using it in apps
  • The "Retrieve Knowledge" function enables the use of your Knowledge Base in Moonlit apps
  • Research Agents provide an additional method for populating documents automatically