Skip to content

F25 -- Knowledge Base

Provides a searchable internal knowledge base with AI-powered Q&A for campaign staff to quickly find policies, procedures, and talking points using RAG (Retrieval-Augmented Generation).

Key Features

  • Document ingestion: Upload internal campaign documents that are chunked, embedded, and stored for semantic search.
  • RAG-powered Q&A: Ask natural language questions and receive answers grounded in ingested documents.
  • Source citations: Every answer includes references to the source documents and relevance scores.
  • Session management: Persistent Q&A sessions for ongoing research conversations.
  • Content deduplication: Prevents re-ingesting documents that already exist in the knowledge base.
  • Document lifecycle: Manage document status (active, deleted) with vector cleanup.

Server Functions

FunctionEndpointDescription
kb_ingest_documentknowledge-base/ingestIngest a document into the knowledge base
kb_list_documentsknowledge-base/list-documentsList all knowledge base documents
kb_delete_documentknowledge-base/delete-documentSoft-delete a document
kb_queryknowledge-base/queryAsk a question against the knowledge base
kb_create_sessionknowledge-base/create-sessionCreate a new Q&A session
kb_list_sessionsknowledge-base/list-sessionsList Q&A sessions
kb_get_messagesknowledge-base/get-messagesGet messages for a session

RAG Configuration

ParameterValue
Collection nameknowledge_base
Vector dimension1536 (auto-detected)
Chunk size300 words
Chunk overlap50 words
Top-K results5
Score threshold0.3

Differences from Policy Chatbot (F02)

While the Knowledge Base shares the same RAG infrastructure as the Policy Chatbot, they serve different purposes:

AspectPolicy Chatbot (F02)Knowledge Base (F25)
AudienceCitizens and publicInternal campaign staff
ContentPublic policy documentsInternal procedures, talking points, memos
Collectionpolicy_documentsknowledge_base
TonePublic-facing, non-partisanInternal, operational

UI Components

  • Knowledge base page (/knowledge-base): Q&A interface with document management.
  • Chat panel: Ask questions and receive answers with source citations.
  • Document manager: Upload, browse, and delete knowledge base documents.
  • Session history: Switch between Q&A sessions.
  • Source viewer: Expand source citations to see the relevant document chunks.

Database Tables

  • documents -- shared with F02, filtered by collection_name = 'knowledge_base'
  • chat_sessions -- shared with F02, filtered by session_type = 'knowledge_base'
  • chat_messages -- shared with F02, messages linked to knowledge base sessions