Skip to main content

LLM plugin for ai-mini-box — local and remote inference, RAG

Project description

ai-mini-box-llm

LLM plugin for ai-mini-box-core — adds natural language processing: message classification, response drafting, entity extraction, and RAG.

Features

  • Classify messages by topic (Prices, Order, Complaint, Schedule, Other)
  • Draft auto-responses to customer messages
  • Extract entities (phone, name, address, date, order ID)
  • RAG — Retrieval-Augmented Generation from Knowledge Base
  • Two providers: local (GGUF via llama-cpp-python) or remote (OpenAI API)
  • CLI commands for status, testing, model download, KB indexing

Installation

pip install ai-mini-box-llm[local]   # local inference
pip install ai-mini-box-llm[remote]  # OpenAI API

Configuration

Config file: data/llm_config.json (auto-created with defaults):

{
  "provider": "local",
  "model_path": "data/models/Phi-3-mini-q4.gguf",
  "n_ctx": 4096,
  "n_threads": 4,
  "rag_enabled": false,
  "rag_top_k": 3
}

Usage

# Show status
ai-mini-box llm status

# Classify a message
ai-mini-box llm classify "сколько стоит доставка?"

# Generate a draft response
ai-mini-box llm draft "хочу заказать пиццу" --topic "Заказ"

# Extract entities
ai-mini-box llm extract "Позвоните Ивану по телефону +7 123 456 78 90"

# Download a model
ai-mini-box llm download-model Qwen/Qwen2.5-0.5B-Instruct-GGUF:q4_0

# Rebuild RAG index
ai-mini-box llm ingest-kb

Architecture

The plugin registers an LlmService implementation via the generic service registry:

from ai_mini_box.core.services.registry import register_service, get_service

# Registration (done by plugin automatically)
register_service("llm", MyLlmService())

# Usage by any other module
llm = get_service("llm")
if llm:
    topic = llm.classify("How much?")

When the plugin is not installed, get_service("llm") returns None, and the core falls back to built-in heuristics (KeywordClassifier, regex extraction).

Requirements

  • Python 3.12+
  • ai-mini-box-core >= 5.0.0
  • Optional: llama-cpp-python, openai, huggingface-hub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_mini_box_llm-0.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_mini_box_llm-0.1.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file ai_mini_box_llm-0.1.0.tar.gz.

File metadata

  • Download URL: ai_mini_box_llm-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for ai_mini_box_llm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f56ea36748949dc7ae2d4ab9a0425151233a2323f9924c9441691af387118803
MD5 d4ab97d029c12b14e37386902aed1861
BLAKE2b-256 1295a2c42851131f2f7f296fd1fcded06d5eef419afbd5fd498a2a43e956ee26

See more details on using hashes here.

File details

Details for the file ai_mini_box_llm-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_mini_box_llm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b843ee1736709a71edf48423e861869840c5190cbb7b85a12d877bc23acf972f
MD5 74c807ca617ae672a5cfc6ef1ffd9384
BLAKE2b-256 72c41110f761a86886fd5aeb9fcf95a05090b21800dbe92765303748815454a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page