-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (72 loc) · 2.66 KB
/
Copy pathMakefile
File metadata and controls
88 lines (72 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Colors
CYAN := \033[36m
GREEN := \033[32m
YELLOW := \033[33m
RED := \033[31m
NC := \033[0m
# Project settings
PROJECT_NAME = kbol
BOOKS_DIR = data/books
PROCESSED_DIR = data/processed
.DEFAULT_GOAL := help
.PHONY: help setup demo process-books stats
help: ## Show this help message
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(CYAN)%-20s$(NC) %s\n", $$1, $$2}'
setup: ## Initial setup of development environment
@echo "$(CYAN)Setting up $(PROJECT_NAME)...$(NC)"
nix-shell --run "poetry install"
@echo "$(CYAN)Installing Ollama models...$(NC)"
ollama pull nomic-embed-text
ollama pull phi3
@mkdir -p $(BOOKS_DIR) $(PROCESSED_DIR)
@echo "$(GREEN)Setup complete!$(NC)"
# Colors and settings as before...
.PHONY: help setup demo process-books stats repl deps query
query: deps ## Query the knowledge base
@poetry run kbol query $(filter-out $@,$(MAKECMDGOALS))
process: deps ## Process books into chunks with embeddings
@poetry run kbol process $(filter-out $@,$(MAKECMDGOALS))
repl: deps ## Start interactive REPL
@echo "$(CYAN)Starting KBOL REPL...$(NC)"
@PYTHONWARNINGS=ignore poetry run kbol repl --show-context --model deepseek-r1
# Allow passing arguments through to query target
%:
@:
demo: setup ## Run complete demo pipeline with sample book
@echo "$(CYAN)Running demo pipeline...$(NC)"
@echo ""
@echo "$(YELLOW)1. Linking sample books...$(NC)"
./scripts/link_books.sh
@echo ""
@echo "$(YELLOW)2. Processing books with embeddings...$(NC)"
poetry run python -m kbol process
@echo ""
@echo "$(YELLOW)3. Showing statistics...$(NC)"
poetry run python -m kbol stats
@echo ""
@echo "$(YELLOW)4. Generating documentation...$(NC)"
poetry run python -m kbol prompt . -o README-phi3.md
poetry run python -m kbol convert README-phi3.md -t org
@echo ""
@echo "$(GREEN)Demo pipeline complete! Check:$(NC)"
@echo "- $(BOOKS_DIR) for linked books"
@echo "- $(PROCESSED_DIR) for processed chunks"
@echo "- README-phi3.md and README-phi3.org for generated documentation"
load-books: ## Link relevant books from your collection
@echo "$(CYAN)Linking books...$(NC)"
./scripts/link_books.sh
@ls -l $(BOOKS_DIR)
process-books: ## Process books into chunks with embeddings
@echo "$(CYAN)Processing books...$(NC)"
poetry run python -m kbol process
stats: ## Show statistics about processed books
@echo "$(CYAN)Book Processing Statistics:$(NC)"
poetry run python -m kbol stats
clean: ## Clean generated files and directories
@echo "$(CYAN)Cleaning project...$(NC)"
rm -rf $(PROCESSED_DIR)/*
rm -f README-phi3.md README-phi3.org
@echo "$(GREEN)Clean complete!$(NC)"