No description
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| knowledge_platform | ||
| .gitignore | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
ml-knowledge-platform
Knowledge verification TUI and KV API client with local LLM support via model-boss.
Install
uv add ml-knowledge-platform --extra-index-url https://forge.nasty.sh/api/packages/lilith/pypi/simple/
CLI Usage
# Launch the TUI
knowledge-platform
# One-shot query
knowledge-platform ask "what is the pricing model?"
# Search the knowledge base
knowledge-platform search "governance"
# Verify a claim
knowledge-platform verify "the platform uses blockchain"
# Check dependencies (KV API + LLM)
knowledge-platform check
# Show active system prompt
knowledge-platform prompt
# List available models
knowledge-platform models
CLI Options
# Use a specific model
knowledge-platform ask "question" -m claude-haiku
# Override KV API endpoint
knowledge-platform --kv-api http://custom:41233
# Override system prompt
knowledge-platform --system-prompt "You are a custom assistant."
# Skip dependency checks
knowledge-platform --skip-checks
# JSON output
knowledge-platform ask "question" --json-output
knowledge-platform models --json-output
Library Usage
from knowledge_platform import KnowledgeBackend, KVClient, LaunchConfig, ModelConfig
# Use the KV client directly
async with KVClient(base_url="http://localhost:41233") as kv:
results = await kv.search("pricing model")
validation = await kv.validate("claim to check")
# Use the full backend (KV + LLM routing)
backend = KnowledgeBackend(kv_api_url="http://localhost:41233")
context = await backend.get_context_for_llm("question")
config = LaunchConfig()
model = config.default_model_object
async for chunk in backend.stream_llm_response(messages, model, context):
print(chunk, end="")
Environment Variables
| Variable | Description | Default |
|---|---|---|
KNOWLEDGE_SYSTEM_PROMPT |
Override the system prompt | Generic verification prompt |
KNOWLEDGE_KV_API_URL |
KV API endpoint | http://localhost:41233 |
ANTHROPIC_API_KEY |
For Claude models | — |
Local LLM Infrastructure
Default models use local inference via model-boss + llama-http:
- Port 10010: Ministral 3B (fast formatting) via
llama-http-3b.service - Port 10020: Ministral 14B (reasoning) via
llama-http-14b.service
The platform auto-starts systemd user services when needed and manages GPU VRAM leases through model-boss.
Custom System Prompts
Inject domain-specific knowledge at runtime:
# Via environment variable
export KNOWLEDGE_SYSTEM_PROMPT="You are Crystal, the Lilith platform expert..."
knowledge-platform
# Via CLI flag
knowledge-platform --system-prompt "You are a medical knowledge assistant..."
# Via config file (~/.config/knowledge-platform/config.toml)
echo 'system_prompt = "Your custom prompt here"' > ~/.config/knowledge-platform/config.toml
Priority: CLI flag > env var > config file > built-in default.