Skip to content

pheonix-coder/kb-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 MindsDB KB Manager

A simple and extensible project to manage MindsDB Knowledge Bases — create, ingest, query, summarize, and interact via agents. Includes a CLI and optional terminal-style UI demo.


📌 Overview

This project streamlines core operations on MindsDB Knowledge Bases:

  • 📁 Create KBs with embedding and metadata configurations
  • 📊 Ingest CSV/text data into KBs
  • 🔍 Query KBs using natural language, with or without metadata filters
  • 🧠 Summarize KB content via GPT-3.5
  • 🤖 Create AI agents connected to specific KBs
  • 💬 Chat with agents using natural questions

MindsDB acts as the orchestration engine for vector indexing, OpenAI integration, and agent execution.



⚙️ Setup

0. Clone the Repository

git clone github.com/pheonix-coder/kb-manager.git
cd mindsdb-kb-manager

1. MindsDB and Ollama Setup

Setup MindsDB and Ollama with Docker (docker-compose.yml is provided):

docker-compose up -d

Install nomic-embed-text or any other embedding model in Ollama container:

docker exec ollama ollama pull nomic-embed-text

2. MindsDB SQL Prerequisites

Run these in the MindsDB SQL editor:

-- OpenAI Engine
CREATE ML_ENGINE openai_engine 
FROM openai
USING
  openai_api_key = "your_openai_api_key";

-- Summarizer model
CREATE MODEL kb_summarizer
PREDICT summary
USING
  engine = 'openai_engine',
  model_name = 'gpt-3.5-turbo',
  prompt_template = 'Provide a concise summary of the following knowledge base content and highlight the main insights:\n\n{{kb_content}}\n\nSummary:';

-- Vector backend
CREATE DATABASE pvec
WITH
  ENGINE = 'pgvector',
  PARAMETERS = {
    "host": "pgvector",
    "port": 5432,
    "database": "ai",
    "user": "ai",
    "password": "ai",
    "distance": "cosine"
  };

2. Python Setup

# Create virtual environment
uv venv
source .venv/bin/activate

# Install dependencies
uv pip install -r requirements.txt

🧪 Usage

CLI

python main.py --help

Example:

# Create a new KB
python main.py init-kb --name quotes_kb --model-name nomic-embed-text ...

# Ingest data
python main.py ingest-kb --kb-name quotes_kb --file-path "data/quotes.csv"

# Query KB
python main.py query-kb --kb-name quotes_kb --query "inspiration" --relevance 0.3

# Summarize KB
python main.py summarize-kb --kb-name quotes_kb --query "life insights"

# Create & chat with agent
python main.py create-agent --agent-name quote_bot --knowledge-bases quotes_kb ...
python main.py chat-agent --agent-name quote_bot --question "What did Einstein say about logic?"

💡 Use Cases

  • ✅ Quickly prototype KBs and agents without building full UI
  • ✅ Run automated ingestion and querying pipelines for AI use cases
  • ✅ Summarize large KBs into digestible formats
  • ✅ Validate MindsDB functionality in real-world agent workflows

🧠 Powered By

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages