Skip to main content
Quarantined

This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.

kb-ai

PyPI Python versions License

Proof of concept. This package exists to demonstrate the shape of the API and the packaging pipeline. It is not production-hardened — expect breaking changes.

A lightweight, dependency-free knowledge base toolkit for AI applications. Store documents, search them with tf-idf ranking, and persist everything as plain JSON — no vector database or model server required to get started.

Maintained by 4us71n0.

Installation

pip install kb-ai

Quick start

from kb_ai import Document, KnowledgeBase

kb = KnowledgeBase()
kb.add_text("faq-1", "Refunds are issued within 5 business days.", {"topic": "billing"})
kb.add(Document(id="faq-2", text="Password resets are sent by email."))

for hit in kb.search("how long do refunds take"):
    print(hit.score, hit.document.id, hit.document.text)

kb.save("kb.json")
restored = KnowledgeBase.load("kb.json")

Command line

kb-ai add faq-1 "Refunds are issued within 5 business days." --metadata '{"topic": "billing"}'
kb-ai search "refund policy" -n 3
kb-ai list
kb-ai remove faq-1

Every command accepts --store PATH to point at a specific JSON file (default: kb.json in the current directory).

API

Object Purpose
Document(id, text, metadata) A single knowledge base entry.
SearchResult(document, score) A document with its relevance score.
KnowledgeBase add, add_text, get, remove, search, save, load.
tokenize(text) The lowercase alphanumeric tokenizer used for scoring.

Development

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
ruff check .
mypy

Releasing to PyPI

  1. Bump __version__ in src/kb_ai/__init__.py and update CHANGELOG.md.
  2. Build and verify locally:
    python -m build
    twine check dist/*
    
  3. Tag and push — the publish workflow uploads to PyPI via Trusted Publishing:
    git tag v0.1.0 && git push origin v0.1.0
    

See PUBLISHING.md for the one-time PyPI setup.

License

MIT — see LICENSE.

Download files

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

Source Distribution

kb_ai-0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

kb_ai-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file kb_ai-0.1.1.tar.gz.

File metadata

  • Download URL: kb_ai-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for kb_ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5fc504a94739e386ea8c91b865e308fd448f81551cf1219d7e9c87a074efc904
MD5 e539fe10cf2b3235b9403a436460d7b4
BLAKE2b-256 36da58f5204a032c1d9b9cb8ea1d971a64eb7ded3ee76709155a57d73b835c36

See more details on using hashes here.

File details

Details for the file kb_ai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: kb_ai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for kb_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fcc83b434dda755bdb4456d2af611fbcfbfc219fa99ac309370b7cb2889bb82c
MD5 3b54cb2aa6c72126da86a3da8fb8317e
BLAKE2b-256 e0893a597f15a48b82beac4ad047a6b106ac446d9907f9b4c710e6cbcf192edc

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 Sentry Error logging StatusPage Status page